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