Rename _ol_format_GML2_ to GML2

This commit is contained in:
Tim Schaub
2017-12-17 01:48:47 -07:00
parent fc690bf063
commit f8610190bb
5 changed files with 83 additions and 83 deletions

View File

@@ -21,7 +21,7 @@ import _ol_xml_ from '../xml.js';
* @extends {ol.format.GMLBase} * @extends {ol.format.GMLBase}
* @api * @api
*/ */
var _ol_format_GML2_ = function(opt_options) { var GML2 = function(opt_options) {
var options = /** @type {olx.format.GMLOptions} */ var options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {}); (opt_options ? opt_options : {});
@@ -35,11 +35,11 @@ var _ol_format_GML2_ = function(opt_options) {
* @inheritDoc * @inheritDoc
*/ */
this.schemaLocation = options.schemaLocation ? this.schemaLocation = options.schemaLocation ?
options.schemaLocation : _ol_format_GML2_.schemaLocation_; options.schemaLocation : GML2.schemaLocation_;
}; };
inherits(_ol_format_GML2_, _ol_format_GMLBase_); inherits(GML2, _ol_format_GMLBase_);
/** /**
@@ -47,7 +47,7 @@ inherits(_ol_format_GML2_, _ol_format_GMLBase_);
* @type {string} * @type {string}
* @private * @private
*/ */
_ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS + GML2.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
' http://schemas.opengis.net/gml/2.1.2/feature.xsd'; ' http://schemas.opengis.net/gml/2.1.2/feature.xsd';
@@ -57,7 +57,7 @@ _ol_format_GML2_.schemaLocation_ = _ol_format_GMLBase_.GMLNS +
* @private * @private
* @return {Array.<number>|undefined} Flat coordinates. * @return {Array.<number>|undefined} Flat coordinates.
*/ */
_ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) { GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, ''); var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]); var context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
var containerSrs = context['srsName']; var containerSrs = context['srsName'];
@@ -92,7 +92,7 @@ _ol_format_GML2_.prototype.readFlatCoordinates_ = function(node, objectStack) {
* @private * @private
* @return {ol.Extent|undefined} Envelope. * @return {ol.Extent|undefined} Envelope.
*/ */
_ol_format_GML2_.prototype.readBox_ = function(node, objectStack) { GML2.prototype.readBox_ = function(node, objectStack) {
/** @type {Array.<number>} */ /** @type {Array.<number>} */
var flatCoordinates = _ol_xml_.pushParseAndPop([null], var flatCoordinates = _ol_xml_.pushParseAndPop([null],
this.BOX_PARSERS_, node, objectStack, this); this.BOX_PARSERS_, node, objectStack, this);
@@ -107,7 +107,7 @@ _ol_format_GML2_.prototype.readBox_ = function(node, objectStack) {
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack) { GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -124,7 +124,7 @@ _ol_format_GML2_.prototype.innerBoundaryIsParser_ = function(node, objectStack)
* @param {Array.<*>} objectStack Object stack. * @param {Array.<*>} objectStack Object stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack) { GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
/** @type {Array.<number>|undefined} */ /** @type {Array.<number>|undefined} */
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined, var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
this.RING_PARSERS, node, objectStack, this); this.RING_PARSERS, node, objectStack, this);
@@ -141,10 +141,10 @@ _ol_format_GML2_.prototype.outerBoundaryIsParser_ = function(node, objectStack)
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = { 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_) GML2.prototype.readFlatCoordinates_)
} }
}; };
@@ -154,10 +154,10 @@ _ol_format_GML2_.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = { GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'innerBoundaryIs': _ol_format_GML2_.prototype.innerBoundaryIsParser_, 'innerBoundaryIs': GML2.prototype.innerBoundaryIsParser_,
'outerBoundaryIs': _ol_format_GML2_.prototype.outerBoundaryIsParser_ 'outerBoundaryIs': GML2.prototype.outerBoundaryIsParser_
} }
}; };
@@ -167,10 +167,10 @@ _ol_format_GML2_.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.BOX_PARSERS_ = { GML2.prototype.BOX_PARSERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'coordinates': _ol_xml_.makeArrayPusher( 'coordinates': _ol_xml_.makeArrayPusher(
_ol_format_GML2_.prototype.readFlatCoordinates_) GML2.prototype.readFlatCoordinates_)
} }
}; };
@@ -180,7 +180,7 @@ _ol_format_GML2_.prototype.BOX_PARSERS_ = {
* @type {Object.<string, Object.<string, ol.XmlParser>>} * @type {Object.<string, Object.<string, ol.XmlParser>>}
* @private * @private
*/ */
_ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = { 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(
@@ -194,7 +194,7 @@ _ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = {
'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon), 'Polygon': _ol_xml_.makeReplacer(_ol_format_GMLBase_.prototype.readPolygon),
'MultiPolygon': _ol_xml_.makeReplacer( 'MultiPolygon': _ol_xml_.makeReplacer(
_ol_format_GMLBase_.prototype.readMultiPolygon), _ol_format_GMLBase_.prototype.readMultiPolygon),
'Box': _ol_xml_.makeReplacer(_ol_format_GML2_.prototype.readBox_) 'Box': _ol_xml_.makeReplacer(GML2.prototype.readBox_)
} }
}; };
@@ -207,7 +207,7 @@ _ol_format_GML2_.prototype.GEOMETRY_PARSERS_ = {
* @return {Node|undefined} Node. * @return {Node|undefined} Node.
* @private * @private
*/ */
_ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var multiSurface = context['multiSurface']; var multiSurface = context['multiSurface'];
var surface = context['surface']; var surface = context['surface'];
@@ -235,7 +235,7 @@ _ol_format_GML2_.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack,
* @param {ol.Feature} feature Feature. * @param {ol.Feature} feature Feature.
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
*/ */
_ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectStack) { GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
var fid = feature.getId(); var fid = feature.getId();
if (fid) { if (fid) {
node.setAttribute('fid', fid); node.setAttribute('fid', fid);
@@ -282,7 +282,7 @@ _ol_format_GML2_.prototype.writeFeatureElement = function(node, feature, objectS
* @param {ol.geom.Geometry|ol.Extent} geometry Geometry. * @param {ol.geom.Geometry|ol.Extent} geometry Geometry.
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
*/ */
_ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objectStack) { GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
var item = _ol_obj_.assign({}, context); var item = _ol_obj_.assign({}, context);
item.node = node; item.node = node;
@@ -299,7 +299,7 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec
FeatureFormat.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context); FeatureFormat.transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
} }
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
(item), _ol_format_GML2_.GEOMETRY_SERIALIZERS_, (item), GML2.GEOMETRY_SERIALIZERS_,
this.GEOMETRY_NODE_FACTORY_, [value], this.GEOMETRY_NODE_FACTORY_, [value],
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -311,7 +311,7 @@ _ol_format_GML2_.prototype.writeGeometryElement = function(node, geometry, objec
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) { GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (node.nodeName !== 'LineStringSegment' && srsName) { if (node.nodeName !== 'LineStringSegment' && srsName) {
@@ -336,7 +336,7 @@ _ol_format_GML2_.prototype.writeCurveOrLineString_ = function(node, geometry, ob
* @returns {Node} coordinates node. * @returns {Node} coordinates node.
* @private * @private
*/ */
_ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) { GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates'); var coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates');
coordinates.setAttribute('decimal', '.'); coordinates.setAttribute('decimal', '.');
coordinates.setAttribute('cs', ','); coordinates.setAttribute('cs', ',');
@@ -352,7 +352,7 @@ _ol_format_GML2_.prototype.createCoordinatesNode_ = function(namespaceURI) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack) { GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -375,7 +375,7 @@ _ol_format_GML2_.prototype.writeCoordinates_ = function(node, value, objectStack
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStack) { GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, var child = _ol_xml_.createElementNS(node.namespaceURI,
'LineStringSegment'); 'LineStringSegment');
node.appendChild(child); node.appendChild(child);
@@ -389,7 +389,7 @@ _ol_format_GML2_.prototype.writeCurveSegments_ = function(node, line, objectStac
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -400,7 +400,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
var rings = geometry.getLinearRings(); var rings = geometry.getLinearRings();
_ol_xml_.pushSerializeAndPop( _ol_xml_.pushSerializeAndPop(
{node: node, hasZ: hasZ, srsName: srsName}, {node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.RING_SERIALIZERS_, GML2.RING_SERIALIZERS_,
this.RING_NODE_FACTORY_, this.RING_NODE_FACTORY_,
rings, objectStack, undefined, this); rings, objectStack, undefined, this);
} else if (node.nodeName === 'Surface') { } else if (node.nodeName === 'Surface') {
@@ -419,7 +419,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygon_ = function(node, geometry, obj
* @return {Node} Node. * @return {Node} Node.
* @private * @private
*/ */
_ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var parentNode = context.node; var parentNode = context.node;
var exteriorWritten = context['exteriorWritten']; var exteriorWritten = context['exteriorWritten'];
@@ -437,7 +437,7 @@ _ol_format_GML2_.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) { GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
node.appendChild(child); node.appendChild(child);
this.writeSurfaceOrPolygon_(child, polygon, objectStack); this.writeSurfaceOrPolygon_(child, polygon, objectStack);
@@ -450,7 +450,7 @@ _ol_format_GML2_.prototype.writeSurfacePatches_ = function(node, polygon, object
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) { GML2.prototype.writeRing_ = function(node, ring, objectStack) {
var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing'); var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
node.appendChild(linearRing); node.appendChild(linearRing);
this.writeLinearRing_(linearRing, ring, objectStack); this.writeLinearRing_(linearRing, ring, objectStack);
@@ -464,7 +464,7 @@ _ol_format_GML2_.prototype.writeRing_ = function(node, ring, objectStack) {
* @return {string} The coords string. * @return {string} The coords string.
* @private * @private
*/ */
_ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) { GML2.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
var axisOrientation = 'enu'; var axisOrientation = 'enu';
if (opt_srsName) { if (opt_srsName) {
axisOrientation = getProjection(opt_srsName).getAxisOrientation(); axisOrientation = getProjection(opt_srsName).getAxisOrientation();
@@ -488,7 +488,7 @@ _ol_format_GML2_.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) { GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -498,7 +498,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
} }
var lines = geometry.getLineStrings(); var lines = geometry.getLineStrings();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve}, _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_, GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -510,7 +510,7 @@ _ol_format_GML2_.prototype.writeMultiCurveOrLineString_ = function(node, geometr
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) { GML2.prototype.writePoint_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -531,7 +531,7 @@ _ol_format_GML2_.prototype.writePoint_ = function(node, geometry, objectStack) {
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry, GML2.prototype.writeMultiPoint_ = function(node, geometry,
objectStack) { objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
@@ -541,7 +541,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
} }
var points = geometry.getPoints(); var points = geometry.getPoints();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName}, _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_, GML2.POINTMEMBER_SERIALIZERS_,
_ol_xml_.makeSimpleNodeFactory('pointMember'), points, _ol_xml_.makeSimpleNodeFactory('pointMember'), points,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -553,7 +553,7 @@ _ol_format_GML2_.prototype.writeMultiPoint_ = function(node, geometry,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack) { GML2.prototype.writePointMember_ = function(node, point, objectStack) {
var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point'); var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
node.appendChild(child); node.appendChild(child);
this.writePoint_(child, point, objectStack); this.writePoint_(child, point, objectStack);
@@ -566,7 +566,7 @@ _ol_format_GML2_.prototype.writePointMember_ = function(node, point, objectStack
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) { GML2.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack); var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
if (child) { if (child) {
node.appendChild(child); node.appendChild(child);
@@ -581,7 +581,7 @@ _ol_format_GML2_.prototype.writeLineStringOrCurveMember_ = function(node, line,
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectStack) { GML2.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -599,7 +599,7 @@ _ol_format_GML2_.prototype.writeLinearRing_ = function(node, geometry, objectSta
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) { GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var hasZ = context['hasZ']; var hasZ = context['hasZ'];
var srsName = context['srsName']; var srsName = context['srsName'];
@@ -609,7 +609,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
} }
var polygons = geometry.getPolygons(); var polygons = geometry.getPolygons();
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface}, _ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_, GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons, this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
objectStack, undefined, this); objectStack, undefined, this);
}; };
@@ -621,7 +621,7 @@ _ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) { GML2.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
var child = this.GEOMETRY_NODE_FACTORY_( var child = this.GEOMETRY_NODE_FACTORY_(
polygon, objectStack); polygon, objectStack);
if (child) { if (child) {
@@ -637,7 +637,7 @@ _ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon
* @param {Array.<*>} objectStack Node stack. * @param {Array.<*>} objectStack Node stack.
* @private * @private
*/ */
_ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) { GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
var context = objectStack[objectStack.length - 1]; var context = objectStack[objectStack.length - 1];
var srsName = context['srsName']; var srsName = context['srsName'];
if (srsName) { if (srsName) {
@@ -646,7 +646,7 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
var keys = ['lowerCorner', 'upperCorner']; var keys = ['lowerCorner', 'upperCorner'];
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]]; var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
({node: node}), _ol_format_GML2_.ENVELOPE_SERIALIZERS_, ({node: node}), GML2.ENVELOPE_SERIALIZERS_,
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
values, values,
objectStack, keys, this); objectStack, keys, this);
@@ -658,31 +658,31 @@ _ol_format_GML2_.prototype.writeEnvelope = function(node, extent, objectStack) {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.GEOMETRY_SERIALIZERS_ = { GML2.GEOMETRY_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'Curve': _ol_xml_.makeChildAppender( 'Curve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_), GML2.prototype.writeCurveOrLineString_),
'MultiCurve': _ol_xml_.makeChildAppender( 'MultiCurve': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_), GML2.prototype.writeMultiCurveOrLineString_),
'Point': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writePoint_), 'Point': _ol_xml_.makeChildAppender(GML2.prototype.writePoint_),
'MultiPoint': _ol_xml_.makeChildAppender( 'MultiPoint': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiPoint_), GML2.prototype.writeMultiPoint_),
'LineString': _ol_xml_.makeChildAppender( 'LineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeCurveOrLineString_), GML2.prototype.writeCurveOrLineString_),
'MultiLineString': _ol_xml_.makeChildAppender( 'MultiLineString': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiCurveOrLineString_), GML2.prototype.writeMultiCurveOrLineString_),
'LinearRing': _ol_xml_.makeChildAppender( 'LinearRing': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLinearRing_), GML2.prototype.writeLinearRing_),
'Polygon': _ol_xml_.makeChildAppender( 'Polygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_), GML2.prototype.writeSurfaceOrPolygon_),
'MultiPolygon': _ol_xml_.makeChildAppender( 'MultiPolygon': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), GML2.prototype.writeMultiSurfaceOrPolygon_),
'Surface': _ol_xml_.makeChildAppender( 'Surface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygon_), GML2.prototype.writeSurfaceOrPolygon_),
'MultiSurface': _ol_xml_.makeChildAppender( 'MultiSurface': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeMultiSurfaceOrPolygon_), GML2.prototype.writeMultiSurfaceOrPolygon_),
'Envelope': _ol_xml_.makeChildAppender( 'Envelope': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeEnvelope) GML2.prototype.writeEnvelope)
} }
}; };
@@ -691,10 +691,10 @@ _ol_format_GML2_.GEOMETRY_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.RING_SERIALIZERS_ = { GML2.RING_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'outerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_), 'outerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_),
'innerBoundaryIs': _ol_xml_.makeChildAppender(_ol_format_GML2_.prototype.writeRing_) 'innerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_)
} }
}; };
@@ -703,10 +703,10 @@ _ol_format_GML2_.RING_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = { GML2.POINTMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'pointMember': _ol_xml_.makeChildAppender( 'pointMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writePointMember_) GML2.prototype.writePointMember_)
} }
}; };
@@ -715,12 +715,12 @@ _ol_format_GML2_.POINTMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = { GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lineStringMember': _ol_xml_.makeChildAppender( 'lineStringMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_), GML2.prototype.writeLineStringOrCurveMember_),
'curveMember': _ol_xml_.makeChildAppender( 'curveMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeLineStringOrCurveMember_) GML2.prototype.writeLineStringOrCurveMember_)
} }
}; };
@@ -733,10 +733,10 @@ _ol_format_GML2_.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
* @return {Node|undefined} Node. * @return {Node|undefined} Node.
* @private * @private
*/ */
_ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) { GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
var parentNode = objectStack[objectStack.length - 1].node; var parentNode = objectStack[objectStack.length - 1].node;
return _ol_xml_.createElementNS('http://www.opengis.net/gml', return _ol_xml_.createElementNS('http://www.opengis.net/gml',
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]); GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
}; };
/** /**
@@ -744,7 +744,7 @@ _ol_format_GML2_.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value,
* @type {Object.<string, string>} * @type {Object.<string, string>}
* @private * @private
*/ */
_ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = { GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
'MultiLineString': 'lineStringMember', 'MultiLineString': 'lineStringMember',
'MultiCurve': 'curveMember', 'MultiCurve': 'curveMember',
'MultiPolygon': 'polygonMember', 'MultiPolygon': 'polygonMember',
@@ -757,12 +757,12 @@ _ol_format_GML2_.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = { GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'surfaceMember': _ol_xml_.makeChildAppender( 'surfaceMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_), GML2.prototype.writeSurfaceOrPolygonMember_),
'polygonMember': _ol_xml_.makeChildAppender( 'polygonMember': _ol_xml_.makeChildAppender(
_ol_format_GML2_.prototype.writeSurfaceOrPolygonMember_) GML2.prototype.writeSurfaceOrPolygonMember_)
} }
}; };
@@ -771,10 +771,10 @@ _ol_format_GML2_.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
* @type {Object.<string, Object.<string, ol.XmlSerializer>>} * @type {Object.<string, Object.<string, ol.XmlSerializer>>}
* @private * @private
*/ */
_ol_format_GML2_.ENVELOPE_SERIALIZERS_ = { GML2.ENVELOPE_SERIALIZERS_ = {
'http://www.opengis.net/gml': { 'http://www.opengis.net/gml': {
'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode), 'lowerCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode),
'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode) 'upperCorner': _ol_xml_.makeChildAppender(_ol_format_XSD_.writeStringTextNode)
} }
}; };
export default _ol_format_GML2_; export default GML2;

View File

@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_asserts_ from '../asserts.js'; import _ol_asserts_ from '../asserts.js';
import _ol_format_GML2_ from '../format/GML2.js'; import GML2 from '../format/GML2.js';
import GML3 from '../format/GML3.js'; import GML3 from '../format/GML3.js';
import _ol_format_GMLBase_ from '../format/GMLBase.js'; import _ol_format_GMLBase_ from '../format/GMLBase.js';
import _ol_format_filter_ from '../format/filter.js'; import _ol_format_filter_ from '../format/filter.js';
@@ -401,7 +401,7 @@ _ol_format_WFS_.writeFeature_ = function(node, feature, objectStack) {
var child = _ol_xml_.createElementNS(featureNS, featureType); var child = _ol_xml_.createElementNS(featureNS, featureType);
node.appendChild(child); node.appendChild(child);
if (gmlVersion === 2) { if (gmlVersion === 2) {
_ol_format_GML2_.prototype.writeFeatureElement(child, feature, objectStack); GML2.prototype.writeFeatureElement(child, feature, objectStack);
} else { } else {
GML3.prototype.writeFeatureElement(child, feature, objectStack); GML3.prototype.writeFeatureElement(child, feature, objectStack);
} }
@@ -524,7 +524,7 @@ _ol_format_WFS_.writeProperty_ = function(node, pair, objectStack) {
node.appendChild(value); node.appendChild(value);
if (pair.value instanceof Geometry) { if (pair.value instanceof Geometry) {
if (gmlVersion === 2) { if (gmlVersion === 2) {
_ol_format_GML2_.prototype.writeGeometryElement(value, GML2.prototype.writeGeometryElement(value,
pair.value, objectStack); pair.value, objectStack);
} else { } else {
GML3.prototype.writeGeometryElement(value, GML3.prototype.writeGeometryElement(value,

View File

@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_array_ from '../array.js'; import _ol_array_ from '../array.js';
import _ol_format_GML2_ from '../format/GML2.js'; import GML2 from '../format/GML2.js';
import _ol_format_XMLFeature_ from '../format/XMLFeature.js'; import _ol_format_XMLFeature_ from '../format/XMLFeature.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_xml_ from '../xml.js'; import _ol_xml_ from '../xml.js';
@@ -33,7 +33,7 @@ var _ol_format_WMSGetFeatureInfo_ = function(opt_options) {
* @private * @private
* @type {ol.format.GML2} * @type {ol.format.GML2}
*/ */
this.gmlFormat_ = new _ol_format_GML2_(); this.gmlFormat_ = new GML2();
/** /**

View File

@@ -1,6 +1,6 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_format_GML_ from '../../../../src/ol/format/GML.js'; import _ol_format_GML_ from '../../../../src/ol/format/GML.js';
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js'; import GML2 from '../../../../src/ol/format/GML2.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
import LinearRing from '../../../../src/ol/geom/LinearRing.js'; import LinearRing from '../../../../src/ol/geom/LinearRing.js';
import MultiLineString from '../../../../src/ol/geom/MultiLineString.js'; import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
@@ -23,7 +23,7 @@ describe('ol.format.GML2', function() {
var format; var format;
beforeEach(function() { beforeEach(function() {
format = new _ol_format_GML2_({srsName: 'CRS:84'}); format = new GML2({srsName: 'CRS:84'});
}); });
describe('#readFeatures', function() { describe('#readFeatures', function() {
@@ -32,7 +32,7 @@ describe('ol.format.GML2', function() {
var url = 'spec/ol/format/gml/osm-wfs-10.xml'; var url = 'spec/ol/format/gml/osm-wfs-10.xml';
afterLoadText(url, function(xml) { afterLoadText(url, function(xml) {
try { try {
features = new _ol_format_GML2_().readFeatures(xml); features = new GML2().readFeatures(xml);
} catch (e) { } catch (e) {
done(e); done(e);
} }

View File

@@ -1,5 +1,5 @@
import _ol_Feature_ from '../../../../src/ol/Feature.js'; import _ol_Feature_ from '../../../../src/ol/Feature.js';
import _ol_format_GML2_ from '../../../../src/ol/format/GML2.js'; import GML2 from '../../../../src/ol/format/GML2.js';
import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js'; import _ol_format_WFS_ from '../../../../src/ol/format/WFS.js';
import _ol_format_filter_ from '../../../../src/ol/format/filter.js'; import _ol_format_filter_ from '../../../../src/ol/format/filter.js';
import LineString from '../../../../src/ol/geom/LineString.js'; import LineString from '../../../../src/ol/geom/LineString.js';
@@ -88,7 +88,7 @@ describe('ol.format.WFS', function() {
var config = { var config = {
'featureNS': 'http://mapserver.gis.umn.edu/mapserver', 'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
'featureType': 'polygon', 'featureType': 'polygon',
'gmlFormat': new _ol_format_GML2_() 'gmlFormat': new GML2()
}; };
before(function(done) { before(function(done) {