Put PARSERS object into prototype too

This is to avoid the use of this.constructor that breaks advanced build
This commit is contained in:
Florent gravin
2014-10-03 09:23:13 +02:00
parent bea721349a
commit 47e182524f
4 changed files with 50 additions and 50 deletions
+5 -5
View File
@@ -103,7 +103,7 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ =
goog.asserts.assert(node.localName == 'innerBoundaryIs'); goog.asserts.assert(node.localName == 'innerBoundaryIs');
var flatLinearRing = ol.xml.pushParseAndPop( var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined), /** @type {Array.<number>|undefined} */ (undefined),
ol.format.GMLBase.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) { if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */ var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
@@ -125,7 +125,7 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ =
goog.asserts.assert(node.localName == 'outerBoundaryIs'); goog.asserts.assert(node.localName == 'outerBoundaryIs');
var flatLinearRing = ol.xml.pushParseAndPop( var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined), /** @type {Array.<number>|undefined} */ (undefined),
ol.format.GMLBase.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) { if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */ var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
@@ -141,7 +141,7 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ =
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML2.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { ol.format.GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'coordinates': ol.xml.makeReplacer( 'coordinates': ol.xml.makeReplacer(
ol.format.GML2.prototype.readFlatCoordinates_) ol.format.GML2.prototype.readFlatCoordinates_)
@@ -154,7 +154,7 @@ ol.format.GML2.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML2.FLAT_LINEAR_RINGS_PARSERS_ = { ol.format.GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_, 'innerBoundaryIs': ol.format.GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_ 'outerBoundaryIs': ol.format.GML2.prototype.outerBoundaryIsParser_
@@ -167,7 +167,7 @@ ol.format.GML2.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML2.GEOMETRY_PARSERS_ = { ol.format.GML2.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint), 'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint),
'MultiPoint': ol.xml.makeReplacer( 'MultiPoint': ol.xml.makeReplacer(
+25 -25
View File
@@ -116,7 +116,7 @@ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'MultiCurve'); goog.asserts.assert(node.localName == 'MultiCurve');
var lineStrings = ol.xml.pushParseAndPop( var lineStrings = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.LineString>} */ ([]), /** @type {Array.<ol.geom.LineString>} */ ([]),
ol.format.GML3.MULTICURVE_PARSERS_, node, objectStack, this); this.MULTICURVE_PARSERS_, node, objectStack, this);
if (goog.isDef(lineStrings)) { if (goog.isDef(lineStrings)) {
var multiLineString = new ol.geom.MultiLineString(null); var multiLineString = new ol.geom.MultiLineString(null);
multiLineString.setLineStrings(lineStrings); multiLineString.setLineStrings(lineStrings);
@@ -138,7 +138,7 @@ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'MultiSurface'); goog.asserts.assert(node.localName == 'MultiSurface');
var polygons = ol.xml.pushParseAndPop( var polygons = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.Polygon>} */ ([]), /** @type {Array.<ol.geom.Polygon>} */ ([]),
ol.format.GML3.MULTISURFACE_PARSERS_, node, objectStack, this); this.MULTISURFACE_PARSERS_, node, objectStack, this);
if (goog.isDef(polygons)) { if (goog.isDef(polygons)) {
var multiPolygon = new ol.geom.MultiPolygon(null); var multiPolygon = new ol.geom.MultiPolygon(null);
multiPolygon.setPolygons(polygons); multiPolygon.setPolygons(polygons);
@@ -158,7 +158,7 @@ ol.format.GML3.prototype.curveMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'curveMember' || goog.asserts.assert(node.localName == 'curveMember' ||
node.localName == 'curveMembers'); node.localName == 'curveMembers');
ol.xml.parse(ol.format.GML3.CURVEMEMBER_PARSERS_, node, objectStack, this); ol.xml.parse(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
}; };
@@ -171,7 +171,7 @@ ol.format.GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'surfaceMember' || goog.asserts.assert(node.localName == 'surfaceMember' ||
node.localName == 'surfaceMembers'); node.localName == 'surfaceMembers');
ol.xml.parse(ol.format.GML3.SURFACEMEMBER_PARSERS_, ol.xml.parse(this.SURFACEMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -187,7 +187,7 @@ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'patches'); goog.asserts.assert(node.localName == 'patches');
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]), /** @type {Array.<Array.<number>>} */ ([null]),
ol.format.GML3.PATCHES_PARSERS_, node, objectStack, this); this.PATCHES_PARSERS_, node, objectStack, this);
}; };
@@ -202,7 +202,7 @@ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'segments'); goog.asserts.assert(node.localName == 'segments');
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
/** @type {Array.<number>} */ ([null]), /** @type {Array.<number>} */ ([null]),
ol.format.GML3.SEGMENTS_PARSERS_, node, objectStack, this); this.SEGMENTS_PARSERS_, node, objectStack, this);
}; };
@@ -217,7 +217,7 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'PolygonPatch'); goog.asserts.assert(node.localName == 'PolygonPatch');
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]), /** @type {Array.<Array.<number>>} */ ([null]),
this.constructor.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
}; };
@@ -233,7 +233,7 @@ ol.format.GML3.prototype.readLineStringSegment_ =
goog.asserts.assert(node.localName == 'LineStringSegment'); goog.asserts.assert(node.localName == 'LineStringSegment');
return ol.xml.pushParseAndPop( return ol.xml.pushParseAndPop(
/** @type {Array.<number>} */ ([null]), /** @type {Array.<number>} */ ([null]),
this.constructor.GEOMETRY_FLAT_COORDINATES_PARSERS_, this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -248,7 +248,7 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'interior'); goog.asserts.assert(node.localName == 'interior');
var flatLinearRing = ol.xml.pushParseAndPop( var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined), /** @type {Array.<number>|undefined} */ (undefined),
ol.format.GMLBase.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) { if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */ var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
@@ -269,7 +269,7 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'exterior'); goog.asserts.assert(node.localName == 'exterior');
var flatLinearRing = ol.xml.pushParseAndPop( var flatLinearRing = ol.xml.pushParseAndPop(
/** @type {Array.<number>|undefined} */ (undefined), /** @type {Array.<number>|undefined} */ (undefined),
ol.format.GMLBase.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
if (goog.isDef(flatLinearRing)) { if (goog.isDef(flatLinearRing)) {
var flatLinearRings = /** @type {Array.<Array.<number>>} */ var flatLinearRings = /** @type {Array.<Array.<number>>} */
(objectStack[objectStack.length - 1]); (objectStack[objectStack.length - 1]);
@@ -291,7 +291,7 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'Surface'); goog.asserts.assert(node.localName == 'Surface');
var flatLinearRings = ol.xml.pushParseAndPop( var flatLinearRings = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]), /** @type {Array.<Array.<number>>} */ ([null]),
ol.format.GML3.SURFACE_PARSERS_, node, objectStack, this); this.SURFACE_PARSERS_, node, objectStack, this);
if (goog.isDef(flatLinearRings) && if (goog.isDef(flatLinearRings) &&
!goog.isNull(flatLinearRings[0])) { !goog.isNull(flatLinearRings[0])) {
var polygon = new ol.geom.Polygon(null); var polygon = new ol.geom.Polygon(null);
@@ -322,7 +322,7 @@ ol.format.GML3.prototype.readCurve_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'Curve'); goog.asserts.assert(node.localName == 'Curve');
var flatCoordinates = ol.xml.pushParseAndPop( var flatCoordinates = ol.xml.pushParseAndPop(
/** @type {Array.<number>} */ ([null]), /** @type {Array.<number>} */ ([null]),
ol.format.GML3.CURVE_PARSERS_, node, objectStack, this); this.CURVE_PARSERS_, node, objectStack, this);
if (goog.isDef(flatCoordinates)) { if (goog.isDef(flatCoordinates)) {
var lineString = new ol.geom.LineString(null); var lineString = new ol.geom.LineString(null);
lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates); lineString.setFlatCoordinates(ol.geom.GeometryLayout.XYZ, flatCoordinates);
@@ -344,7 +344,7 @@ ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) {
goog.asserts.assert(node.localName == 'Envelope'); goog.asserts.assert(node.localName == 'Envelope');
var flatCoordinates = ol.xml.pushParseAndPop( var flatCoordinates = ol.xml.pushParseAndPop(
/** @type {Array.<number>} */ ([null]), /** @type {Array.<number>} */ ([null]),
ol.format.GML3.ENVELOPE_PARSERS_, node, objectStack, this); this.ENVELOPE_PARSERS_, node, objectStack, this);
return ol.extent.createOrUpdate(flatCoordinates[1][0], return ol.extent.createOrUpdate(flatCoordinates[1][0],
flatCoordinates[1][1], flatCoordinates[2][0], flatCoordinates[1][1], flatCoordinates[2][0],
flatCoordinates[2][1]); flatCoordinates[2][1]);
@@ -448,7 +448,7 @@ ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { ol.format.GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'pos': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPos_), 'pos': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPos_),
'posList': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPosList_) 'posList': ol.xml.makeReplacer(ol.format.GML3.prototype.readFlatPosList_)
@@ -461,7 +461,7 @@ ol.format.GML3.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.FLAT_LINEAR_RINGS_PARSERS_ = { ol.format.GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'interior': ol.format.GML3.prototype.interiorParser_, 'interior': ol.format.GML3.prototype.interiorParser_,
'exterior': ol.format.GML3.prototype.exteriorParser_ 'exterior': ol.format.GML3.prototype.exteriorParser_
@@ -474,7 +474,7 @@ ol.format.GML3.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.GEOMETRY_PARSERS_ = { ol.format.GML3.prototype.GEOMETRY_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint), 'Point': ol.xml.makeReplacer(ol.format.GMLBase.prototype.readPoint),
'MultiPoint': ol.xml.makeReplacer( 'MultiPoint': ol.xml.makeReplacer(
@@ -504,7 +504,7 @@ ol.format.GML3.GEOMETRY_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.MULTICURVE_PARSERS_ = { ol.format.GML3.prototype.MULTICURVE_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'curveMember': ol.xml.makeArrayPusher( 'curveMember': ol.xml.makeArrayPusher(
ol.format.GML3.prototype.curveMemberParser_), ol.format.GML3.prototype.curveMemberParser_),
@@ -519,7 +519,7 @@ ol.format.GML3.MULTICURVE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.MULTISURFACE_PARSERS_ = { ol.format.GML3.prototype.MULTISURFACE_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'surfaceMember': ol.xml.makeArrayPusher( 'surfaceMember': ol.xml.makeArrayPusher(
ol.format.GML3.prototype.surfaceMemberParser_), ol.format.GML3.prototype.surfaceMemberParser_),
@@ -534,7 +534,7 @@ ol.format.GML3.MULTISURFACE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.CURVEMEMBER_PARSERS_ = { ol.format.GML3.prototype.CURVEMEMBER_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'LineString': ol.xml.makeArrayPusher( 'LineString': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readLineString), ol.format.GMLBase.prototype.readLineString),
@@ -548,7 +548,7 @@ ol.format.GML3.CURVEMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.SURFACEMEMBER_PARSERS_ = { ol.format.GML3.prototype.SURFACEMEMBER_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'Polygon': ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readPolygon), 'Polygon': ol.xml.makeArrayPusher(ol.format.GMLBase.prototype.readPolygon),
'Surface': ol.xml.makeArrayPusher(ol.format.GML3.prototype.readSurface_) 'Surface': ol.xml.makeArrayPusher(ol.format.GML3.prototype.readSurface_)
@@ -561,7 +561,7 @@ ol.format.GML3.SURFACEMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.SURFACE_PARSERS_ = { ol.format.GML3.prototype.SURFACE_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'patches': ol.xml.makeReplacer(ol.format.GML3.prototype.readPatch_) 'patches': ol.xml.makeReplacer(ol.format.GML3.prototype.readPatch_)
} }
@@ -573,7 +573,7 @@ ol.format.GML3.SURFACE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.CURVE_PARSERS_ = { ol.format.GML3.prototype.CURVE_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'segments': ol.xml.makeReplacer(ol.format.GML3.prototype.readSegment_) 'segments': ol.xml.makeReplacer(ol.format.GML3.prototype.readSegment_)
} }
@@ -585,7 +585,7 @@ ol.format.GML3.CURVE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.ENVELOPE_PARSERS_ = { ol.format.GML3.prototype.ENVELOPE_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'lowerCorner': ol.xml.makeArrayPusher( 'lowerCorner': ol.xml.makeArrayPusher(
ol.format.GML3.prototype.readFlatPosList_), ol.format.GML3.prototype.readFlatPosList_),
@@ -600,7 +600,7 @@ ol.format.GML3.ENVELOPE_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.PATCHES_PARSERS_ = { ol.format.GML3.prototype.PATCHES_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'PolygonPatch': ol.xml.makeReplacer( 'PolygonPatch': ol.xml.makeReplacer(
ol.format.GML3.prototype.readPolygonPatch_) ol.format.GML3.prototype.readPolygonPatch_)
@@ -613,7 +613,7 @@ ol.format.GML3.PATCHES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GML3.SEGMENTS_PARSERS_ = { ol.format.GML3.prototype.SEGMENTS_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'LineStringSegment': ol.xml.makeReplacer( 'LineStringSegment': ol.xml.makeReplacer(
ol.format.GML3.prototype.readLineStringSegment_) ol.format.GML3.prototype.readLineStringSegment_)
+19 -19
View File
@@ -83,7 +83,7 @@ ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
var features; var features;
if (localName == 'FeatureCollection') { if (localName == 'FeatureCollection') {
features = ol.xml.pushParseAndPop(null, features = ol.xml.pushParseAndPop(null,
ol.format.GMLBase.FEATURE_COLLECTION_PARSERS, node, this.FEATURE_COLLECTION_PARSERS, node,
objectStack, this); objectStack, this);
} else if (localName == 'featureMembers' || localName == 'featureMember') { } else if (localName == 'featureMembers' || localName == 'featureMember') {
var context = objectStack[0]; var context = objectStack[0];
@@ -113,7 +113,7 @@ ol.format.GMLBase.prototype.readFeatures_ = function(node, objectStack) {
/** /**
* @type {Object.<string, Object.<string, Object>>} * @type {Object.<string, Object.<string, Object>>}
*/ */
ol.format.GMLBase.FEATURE_COLLECTION_PARSERS = { ol.format.GMLBase.prototype.FEATURE_COLLECTION_PARSERS = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'featureMember': ol.xml.makeArrayPusher( 'featureMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFeatures_), ol.format.GMLBase.prototype.readFeatures_),
@@ -134,7 +134,7 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
goog.object.set(context, 'srsName', goog.object.set(context, 'srsName',
node.firstElementChild.getAttribute('srsName')); node.firstElementChild.getAttribute('srsName'));
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null), var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
this.constructor.GEOMETRY_PARSERS_, node, objectStack, this); this.GEOMETRY_PARSERS_, node, objectStack, this);
if (goog.isDefAndNotNull(geometry)) { if (goog.isDefAndNotNull(geometry)) {
return /** @type {ol.geom.Geometry} */ ( return /** @type {ol.geom.Geometry} */ (
ol.format.Feature.transformWithOptions(geometry, false, context)); ol.format.Feature.transformWithOptions(geometry, false, context));
@@ -212,7 +212,7 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
goog.asserts.assert(node.localName == 'MultiPoint'); goog.asserts.assert(node.localName == 'MultiPoint');
var coordinates = ol.xml.pushParseAndPop( var coordinates = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([]), /** @type {Array.<Array.<number>>} */ ([]),
ol.format.GMLBase.MULTIPOINT_PARSERS_, node, objectStack, this); this.MULTIPOINT_PARSERS_, node, objectStack, this);
if (goog.isDef(coordinates)) { if (goog.isDef(coordinates)) {
return new ol.geom.MultiPoint(coordinates); return new ol.geom.MultiPoint(coordinates);
} else { } else {
@@ -231,7 +231,7 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
goog.asserts.assert(node.localName == 'MultiLineString'); goog.asserts.assert(node.localName == 'MultiLineString');
var lineStrings = ol.xml.pushParseAndPop( var lineStrings = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.LineString>} */ ([]), /** @type {Array.<ol.geom.LineString>} */ ([]),
ol.format.GMLBase.MULTILINESTRING_PARSERS_, node, objectStack, this); this.MULTILINESTRING_PARSERS_, node, objectStack, this);
if (goog.isDef(lineStrings)) { if (goog.isDef(lineStrings)) {
var multiLineString = new ol.geom.MultiLineString(null); var multiLineString = new ol.geom.MultiLineString(null);
multiLineString.setLineStrings(lineStrings); multiLineString.setLineStrings(lineStrings);
@@ -252,7 +252,7 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
goog.asserts.assert(node.localName == 'MultiPolygon'); goog.asserts.assert(node.localName == 'MultiPolygon');
var polygons = ol.xml.pushParseAndPop( var polygons = ol.xml.pushParseAndPop(
/** @type {Array.<ol.geom.Polygon>} */ ([]), /** @type {Array.<ol.geom.Polygon>} */ ([]),
ol.format.GMLBase.MULTIPOLYGON_PARSERS_, node, objectStack, this); this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (goog.isDef(polygons)) { if (goog.isDef(polygons)) {
var multiPolygon = new ol.geom.MultiPolygon(null); var multiPolygon = new ol.geom.MultiPolygon(null);
multiPolygon.setPolygons(polygons); multiPolygon.setPolygons(polygons);
@@ -272,7 +272,7 @@ ol.format.GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'pointMember' || goog.asserts.assert(node.localName == 'pointMember' ||
node.localName == 'pointMembers'); node.localName == 'pointMembers');
ol.xml.parse(ol.format.GMLBase.POINTMEMBER_PARSERS_, ol.xml.parse(this.POINTMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -287,7 +287,7 @@ ol.format.GMLBase.prototype.lineStringMemberParser_ =
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'lineStringMember' || goog.asserts.assert(node.localName == 'lineStringMember' ||
node.localName == 'lineStringMembers'); node.localName == 'lineStringMembers');
ol.xml.parse(ol.format.GMLBase.LINESTRINGMEMBER_PARSERS_, ol.xml.parse(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this); node, objectStack, this);
}; };
@@ -302,7 +302,7 @@ ol.format.GMLBase.prototype.polygonMemberParser_ =
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'polygonMember' || goog.asserts.assert(node.localName == 'polygonMember' ||
node.localName == 'polygonMembers'); node.localName == 'polygonMembers');
ol.xml.parse(ol.format.GMLBase.POLYGONMEMBER_PARSERS_, node, ol.xml.parse(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this); objectStack, this);
}; };
@@ -337,7 +337,7 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.localName == 'LinearRing'); goog.asserts.assert(node.localName == 'LinearRing');
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null), var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
this.constructor.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this); objectStack, this);
if (goog.isDefAndNotNull(ring)) { if (goog.isDefAndNotNull(ring)) {
return ring; return ring;
@@ -377,7 +377,7 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
goog.asserts.assert(node.localName == 'Polygon'); goog.asserts.assert(node.localName == 'Polygon');
var flatLinearRings = ol.xml.pushParseAndPop( var flatLinearRings = ol.xml.pushParseAndPop(
/** @type {Array.<Array.<number>>} */ ([null]), /** @type {Array.<Array.<number>>} */ ([null]),
this.constructor.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
if (goog.isDef(flatLinearRings) && if (goog.isDef(flatLinearRings) &&
!goog.isNull(flatLinearRings[0])) { !goog.isNull(flatLinearRings[0])) {
var polygon = new ol.geom.Polygon(null); var polygon = new ol.geom.Polygon(null);
@@ -408,7 +408,7 @@ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ =
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT); goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop( return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
null, null,
this.constructor.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this)); objectStack, this));
}; };
@@ -418,7 +418,7 @@ ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ =
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.MULTIPOINT_PARSERS_ = { ol.format.GMLBase.prototype.MULTIPOINT_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'pointMember': ol.xml.makeArrayPusher( 'pointMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.pointMemberParser_), ol.format.GMLBase.prototype.pointMemberParser_),
@@ -433,7 +433,7 @@ ol.format.GMLBase.MULTIPOINT_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.MULTILINESTRING_PARSERS_ = { ol.format.GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'lineStringMember': ol.xml.makeArrayPusher( 'lineStringMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.lineStringMemberParser_), ol.format.GMLBase.prototype.lineStringMemberParser_),
@@ -448,7 +448,7 @@ ol.format.GMLBase.MULTILINESTRING_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.MULTIPOLYGON_PARSERS_ = { ol.format.GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'polygonMember': ol.xml.makeArrayPusher( 'polygonMember': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.polygonMemberParser_), ol.format.GMLBase.prototype.polygonMemberParser_),
@@ -463,7 +463,7 @@ ol.format.GMLBase.MULTIPOLYGON_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.POINTMEMBER_PARSERS_ = { ol.format.GMLBase.prototype.POINTMEMBER_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'Point': ol.xml.makeArrayPusher( 'Point': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_) ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_)
@@ -476,7 +476,7 @@ ol.format.GMLBase.POINTMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.LINESTRINGMEMBER_PARSERS_ = { ol.format.GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'LineString': ol.xml.makeArrayPusher( 'LineString': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readLineString) ol.format.GMLBase.prototype.readLineString)
@@ -489,7 +489,7 @@ ol.format.GMLBase.LINESTRINGMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @private * @private
*/ */
ol.format.GMLBase.POLYGONMEMBER_PARSERS_ = { ol.format.GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'Polygon': ol.xml.makeArrayPusher( 'Polygon': ol.xml.makeArrayPusher(
ol.format.GMLBase.prototype.readPolygon) ol.format.GMLBase.prototype.readPolygon)
@@ -502,7 +502,7 @@ ol.format.GMLBase.POLYGONMEMBER_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.xml.Parser>>} * @type {Object.<string, Object.<string, ol.xml.Parser>>}
* @protected * @protected
*/ */
ol.format.GMLBase.RING_PARSERS = { ol.format.GMLBase.prototype.RING_PARSERS = {
'http://www.opengis.net/gml' : { 'http://www.opengis.net/gml' : {
'LinearRing': ol.xml.makeReplacer( 'LinearRing': ol.xml.makeReplacer(
ol.format.GMLBase.prototype.readFlatLinearRing_) ol.format.GMLBase.prototype.readFlatLinearRing_)
+1 -1
View File
@@ -127,7 +127,7 @@ ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
goog.isDef(opt_options) ? opt_options : {})); goog.isDef(opt_options) ? opt_options : {}));
var objectStack = [context]; var objectStack = [context];
var features = ol.xml.pushParseAndPop([], var features = ol.xml.pushParseAndPop([],
ol.format.GMLBase.FEATURE_COLLECTION_PARSERS, node, this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
objectStack, this.gmlFormat_); objectStack, this.gmlFormat_);
if (!goog.isDef(features)) { if (!goog.isDef(features)) {
features = []; features = [];