named exports from ol/xml
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
import {nullFunction} from './index.js';
|
||||
import FormatType from './format/FormatType.js';
|
||||
import _ol_xml_ from './xml.js';
|
||||
import {parse} from './xml.js';
|
||||
|
||||
|
||||
/**
|
||||
@@ -48,7 +48,7 @@ export function loadFeaturesXhr(url, format, success, failure) {
|
||||
} else if (type == FormatType.XML) {
|
||||
source = xhr.responseXML;
|
||||
if (!source) {
|
||||
source = _ol_xml_.parse(xhr.responseText);
|
||||
source = parse(xhr.responseText);
|
||||
}
|
||||
} else if (type == FormatType.ARRAY_BUFFER) {
|
||||
source = /** @type {ArrayBuffer} */ (xhr.response);
|
||||
|
||||
@@ -9,7 +9,9 @@ import XSD from '../format/XSD.js';
|
||||
import Geometry from '../geom/Geometry.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection, transformExtent} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {createElementNS, getAllTextContent, makeArrayPusher, makeChildAppender,
|
||||
makeReplacer, makeSimpleNodeFactory, OBJECT_PROPERTY_NODE_FACTORY, pushParseAndPop, pushSerializeAndPop} from '../xml.js';
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -29,7 +31,7 @@ const GML2 = function(opt_options) {
|
||||
|
||||
this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][
|
||||
'featureMember'] =
|
||||
_ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
|
||||
makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
@@ -58,7 +60,7 @@ GML2.schemaLocation_ = GMLBase.GMLNS +
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
const context = /** @type {ol.XmlNodeStackItem} */ (objectStack[0]);
|
||||
const containerSrs = context['srsName'];
|
||||
let axisOrientation = 'enu';
|
||||
@@ -94,7 +96,7 @@ GML2.prototype.readFlatCoordinates_ = function(node, objectStack) {
|
||||
*/
|
||||
GML2.prototype.readBox_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>} */
|
||||
const flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
const flatCoordinates = pushParseAndPop([null],
|
||||
this.BOX_PARSERS_, node, objectStack, this);
|
||||
return createOrUpdate(flatCoordinates[1][0],
|
||||
flatCoordinates[1][1], flatCoordinates[1][3],
|
||||
@@ -109,7 +111,7 @@ GML2.prototype.readBox_ = function(node, objectStack) {
|
||||
*/
|
||||
GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
const flatLinearRing = pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -126,7 +128,7 @@ GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
const flatLinearRing = pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -143,7 +145,7 @@ GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML2.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'coordinates': _ol_xml_.makeReplacer(
|
||||
'coordinates': makeReplacer(
|
||||
GML2.prototype.readFlatCoordinates_)
|
||||
}
|
||||
};
|
||||
@@ -169,7 +171,7 @@ GML2.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
|
||||
*/
|
||||
GML2.prototype.BOX_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'coordinates': _ol_xml_.makeArrayPusher(
|
||||
'coordinates': makeArrayPusher(
|
||||
GML2.prototype.readFlatCoordinates_)
|
||||
}
|
||||
};
|
||||
@@ -182,19 +184,19 @@ GML2.prototype.BOX_PARSERS_ = {
|
||||
*/
|
||||
GML2.prototype.GEOMETRY_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Point': _ol_xml_.makeReplacer(GMLBase.prototype.readPoint),
|
||||
'MultiPoint': _ol_xml_.makeReplacer(
|
||||
'Point': makeReplacer(GMLBase.prototype.readPoint),
|
||||
'MultiPoint': makeReplacer(
|
||||
GMLBase.prototype.readMultiPoint),
|
||||
'LineString': _ol_xml_.makeReplacer(
|
||||
'LineString': makeReplacer(
|
||||
GMLBase.prototype.readLineString),
|
||||
'MultiLineString': _ol_xml_.makeReplacer(
|
||||
'MultiLineString': makeReplacer(
|
||||
GMLBase.prototype.readMultiLineString),
|
||||
'LinearRing': _ol_xml_.makeReplacer(
|
||||
'LinearRing': makeReplacer(
|
||||
GMLBase.prototype.readLinearRing),
|
||||
'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon),
|
||||
'MultiPolygon': _ol_xml_.makeReplacer(
|
||||
'Polygon': makeReplacer(GMLBase.prototype.readPolygon),
|
||||
'MultiPolygon': makeReplacer(
|
||||
GMLBase.prototype.readMultiPolygon),
|
||||
'Box': _ol_xml_.makeReplacer(GML2.prototype.readBox_)
|
||||
'Box': makeReplacer(GML2.prototype.readBox_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -225,7 +227,7 @@ GML2.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
|
||||
} else {
|
||||
nodeName = 'Envelope';
|
||||
}
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
return createElementNS('http://www.opengis.net/gml',
|
||||
nodeName);
|
||||
};
|
||||
|
||||
@@ -257,12 +259,12 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
values.push(value);
|
||||
if (key == geometryName || value instanceof Geometry) {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
this.writeGeometryElement, this);
|
||||
}
|
||||
} else {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
XSD.writeStringTextNode);
|
||||
}
|
||||
}
|
||||
@@ -270,9 +272,9 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
}
|
||||
const item = assign({}, context);
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), context.serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
|
||||
makeSimpleNodeFactory(undefined, featureNS),
|
||||
values,
|
||||
objectStack, keys);
|
||||
};
|
||||
@@ -298,7 +300,7 @@ GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
} else {
|
||||
value = transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
|
||||
}
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), GML2.GEOMETRY_SERIALIZERS_,
|
||||
this.GEOMETRY_NODE_FACTORY_, [value],
|
||||
objectStack, undefined, this);
|
||||
@@ -323,7 +325,7 @@ GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
node.appendChild(coordinates);
|
||||
this.writeCoordinates_(coordinates, geometry, objectStack);
|
||||
} else if (node.nodeName === 'Curve') {
|
||||
const segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
|
||||
const segments = createElementNS(node.namespaceURI, 'segments');
|
||||
node.appendChild(segments);
|
||||
this.writeCurveSegments_(segments,
|
||||
geometry, objectStack);
|
||||
@@ -337,7 +339,7 @@ GML2.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML2.prototype.createCoordinatesNode_ = function(namespaceURI) {
|
||||
const coordinates = _ol_xml_.createElementNS(namespaceURI, 'coordinates');
|
||||
const coordinates = createElementNS(namespaceURI, 'coordinates');
|
||||
coordinates.setAttribute('decimal', '.');
|
||||
coordinates.setAttribute('cs', ',');
|
||||
coordinates.setAttribute('ts', ' ');
|
||||
@@ -376,7 +378,7 @@ GML2.prototype.writeCoordinates_ = function(node, value, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML2.prototype.writeCurveSegments_ = function(node, line, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI,
|
||||
const child = createElementNS(node.namespaceURI,
|
||||
'LineStringSegment');
|
||||
node.appendChild(child);
|
||||
this.writeCurveOrLineString_(child, line, objectStack);
|
||||
@@ -398,13 +400,13 @@ GML2.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
}
|
||||
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
||||
const rings = geometry.getLinearRings();
|
||||
_ol_xml_.pushSerializeAndPop(
|
||||
pushSerializeAndPop(
|
||||
{node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML2.RING_SERIALIZERS_,
|
||||
this.RING_NODE_FACTORY_,
|
||||
rings, objectStack, undefined, this);
|
||||
} else if (node.nodeName === 'Surface') {
|
||||
const patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
|
||||
const patches = createElementNS(node.namespaceURI, 'patches');
|
||||
node.appendChild(patches);
|
||||
this.writeSurfacePatches_(
|
||||
patches, geometry, objectStack);
|
||||
@@ -426,7 +428,7 @@ GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
if (exteriorWritten === undefined) {
|
||||
context['exteriorWritten'] = true;
|
||||
}
|
||||
return _ol_xml_.createElementNS(parentNode.namespaceURI,
|
||||
return createElementNS(parentNode.namespaceURI,
|
||||
exteriorWritten !== undefined ? 'innerBoundaryIs' : 'outerBoundaryIs');
|
||||
};
|
||||
|
||||
@@ -438,7 +440,7 @@ GML2.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
* @private
|
||||
*/
|
||||
GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
const child = createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
node.appendChild(child);
|
||||
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
|
||||
};
|
||||
@@ -451,7 +453,7 @@ GML2.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML2.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
const linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
|
||||
const linearRing = createElementNS(node.namespaceURI, 'LinearRing');
|
||||
node.appendChild(linearRing);
|
||||
this.writeLinearRing_(linearRing, ring, objectStack);
|
||||
};
|
||||
@@ -497,7 +499,7 @@ GML2.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const lines = geometry.getLineStrings();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||
GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||
objectStack, undefined, this);
|
||||
@@ -540,9 +542,9 @@ GML2.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const points = geometry.getPoints();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML2.POINTMEMBER_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
|
||||
makeSimpleNodeFactory('pointMember'), points,
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
@@ -554,7 +556,7 @@ GML2.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
* @private
|
||||
*/
|
||||
GML2.prototype.writePointMember_ = function(node, point, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
|
||||
const child = createElementNS(node.namespaceURI, 'Point');
|
||||
node.appendChild(child);
|
||||
this.writePoint_(child, point, objectStack);
|
||||
};
|
||||
@@ -608,7 +610,7 @@ GML2.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStac
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const polygons = geometry.getPolygons();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||
GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||
objectStack, undefined, this);
|
||||
@@ -645,9 +647,9 @@ GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
}
|
||||
const keys = ['lowerCorner', 'upperCorner'];
|
||||
const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
({node: node}), GML2.ENVELOPE_SERIALIZERS_,
|
||||
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values,
|
||||
objectStack, keys, this);
|
||||
};
|
||||
@@ -660,28 +662,28 @@ GML2.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
*/
|
||||
GML2.GEOMETRY_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Curve': _ol_xml_.makeChildAppender(
|
||||
'Curve': makeChildAppender(
|
||||
GML2.prototype.writeCurveOrLineString_),
|
||||
'MultiCurve': _ol_xml_.makeChildAppender(
|
||||
'MultiCurve': makeChildAppender(
|
||||
GML2.prototype.writeMultiCurveOrLineString_),
|
||||
'Point': _ol_xml_.makeChildAppender(GML2.prototype.writePoint_),
|
||||
'MultiPoint': _ol_xml_.makeChildAppender(
|
||||
'Point': makeChildAppender(GML2.prototype.writePoint_),
|
||||
'MultiPoint': makeChildAppender(
|
||||
GML2.prototype.writeMultiPoint_),
|
||||
'LineString': _ol_xml_.makeChildAppender(
|
||||
'LineString': makeChildAppender(
|
||||
GML2.prototype.writeCurveOrLineString_),
|
||||
'MultiLineString': _ol_xml_.makeChildAppender(
|
||||
'MultiLineString': makeChildAppender(
|
||||
GML2.prototype.writeMultiCurveOrLineString_),
|
||||
'LinearRing': _ol_xml_.makeChildAppender(
|
||||
'LinearRing': makeChildAppender(
|
||||
GML2.prototype.writeLinearRing_),
|
||||
'Polygon': _ol_xml_.makeChildAppender(
|
||||
'Polygon': makeChildAppender(
|
||||
GML2.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiPolygon': _ol_xml_.makeChildAppender(
|
||||
'MultiPolygon': makeChildAppender(
|
||||
GML2.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Surface': _ol_xml_.makeChildAppender(
|
||||
'Surface': makeChildAppender(
|
||||
GML2.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiSurface': _ol_xml_.makeChildAppender(
|
||||
'MultiSurface': makeChildAppender(
|
||||
GML2.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Envelope': _ol_xml_.makeChildAppender(
|
||||
'Envelope': makeChildAppender(
|
||||
GML2.prototype.writeEnvelope)
|
||||
}
|
||||
};
|
||||
@@ -693,8 +695,8 @@ GML2.GEOMETRY_SERIALIZERS_ = {
|
||||
*/
|
||||
GML2.RING_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'outerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_),
|
||||
'innerBoundaryIs': _ol_xml_.makeChildAppender(GML2.prototype.writeRing_)
|
||||
'outerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_),
|
||||
'innerBoundaryIs': makeChildAppender(GML2.prototype.writeRing_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -705,7 +707,7 @@ GML2.RING_SERIALIZERS_ = {
|
||||
*/
|
||||
GML2.POINTMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'pointMember': _ol_xml_.makeChildAppender(
|
||||
'pointMember': makeChildAppender(
|
||||
GML2.prototype.writePointMember_)
|
||||
}
|
||||
};
|
||||
@@ -717,9 +719,9 @@ GML2.POINTMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lineStringMember': _ol_xml_.makeChildAppender(
|
||||
'lineStringMember': makeChildAppender(
|
||||
GML2.prototype.writeLineStringOrCurveMember_),
|
||||
'curveMember': _ol_xml_.makeChildAppender(
|
||||
'curveMember': makeChildAppender(
|
||||
GML2.prototype.writeLineStringOrCurveMember_)
|
||||
}
|
||||
};
|
||||
@@ -735,7 +737,7 @@ GML2.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML2.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
return createElementNS('http://www.opengis.net/gml',
|
||||
GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
|
||||
};
|
||||
|
||||
@@ -759,9 +761,9 @@ GML2.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
|
||||
*/
|
||||
GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'surfaceMember': _ol_xml_.makeChildAppender(
|
||||
'surfaceMember': makeChildAppender(
|
||||
GML2.prototype.writeSurfaceOrPolygonMember_),
|
||||
'polygonMember': _ol_xml_.makeChildAppender(
|
||||
'polygonMember': makeChildAppender(
|
||||
GML2.prototype.writeSurfaceOrPolygonMember_)
|
||||
}
|
||||
};
|
||||
@@ -773,8 +775,8 @@ GML2.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML2.ENVELOPE_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
|
||||
'lowerCorner': makeChildAppender(XSD.writeStringTextNode),
|
||||
'upperCorner': makeChildAppender(XSD.writeStringTextNode)
|
||||
}
|
||||
};
|
||||
export default GML2;
|
||||
|
||||
@@ -15,7 +15,9 @@ import MultiPolygon from '../geom/MultiPolygon.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection, transformExtent} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {createElementNS, getAllTextContent, makeArrayPusher, makeChildAppender,
|
||||
makeReplacer, makeSimpleNodeFactory, OBJECT_PROPERTY_NODE_FACTORY, parseNode,
|
||||
pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -97,7 +99,7 @@ GML3.schemaLocation_ = GMLBase.GMLNS +
|
||||
*/
|
||||
GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.LineString>} */
|
||||
const lineStrings = _ol_xml_.pushParseAndPop([],
|
||||
const lineStrings = pushParseAndPop([],
|
||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
const multiLineString = new MultiLineString(null);
|
||||
@@ -117,7 +119,7 @@ GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.Polygon>} */
|
||||
const polygons = _ol_xml_.pushParseAndPop([],
|
||||
const polygons = pushParseAndPop([],
|
||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
const multiPolygon = new MultiPolygon(null);
|
||||
@@ -135,7 +137,7 @@ GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.curveMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
|
||||
parseNode(this.CURVEMEMBER_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -145,7 +147,7 @@ GML3.prototype.curveMemberParser_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.SURFACEMEMBER_PARSERS_,
|
||||
parseNode(this.SURFACEMEMBER_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -157,7 +159,7 @@ GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
|
||||
* @return {Array.<(Array.<number>)>|undefined} flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readPatch_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
return pushParseAndPop([null],
|
||||
this.PATCHES_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -169,7 +171,7 @@ GML3.prototype.readPatch_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readSegment_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
return pushParseAndPop([null],
|
||||
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -181,7 +183,7 @@ GML3.prototype.readSegment_ = function(node, objectStack) {
|
||||
* @return {Array.<(Array.<number>)>|undefined} flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
return pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -193,7 +195,7 @@ GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
return pushParseAndPop([null],
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
@@ -206,7 +208,7 @@ GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.interiorParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
const flatLinearRing = pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -223,7 +225,7 @@ GML3.prototype.interiorParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
const flatLinearRing = pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
@@ -241,7 +243,7 @@ GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
const flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
const flatLinearRings = pushParseAndPop([null],
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
const polygon = new Polygon(null);
|
||||
@@ -269,7 +271,7 @@ GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>} */
|
||||
const flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
const flatCoordinates = pushParseAndPop([null],
|
||||
this.CURVE_PARSERS_, node, objectStack, this);
|
||||
if (flatCoordinates) {
|
||||
const lineString = new LineString(null);
|
||||
@@ -289,7 +291,7 @@ GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>} */
|
||||
const flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
const flatCoordinates = pushParseAndPop([null],
|
||||
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
||||
return createOrUpdate(flatCoordinates[1][0],
|
||||
flatCoordinates[1][1], flatCoordinates[2][0],
|
||||
@@ -304,7 +306,7 @@ GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
let s = _ol_xml_.getAllTextContent(node, false);
|
||||
let s = getAllTextContent(node, false);
|
||||
const re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
|
||||
/** @type {Array.<number>} */
|
||||
const flatCoordinates = [];
|
||||
@@ -350,7 +352,7 @@ GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
const s = getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
const context = objectStack[0];
|
||||
const containerSrs = context['srsName'];
|
||||
const contextDimension = context['srsDimension'];
|
||||
@@ -397,8 +399,8 @@ GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.GEOMETRY_FLAT_COORDINATES_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'pos': _ol_xml_.makeReplacer(GML3.prototype.readFlatPos_),
|
||||
'posList': _ol_xml_.makeReplacer(GML3.prototype.readFlatPosList_)
|
||||
'pos': makeReplacer(GML3.prototype.readFlatPos_),
|
||||
'posList': makeReplacer(GML3.prototype.readFlatPosList_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -423,25 +425,25 @@ GML3.prototype.FLAT_LINEAR_RINGS_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.GEOMETRY_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Point': _ol_xml_.makeReplacer(GMLBase.prototype.readPoint),
|
||||
'MultiPoint': _ol_xml_.makeReplacer(
|
||||
'Point': makeReplacer(GMLBase.prototype.readPoint),
|
||||
'MultiPoint': makeReplacer(
|
||||
GMLBase.prototype.readMultiPoint),
|
||||
'LineString': _ol_xml_.makeReplacer(
|
||||
'LineString': makeReplacer(
|
||||
GMLBase.prototype.readLineString),
|
||||
'MultiLineString': _ol_xml_.makeReplacer(
|
||||
'MultiLineString': makeReplacer(
|
||||
GMLBase.prototype.readMultiLineString),
|
||||
'LinearRing': _ol_xml_.makeReplacer(
|
||||
'LinearRing': makeReplacer(
|
||||
GMLBase.prototype.readLinearRing),
|
||||
'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon),
|
||||
'MultiPolygon': _ol_xml_.makeReplacer(
|
||||
'Polygon': makeReplacer(GMLBase.prototype.readPolygon),
|
||||
'MultiPolygon': makeReplacer(
|
||||
GMLBase.prototype.readMultiPolygon),
|
||||
'Surface': _ol_xml_.makeReplacer(GML3.prototype.readSurface_),
|
||||
'MultiSurface': _ol_xml_.makeReplacer(
|
||||
'Surface': makeReplacer(GML3.prototype.readSurface_),
|
||||
'MultiSurface': makeReplacer(
|
||||
GML3.prototype.readMultiSurface_),
|
||||
'Curve': _ol_xml_.makeReplacer(GML3.prototype.readCurve_),
|
||||
'MultiCurve': _ol_xml_.makeReplacer(
|
||||
'Curve': makeReplacer(GML3.prototype.readCurve_),
|
||||
'MultiCurve': makeReplacer(
|
||||
GML3.prototype.readMultiCurve_),
|
||||
'Envelope': _ol_xml_.makeReplacer(GML3.prototype.readEnvelope_)
|
||||
'Envelope': makeReplacer(GML3.prototype.readEnvelope_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -453,9 +455,9 @@ GML3.prototype.GEOMETRY_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.MULTICURVE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'curveMember': _ol_xml_.makeArrayPusher(
|
||||
'curveMember': makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_),
|
||||
'curveMembers': _ol_xml_.makeArrayPusher(
|
||||
'curveMembers': makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_)
|
||||
}
|
||||
};
|
||||
@@ -468,9 +470,9 @@ GML3.prototype.MULTICURVE_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.MULTISURFACE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'surfaceMember': _ol_xml_.makeArrayPusher(
|
||||
'surfaceMember': makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_),
|
||||
'surfaceMembers': _ol_xml_.makeArrayPusher(
|
||||
'surfaceMembers': makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_)
|
||||
}
|
||||
};
|
||||
@@ -483,9 +485,9 @@ GML3.prototype.MULTISURFACE_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.CURVEMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LineString': _ol_xml_.makeArrayPusher(
|
||||
'LineString': makeArrayPusher(
|
||||
GMLBase.prototype.readLineString),
|
||||
'Curve': _ol_xml_.makeArrayPusher(GML3.prototype.readCurve_)
|
||||
'Curve': makeArrayPusher(GML3.prototype.readCurve_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -497,8 +499,8 @@ GML3.prototype.CURVEMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.SURFACEMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Polygon': _ol_xml_.makeArrayPusher(GMLBase.prototype.readPolygon),
|
||||
'Surface': _ol_xml_.makeArrayPusher(GML3.prototype.readSurface_)
|
||||
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon),
|
||||
'Surface': makeArrayPusher(GML3.prototype.readSurface_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -510,7 +512,7 @@ GML3.prototype.SURFACEMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.SURFACE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'patches': _ol_xml_.makeReplacer(GML3.prototype.readPatch_)
|
||||
'patches': makeReplacer(GML3.prototype.readPatch_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -522,7 +524,7 @@ GML3.prototype.SURFACE_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.CURVE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'segments': _ol_xml_.makeReplacer(GML3.prototype.readSegment_)
|
||||
'segments': makeReplacer(GML3.prototype.readSegment_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -534,9 +536,9 @@ GML3.prototype.CURVE_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.ENVELOPE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lowerCorner': _ol_xml_.makeArrayPusher(
|
||||
'lowerCorner': makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_),
|
||||
'upperCorner': _ol_xml_.makeArrayPusher(
|
||||
'upperCorner': makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_)
|
||||
}
|
||||
};
|
||||
@@ -549,7 +551,7 @@ GML3.prototype.ENVELOPE_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.PATCHES_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'PolygonPatch': _ol_xml_.makeReplacer(
|
||||
'PolygonPatch': makeReplacer(
|
||||
GML3.prototype.readPolygonPatch_)
|
||||
}
|
||||
};
|
||||
@@ -562,7 +564,7 @@ GML3.prototype.PATCHES_PARSERS_ = {
|
||||
*/
|
||||
GML3.prototype.SEGMENTS_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LineStringSegment': _ol_xml_.makeReplacer(
|
||||
'LineStringSegment': makeReplacer(
|
||||
GML3.prototype.readLineStringSegment_)
|
||||
}
|
||||
};
|
||||
@@ -663,7 +665,7 @@ GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const pos = _ol_xml_.createElementNS(node.namespaceURI, 'pos');
|
||||
const pos = createElementNS(node.namespaceURI, 'pos');
|
||||
node.appendChild(pos);
|
||||
this.writePos_(pos, geometry, objectStack);
|
||||
};
|
||||
@@ -675,8 +677,8 @@ GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
|
||||
*/
|
||||
GML3.ENVELOPE_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lowerCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'upperCorner': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
|
||||
'lowerCorner': makeChildAppender(XSD.writeStringTextNode),
|
||||
'upperCorner': makeChildAppender(XSD.writeStringTextNode)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -694,9 +696,9 @@ GML3.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
}
|
||||
const keys = ['lowerCorner', 'upperCorner'];
|
||||
const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
({node: node}), GML3.ENVELOPE_SERIALIZERS_,
|
||||
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values,
|
||||
objectStack, keys, this);
|
||||
};
|
||||
@@ -714,7 +716,7 @@ GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
const posList = createElementNS(node.namespaceURI, 'posList');
|
||||
node.appendChild(posList);
|
||||
this.writePosList_(posList, geometry, objectStack);
|
||||
};
|
||||
@@ -734,7 +736,7 @@ GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
if (exteriorWritten === undefined) {
|
||||
context['exteriorWritten'] = true;
|
||||
}
|
||||
return _ol_xml_.createElementNS(parentNode.namespaceURI,
|
||||
return createElementNS(parentNode.namespaceURI,
|
||||
exteriorWritten !== undefined ? 'interior' : 'exterior');
|
||||
};
|
||||
|
||||
@@ -754,13 +756,13 @@ GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
}
|
||||
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
||||
const rings = geometry.getLinearRings();
|
||||
_ol_xml_.pushSerializeAndPop(
|
||||
pushSerializeAndPop(
|
||||
{node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML3.RING_SERIALIZERS_,
|
||||
this.RING_NODE_FACTORY_,
|
||||
rings, objectStack, undefined, this);
|
||||
} else if (node.nodeName === 'Surface') {
|
||||
const patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
|
||||
const patches = createElementNS(node.namespaceURI, 'patches');
|
||||
node.appendChild(patches);
|
||||
this.writeSurfacePatches_(
|
||||
patches, geometry, objectStack);
|
||||
@@ -782,11 +784,11 @@ GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
}
|
||||
if (node.nodeName === 'LineString' ||
|
||||
node.nodeName === 'LineStringSegment') {
|
||||
const posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
const posList = createElementNS(node.namespaceURI, 'posList');
|
||||
node.appendChild(posList);
|
||||
this.writePosList_(posList, geometry, objectStack);
|
||||
} else if (node.nodeName === 'Curve') {
|
||||
const segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
|
||||
const segments = createElementNS(node.namespaceURI, 'segments');
|
||||
node.appendChild(segments);
|
||||
this.writeCurveSegments_(segments,
|
||||
geometry, objectStack);
|
||||
@@ -809,7 +811,7 @@ GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStac
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const polygons = geometry.getPolygons();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||
GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||
objectStack, undefined, this);
|
||||
@@ -831,9 +833,9 @@ GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const points = geometry.getPoints();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML3.POINTMEMBER_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
|
||||
makeSimpleNodeFactory('pointMember'), points,
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
@@ -853,7 +855,7 @@ GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
const lines = geometry.getLineStrings();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||
pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||
GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||
objectStack, undefined, this);
|
||||
@@ -867,7 +869,7 @@ GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
const linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
|
||||
const linearRing = createElementNS(node.namespaceURI, 'LinearRing');
|
||||
node.appendChild(linearRing);
|
||||
this.writeLinearRing_(linearRing, ring, objectStack);
|
||||
};
|
||||
@@ -896,7 +898,7 @@ GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStac
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writePointMember_ = function(node, point, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
|
||||
const child = createElementNS(node.namespaceURI, 'Point');
|
||||
node.appendChild(child);
|
||||
this.writePoint_(child, point, objectStack);
|
||||
};
|
||||
@@ -924,7 +926,7 @@ GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack)
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
const child = createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
node.appendChild(child);
|
||||
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
|
||||
};
|
||||
@@ -937,7 +939,7 @@ GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI,
|
||||
const child = createElementNS(node.namespaceURI,
|
||||
'LineStringSegment');
|
||||
node.appendChild(child);
|
||||
this.writeCurveOrLineString_(child, line, objectStack);
|
||||
@@ -964,7 +966,7 @@ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
} else {
|
||||
value = transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
|
||||
}
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), GML3.GEOMETRY_SERIALIZERS_,
|
||||
this.GEOMETRY_NODE_FACTORY_, [value],
|
||||
objectStack, undefined, this);
|
||||
@@ -998,12 +1000,12 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
values.push(value);
|
||||
if (key == geometryName || value instanceof Geometry) {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
this.writeGeometryElement, this);
|
||||
}
|
||||
} else {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
context.serializers[featureNS][key] = makeChildAppender(
|
||||
XSD.writeStringTextNode);
|
||||
}
|
||||
}
|
||||
@@ -1011,9 +1013,9 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
}
|
||||
const item = assign({}, context);
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), context.serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
|
||||
makeSimpleNodeFactory(undefined, featureNS),
|
||||
values,
|
||||
objectStack, keys);
|
||||
};
|
||||
@@ -1031,14 +1033,14 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
|
||||
const featureNS = context['featureNS'];
|
||||
const serializers = {};
|
||||
serializers[featureNS] = {};
|
||||
serializers[featureNS][featureType] = _ol_xml_.makeChildAppender(
|
||||
serializers[featureNS][featureType] = makeChildAppender(
|
||||
this.writeFeatureElement, this);
|
||||
const item = assign({}, context);
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item),
|
||||
serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(featureType, featureNS), features,
|
||||
makeSimpleNodeFactory(featureType, featureNS), features,
|
||||
objectStack);
|
||||
};
|
||||
|
||||
@@ -1049,9 +1051,9 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
|
||||
*/
|
||||
GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'surfaceMember': _ol_xml_.makeChildAppender(
|
||||
'surfaceMember': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_),
|
||||
'polygonMember': _ol_xml_.makeChildAppender(
|
||||
'polygonMember': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_)
|
||||
}
|
||||
};
|
||||
@@ -1063,7 +1065,7 @@ GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML3.POINTMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'pointMember': _ol_xml_.makeChildAppender(
|
||||
'pointMember': makeChildAppender(
|
||||
GML3.prototype.writePointMember_)
|
||||
}
|
||||
};
|
||||
@@ -1075,9 +1077,9 @@ GML3.POINTMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lineStringMember': _ol_xml_.makeChildAppender(
|
||||
'lineStringMember': makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_),
|
||||
'curveMember': _ol_xml_.makeChildAppender(
|
||||
'curveMember': makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_)
|
||||
}
|
||||
};
|
||||
@@ -1089,8 +1091,8 @@ GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
*/
|
||||
GML3.RING_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'exterior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_),
|
||||
'interior': _ol_xml_.makeChildAppender(GML3.prototype.writeRing_)
|
||||
'exterior': makeChildAppender(GML3.prototype.writeRing_),
|
||||
'interior': makeChildAppender(GML3.prototype.writeRing_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1101,28 +1103,28 @@ GML3.RING_SERIALIZERS_ = {
|
||||
*/
|
||||
GML3.GEOMETRY_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Curve': _ol_xml_.makeChildAppender(
|
||||
'Curve': makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'MultiCurve': _ol_xml_.makeChildAppender(
|
||||
'MultiCurve': makeChildAppender(
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
'Point': _ol_xml_.makeChildAppender(GML3.prototype.writePoint_),
|
||||
'MultiPoint': _ol_xml_.makeChildAppender(
|
||||
'Point': makeChildAppender(GML3.prototype.writePoint_),
|
||||
'MultiPoint': makeChildAppender(
|
||||
GML3.prototype.writeMultiPoint_),
|
||||
'LineString': _ol_xml_.makeChildAppender(
|
||||
'LineString': makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'MultiLineString': _ol_xml_.makeChildAppender(
|
||||
'MultiLineString': makeChildAppender(
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
'LinearRing': _ol_xml_.makeChildAppender(
|
||||
'LinearRing': makeChildAppender(
|
||||
GML3.prototype.writeLinearRing_),
|
||||
'Polygon': _ol_xml_.makeChildAppender(
|
||||
'Polygon': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiPolygon': _ol_xml_.makeChildAppender(
|
||||
'MultiPolygon': makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Surface': _ol_xml_.makeChildAppender(
|
||||
'Surface': makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiSurface': _ol_xml_.makeChildAppender(
|
||||
'MultiSurface': makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Envelope': _ol_xml_.makeChildAppender(
|
||||
'Envelope': makeChildAppender(
|
||||
GML3.prototype.writeEnvelope)
|
||||
}
|
||||
};
|
||||
@@ -1151,7 +1153,7 @@ GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
|
||||
*/
|
||||
GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
return createElementNS('http://www.opengis.net/gml',
|
||||
GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
|
||||
};
|
||||
|
||||
@@ -1185,7 +1187,7 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
|
||||
} else {
|
||||
nodeName = 'Envelope';
|
||||
}
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
return createElementNS('http://www.opengis.net/gml',
|
||||
nodeName);
|
||||
};
|
||||
|
||||
@@ -1201,7 +1203,7 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
|
||||
*/
|
||||
GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
const geom = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'geom');
|
||||
const geom = createElementNS('http://www.opengis.net/gml', 'geom');
|
||||
const context = {node: geom, hasZ: this.hasZ, srsName: this.srsName,
|
||||
curve: this.curve_, surface: this.surface_,
|
||||
multiSurface: this.multiSurface_, multiCurve: this.multiCurve_};
|
||||
@@ -1236,9 +1238,9 @@ GML3.prototype.writeFeatures;
|
||||
*/
|
||||
GML3.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
const node = _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
const node = createElementNS('http://www.opengis.net/gml',
|
||||
'featureMembers');
|
||||
_ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', this.schemaLocation);
|
||||
const context = {
|
||||
srsName: this.srsName,
|
||||
|
||||
@@ -19,7 +19,7 @@ import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {getAllTextContent, getAttributeNS, makeArrayPusher, makeReplacer, parseNode, pushParseAndPop} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -69,9 +69,9 @@ const GMLBase = function(opt_options) {
|
||||
*/
|
||||
this.FEATURE_COLLECTION_PARSERS = {};
|
||||
this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS] = {
|
||||
'featureMember': _ol_xml_.makeReplacer(
|
||||
'featureMember': makeReplacer(
|
||||
GMLBase.prototype.readFeaturesInternal),
|
||||
'featureMembers': _ol_xml_.makeReplacer(
|
||||
'featureMembers': makeReplacer(
|
||||
GMLBase.prototype.readFeaturesInternal)
|
||||
};
|
||||
|
||||
@@ -113,11 +113,11 @@ GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
let features = null;
|
||||
if (localName == 'FeatureCollection') {
|
||||
if (node.namespaceURI === 'http://www.opengis.net/wfs') {
|
||||
features = _ol_xml_.pushParseAndPop([],
|
||||
features = pushParseAndPop([],
|
||||
this.FEATURE_COLLECTION_PARSERS, node,
|
||||
objectStack, this);
|
||||
} else {
|
||||
features = _ol_xml_.pushParseAndPop(null,
|
||||
features = pushParseAndPop(null,
|
||||
this.FEATURE_COLLECTION_PARSERS, node,
|
||||
objectStack, this);
|
||||
}
|
||||
@@ -174,16 +174,16 @@ GMLBase.prototype.readFeaturesInternal = function(node, objectStack) {
|
||||
if (featurePrefix === p) {
|
||||
parsers[featureTypes[i].split(':').pop()] =
|
||||
(localName == 'featureMembers') ?
|
||||
_ol_xml_.makeArrayPusher(this.readFeatureElement, this) :
|
||||
_ol_xml_.makeReplacer(this.readFeatureElement, this);
|
||||
makeArrayPusher(this.readFeatureElement, this) :
|
||||
makeReplacer(this.readFeatureElement, this);
|
||||
}
|
||||
}
|
||||
parsersNS[featureNS[p]] = parsers;
|
||||
}
|
||||
if (localName == 'featureMember') {
|
||||
features = _ol_xml_.pushParseAndPop(undefined, parsersNS, node, objectStack);
|
||||
features = pushParseAndPop(undefined, parsersNS, node, objectStack);
|
||||
} else {
|
||||
features = _ol_xml_.pushParseAndPop([], parsersNS, node, objectStack);
|
||||
features = pushParseAndPop([], parsersNS, node, objectStack);
|
||||
}
|
||||
}
|
||||
if (features === null) {
|
||||
@@ -203,7 +203,7 @@ GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||
context['srsDimension'] = node.firstElementChild.getAttribute('srsDimension');
|
||||
/** @type {ol.geom.Geometry} */
|
||||
const geometry = _ol_xml_.pushParseAndPop(null,
|
||||
const geometry = pushParseAndPop(null,
|
||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||
if (geometry) {
|
||||
return (
|
||||
@@ -223,7 +223,7 @@ GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
||||
GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
let n;
|
||||
const fid = node.getAttribute('fid') ||
|
||||
_ol_xml_.getAttributeNS(node, GMLBase.GMLNS, 'id');
|
||||
getAttributeNS(node, GMLBase.GMLNS, 'id');
|
||||
const values = {};
|
||||
let geometryName;
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
@@ -234,7 +234,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) {
|
||||
if (n.childNodes.length === 0 ||
|
||||
(n.childNodes.length === 1 &&
|
||||
(n.firstChild.nodeType === 3 || n.firstChild.nodeType === 4))) {
|
||||
let value = _ol_xml_.getAllTextContent(n, false);
|
||||
let value = getAllTextContent(n, false);
|
||||
if (GMLBase.ONLY_WHITESPACE_RE_.test(value)) {
|
||||
value = undefined;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ GMLBase.prototype.readPoint = function(node, objectStack) {
|
||||
*/
|
||||
GMLBase.prototype.readMultiPoint = function(node, objectStack) {
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
const coordinates = _ol_xml_.pushParseAndPop([],
|
||||
const coordinates = pushParseAndPop([],
|
||||
this.MULTIPOINT_PARSERS_, node, objectStack, this);
|
||||
if (coordinates) {
|
||||
return new MultiPoint(coordinates);
|
||||
@@ -298,7 +298,7 @@ GMLBase.prototype.readMultiPoint = function(node, objectStack) {
|
||||
*/
|
||||
GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.LineString>} */
|
||||
const lineStrings = _ol_xml_.pushParseAndPop([],
|
||||
const lineStrings = pushParseAndPop([],
|
||||
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
const multiLineString = new MultiLineString(null);
|
||||
@@ -317,7 +317,7 @@ GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
||||
*/
|
||||
GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.Polygon>} */
|
||||
const polygons = _ol_xml_.pushParseAndPop([],
|
||||
const polygons = pushParseAndPop([],
|
||||
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
const multiPolygon = new MultiPolygon(null);
|
||||
@@ -335,7 +335,7 @@ GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.POINTMEMBER_PARSERS_,
|
||||
parseNode(this.POINTMEMBER_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -346,7 +346,7 @@ GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.LINESTRINGMEMBER_PARSERS_,
|
||||
parseNode(this.LINESTRINGMEMBER_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
|
||||
@@ -357,7 +357,7 @@ GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.POLYGONMEMBER_PARSERS_, node,
|
||||
parseNode(this.POLYGONMEMBER_PARSERS_, node,
|
||||
objectStack, this);
|
||||
};
|
||||
|
||||
@@ -387,7 +387,7 @@ GMLBase.prototype.readLineString = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} LinearRing flat coordinates.
|
||||
*/
|
||||
GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
|
||||
const ring = _ol_xml_.pushParseAndPop(null,
|
||||
const ring = pushParseAndPop(null,
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||
objectStack, this);
|
||||
if (ring) {
|
||||
@@ -423,7 +423,7 @@ GMLBase.prototype.readLinearRing = function(node, objectStack) {
|
||||
*/
|
||||
GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
const flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
const flatLinearRings = pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
const polygon = new Polygon(null);
|
||||
@@ -450,7 +450,7 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
|
||||
* @return {Array.<number>} Flat coordinates.
|
||||
*/
|
||||
GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(null,
|
||||
return pushParseAndPop(null,
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||
objectStack, this);
|
||||
};
|
||||
@@ -463,9 +463,9 @@ GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||
*/
|
||||
GMLBase.prototype.MULTIPOINT_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'pointMember': _ol_xml_.makeArrayPusher(
|
||||
'pointMember': makeArrayPusher(
|
||||
GMLBase.prototype.pointMemberParser_),
|
||||
'pointMembers': _ol_xml_.makeArrayPusher(
|
||||
'pointMembers': makeArrayPusher(
|
||||
GMLBase.prototype.pointMemberParser_)
|
||||
}
|
||||
};
|
||||
@@ -478,9 +478,9 @@ GMLBase.prototype.MULTIPOINT_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lineStringMember': _ol_xml_.makeArrayPusher(
|
||||
'lineStringMember': makeArrayPusher(
|
||||
GMLBase.prototype.lineStringMemberParser_),
|
||||
'lineStringMembers': _ol_xml_.makeArrayPusher(
|
||||
'lineStringMembers': makeArrayPusher(
|
||||
GMLBase.prototype.lineStringMemberParser_)
|
||||
}
|
||||
};
|
||||
@@ -493,9 +493,9 @@ GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'polygonMember': _ol_xml_.makeArrayPusher(
|
||||
'polygonMember': makeArrayPusher(
|
||||
GMLBase.prototype.polygonMemberParser_),
|
||||
'polygonMembers': _ol_xml_.makeArrayPusher(
|
||||
'polygonMembers': makeArrayPusher(
|
||||
GMLBase.prototype.polygonMemberParser_)
|
||||
}
|
||||
};
|
||||
@@ -508,7 +508,7 @@ GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.POINTMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Point': _ol_xml_.makeArrayPusher(
|
||||
'Point': makeArrayPusher(
|
||||
GMLBase.prototype.readFlatCoordinatesFromNode_)
|
||||
}
|
||||
};
|
||||
@@ -521,7 +521,7 @@ GMLBase.prototype.POINTMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LineString': _ol_xml_.makeArrayPusher(
|
||||
'LineString': makeArrayPusher(
|
||||
GMLBase.prototype.readLineString)
|
||||
}
|
||||
};
|
||||
@@ -534,7 +534,7 @@ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Polygon': _ol_xml_.makeArrayPusher(
|
||||
'Polygon': makeArrayPusher(
|
||||
GMLBase.prototype.readPolygon)
|
||||
}
|
||||
};
|
||||
@@ -547,7 +547,7 @@ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
|
||||
*/
|
||||
GMLBase.prototype.RING_PARSERS = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LinearRing': _ol_xml_.makeReplacer(
|
||||
'LinearRing': makeReplacer(
|
||||
GMLBase.prototype.readFlatLinearRing_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,10 @@ import LineString from '../geom/LineString.js';
|
||||
import MultiLineString from '../geom/MultiLineString.js';
|
||||
import Point from '../geom/Point.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {createElementNS, makeArrayPusher, makeArraySerializer, makeChildAppender,
|
||||
makeObjectPropertySetter, makeSequence, makeSimpleNodeFactory, makeStructureNS,
|
||||
OBJECT_PROPERTY_NODE_FACTORY, parseNode, pushParseAndPop, pushSerializeAndPop,
|
||||
setAttributeNS} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -78,11 +81,11 @@ const FEATURE_READER = {
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const GPX_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const GPX_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'rte': _ol_xml_.makeArrayPusher(readRte),
|
||||
'trk': _ol_xml_.makeArrayPusher(readTrk),
|
||||
'wpt': _ol_xml_.makeArrayPusher(readWpt)
|
||||
'rte': makeArrayPusher(readRte),
|
||||
'trk': makeArrayPusher(readTrk),
|
||||
'wpt': makeArrayPusher(readWpt)
|
||||
});
|
||||
|
||||
|
||||
@@ -90,10 +93,10 @@ const GPX_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const LINK_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const LINK_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'text': _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkText'),
|
||||
'type': _ol_xml_.makeObjectPropertySetter(XSD.readString, 'linkType')
|
||||
'text': makeObjectPropertySetter(XSD.readString, 'linkText'),
|
||||
'type': makeObjectPropertySetter(XSD.readString, 'linkType')
|
||||
});
|
||||
|
||||
|
||||
@@ -101,16 +104,16 @@ const LINK_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const RTE_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const RTE_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'name': makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': makeObjectPropertySetter(XSD.readString),
|
||||
'desc': makeObjectPropertySetter(XSD.readString),
|
||||
'src': makeObjectPropertySetter(XSD.readString),
|
||||
'link': parseLink,
|
||||
'number': _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'number': makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'extensions': parseExtensions,
|
||||
'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'type': makeObjectPropertySetter(XSD.readString),
|
||||
'rtept': parseRtePt
|
||||
});
|
||||
|
||||
@@ -119,10 +122,10 @@ const RTE_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const RTEPT_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const RTEPT_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime)
|
||||
'ele': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': makeObjectPropertySetter(XSD.readDateTime)
|
||||
});
|
||||
|
||||
|
||||
@@ -130,15 +133,15 @@ const RTEPT_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const TRK_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const TRK_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'name': makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': makeObjectPropertySetter(XSD.readString),
|
||||
'desc': makeObjectPropertySetter(XSD.readString),
|
||||
'src': makeObjectPropertySetter(XSD.readString),
|
||||
'link': parseLink,
|
||||
'number': _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'number': makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'type': makeObjectPropertySetter(XSD.readString),
|
||||
'extensions': parseExtensions,
|
||||
'trkseg': parseTrkSeg
|
||||
});
|
||||
@@ -148,7 +151,7 @@ const TRK_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const TRKSEG_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const TRKSEG_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'trkpt': parseTrkPt
|
||||
});
|
||||
@@ -158,10 +161,10 @@ const TRKSEG_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const TRKPT_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const TRKPT_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime)
|
||||
'ele': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': makeObjectPropertySetter(XSD.readDateTime)
|
||||
});
|
||||
|
||||
|
||||
@@ -169,26 +172,26 @@ const TRKPT_PARSERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
*/
|
||||
const WPT_PARSERS = _ol_xml_.makeStructureNS(
|
||||
const WPT_PARSERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'ele': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': _ol_xml_.makeObjectPropertySetter(XSD.readDateTime),
|
||||
'magvar': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'geoidheight': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'desc': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'src': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'ele': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'time': makeObjectPropertySetter(XSD.readDateTime),
|
||||
'magvar': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'geoidheight': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'name': makeObjectPropertySetter(XSD.readString),
|
||||
'cmt': makeObjectPropertySetter(XSD.readString),
|
||||
'desc': makeObjectPropertySetter(XSD.readString),
|
||||
'src': makeObjectPropertySetter(XSD.readString),
|
||||
'link': parseLink,
|
||||
'sym': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'type': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'fix': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'sat': _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'hdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'vdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'pdop': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'ageofdgpsdata': _ol_xml_.makeObjectPropertySetter(XSD.readDecimal),
|
||||
'dgpsid': _ol_xml_.makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'sym': makeObjectPropertySetter(XSD.readString),
|
||||
'type': makeObjectPropertySetter(XSD.readString),
|
||||
'fix': makeObjectPropertySetter(XSD.readString),
|
||||
'sat': makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'hdop': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'vdop': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'pdop': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'ageofdgpsdata': makeObjectPropertySetter(XSD.readDecimal),
|
||||
'dgpsid': makeObjectPropertySetter(XSD.readNonNegativeInteger),
|
||||
'extensions': parseExtensions
|
||||
});
|
||||
|
||||
@@ -204,10 +207,10 @@ const LINK_SEQUENCE = ['text', 'type'];
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const LINK_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const LINK_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'text': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
|
||||
'text': makeChildAppender(XSD.writeStringTextNode),
|
||||
'type': makeChildAppender(XSD.writeStringTextNode)
|
||||
});
|
||||
|
||||
|
||||
@@ -215,7 +218,7 @@ const LINK_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Array.<string>>}
|
||||
*/
|
||||
const RTE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
const RTE_SEQUENCE = makeStructureNS(
|
||||
NAMESPACE_URIS, [
|
||||
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'rtept'
|
||||
]);
|
||||
@@ -225,16 +228,16 @@ const RTE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const RTE_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const RTE_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': _ol_xml_.makeChildAppender(writeLink),
|
||||
'number': _ol_xml_.makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'rtept': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(writeWptType))
|
||||
'name': makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': makeChildAppender(writeLink),
|
||||
'number': makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'type': makeChildAppender(XSD.writeStringTextNode),
|
||||
'rtept': makeArraySerializer(makeChildAppender(writeWptType))
|
||||
});
|
||||
|
||||
|
||||
@@ -242,7 +245,7 @@ const RTE_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Array.<string>>}
|
||||
*/
|
||||
const RTEPT_TYPE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
const RTEPT_TYPE_SEQUENCE = makeStructureNS(
|
||||
NAMESPACE_URIS, [
|
||||
'ele', 'time'
|
||||
]);
|
||||
@@ -252,7 +255,7 @@ const RTEPT_TYPE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Array.<string>>}
|
||||
*/
|
||||
const TRK_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
const TRK_SEQUENCE = makeStructureNS(
|
||||
NAMESPACE_URIS, [
|
||||
'name', 'cmt', 'desc', 'src', 'link', 'number', 'type', 'trkseg'
|
||||
]);
|
||||
@@ -262,16 +265,16 @@ const TRK_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const TRK_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const TRK_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': _ol_xml_.makeChildAppender(writeLink),
|
||||
'number': _ol_xml_.makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'trkseg': _ol_xml_.makeArraySerializer(_ol_xml_.makeChildAppender(writeTrkSeg))
|
||||
'name': makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': makeChildAppender(writeLink),
|
||||
'number': makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'type': makeChildAppender(XSD.writeStringTextNode),
|
||||
'trkseg': makeArraySerializer(makeChildAppender(writeTrkSeg))
|
||||
});
|
||||
|
||||
|
||||
@@ -279,16 +282,16 @@ const TRK_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {function(*, Array.<*>, string=): (Node|undefined)}
|
||||
*/
|
||||
const TRKSEG_NODE_FACTORY = _ol_xml_.makeSimpleNodeFactory('trkpt');
|
||||
const TRKSEG_NODE_FACTORY = makeSimpleNodeFactory('trkpt');
|
||||
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const TRKSEG_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const TRKSEG_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'trkpt': _ol_xml_.makeChildAppender(writeWptType)
|
||||
'trkpt': makeChildAppender(writeWptType)
|
||||
});
|
||||
|
||||
|
||||
@@ -296,7 +299,7 @@ const TRKSEG_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Array.<string>>}
|
||||
*/
|
||||
const WPT_TYPE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
const WPT_TYPE_SEQUENCE = makeStructureNS(
|
||||
NAMESPACE_URIS, [
|
||||
'ele', 'time', 'magvar', 'geoidheight', 'name', 'cmt', 'desc', 'src',
|
||||
'link', 'sym', 'type', 'fix', 'sat', 'hdop', 'vdop', 'pdop',
|
||||
@@ -308,26 +311,26 @@ const WPT_TYPE_SEQUENCE = _ol_xml_.makeStructureNS(
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const WPT_TYPE_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const WPT_TYPE_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'ele': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'time': _ol_xml_.makeChildAppender(XSD.writeDateTimeTextNode),
|
||||
'magvar': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'geoidheight': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'name': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': _ol_xml_.makeChildAppender(writeLink),
|
||||
'sym': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'type': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'fix': _ol_xml_.makeChildAppender(XSD.writeStringTextNode),
|
||||
'sat': _ol_xml_.makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'hdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'vdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'pdop': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'ageofdgpsdata': _ol_xml_.makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'dgpsid': _ol_xml_.makeChildAppender(XSD.writeNonNegativeIntegerTextNode)
|
||||
'ele': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'time': makeChildAppender(XSD.writeDateTimeTextNode),
|
||||
'magvar': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'geoidheight': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'name': makeChildAppender(XSD.writeStringTextNode),
|
||||
'cmt': makeChildAppender(XSD.writeStringTextNode),
|
||||
'desc': makeChildAppender(XSD.writeStringTextNode),
|
||||
'src': makeChildAppender(XSD.writeStringTextNode),
|
||||
'link': makeChildAppender(writeLink),
|
||||
'sym': makeChildAppender(XSD.writeStringTextNode),
|
||||
'type': makeChildAppender(XSD.writeStringTextNode),
|
||||
'fix': makeChildAppender(XSD.writeStringTextNode),
|
||||
'sat': makeChildAppender(XSD.writeNonNegativeIntegerTextNode),
|
||||
'hdop': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'vdop': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'pdop': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'ageofdgpsdata': makeChildAppender(XSD.writeDecimalTextNode),
|
||||
'dgpsid': makeChildAppender(XSD.writeNonNegativeIntegerTextNode)
|
||||
});
|
||||
|
||||
|
||||
@@ -354,7 +357,7 @@ function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) {
|
||||
const nodeName = GEOMETRY_TYPE_TO_NODENAME[geometry.getType()];
|
||||
if (nodeName) {
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
return _ol_xml_.createElementNS(parentNode.namespaceURI, nodeName);
|
||||
return createElementNS(parentNode.namespaceURI, nodeName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,11 +367,11 @@ function GPX_NODE_FACTORY(value, objectStack, opt_nodeName) {
|
||||
* @const
|
||||
* @type {Object.<string, Object.<string, ol.XmlSerializer>>}
|
||||
*/
|
||||
const GPX_SERIALIZERS = _ol_xml_.makeStructureNS(
|
||||
const GPX_SERIALIZERS = makeStructureNS(
|
||||
NAMESPACE_URIS, {
|
||||
'rte': _ol_xml_.makeChildAppender(writeRte),
|
||||
'trk': _ol_xml_.makeChildAppender(writeTrk),
|
||||
'wpt': _ol_xml_.makeChildAppender(writeWpt)
|
||||
'rte': makeChildAppender(writeRte),
|
||||
'trk': makeChildAppender(writeTrk),
|
||||
'wpt': makeChildAppender(writeWpt)
|
||||
});
|
||||
|
||||
|
||||
@@ -456,7 +459,7 @@ function parseLink(node, objectStack) {
|
||||
if (href !== null) {
|
||||
values['link'] = href;
|
||||
}
|
||||
_ol_xml_.parseNode(LINK_PARSERS, node, objectStack);
|
||||
parseNode(LINK_PARSERS, node, objectStack);
|
||||
}
|
||||
|
||||
|
||||
@@ -475,7 +478,7 @@ function parseExtensions(node, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function parseRtePt(node, objectStack) {
|
||||
const values = _ol_xml_.pushParseAndPop(
|
||||
const values = pushParseAndPop(
|
||||
{}, RTEPT_PARSERS, node, objectStack);
|
||||
if (values) {
|
||||
const rteValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
@@ -493,7 +496,7 @@ function parseRtePt(node, objectStack) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
*/
|
||||
function parseTrkPt(node, objectStack) {
|
||||
const values = _ol_xml_.pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);
|
||||
const values = pushParseAndPop({}, TRKPT_PARSERS, node, objectStack);
|
||||
if (values) {
|
||||
const trkValues = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const flatCoordinates = /** @type {Array.<number>} */
|
||||
@@ -511,7 +514,7 @@ function parseTrkPt(node, objectStack) {
|
||||
*/
|
||||
function parseTrkSeg(node, objectStack) {
|
||||
const values = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
_ol_xml_.parseNode(TRKSEG_PARSERS, node, objectStack);
|
||||
parseNode(TRKSEG_PARSERS, node, objectStack);
|
||||
const flatCoordinates = /** @type {Array.<number>} */
|
||||
(values['flatCoordinates']);
|
||||
const ends = /** @type {Array.<number>} */ (values['ends']);
|
||||
@@ -526,7 +529,7 @@ function parseTrkSeg(node, objectStack) {
|
||||
*/
|
||||
function readRte(node, objectStack) {
|
||||
const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
const values = _ol_xml_.pushParseAndPop({
|
||||
const values = pushParseAndPop({
|
||||
'flatCoordinates': [],
|
||||
'layoutOptions': {}
|
||||
}, RTE_PARSERS, node, objectStack);
|
||||
@@ -555,7 +558,7 @@ function readRte(node, objectStack) {
|
||||
*/
|
||||
function readTrk(node, objectStack) {
|
||||
const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
const values = _ol_xml_.pushParseAndPop({
|
||||
const values = pushParseAndPop({
|
||||
'flatCoordinates': [],
|
||||
'ends': [],
|
||||
'layoutOptions': {}
|
||||
@@ -587,7 +590,7 @@ function readTrk(node, objectStack) {
|
||||
*/
|
||||
function readWpt(node, objectStack) {
|
||||
const options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||
const values = _ol_xml_.pushParseAndPop({}, WPT_PARSERS, node, objectStack);
|
||||
const values = pushParseAndPop({}, WPT_PARSERS, node, objectStack);
|
||||
if (!values) {
|
||||
return undefined;
|
||||
}
|
||||
@@ -678,7 +681,7 @@ GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
}
|
||||
if (node.localName == 'gpx') {
|
||||
/** @type {Array.<ol.Feature>} */
|
||||
const features = _ol_xml_.pushParseAndPop([], GPX_PARSERS,
|
||||
const features = pushParseAndPop([], GPX_PARSERS,
|
||||
node, [this.getReadOptions(node, opt_options)]);
|
||||
if (features) {
|
||||
this.handleReadExtensions_(features);
|
||||
@@ -715,8 +718,8 @@ function writeLink(node, value, objectStack) {
|
||||
properties['linkText'],
|
||||
properties['linkType']
|
||||
];
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
|
||||
LINK_SERIALIZERS, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ ({node: node}),
|
||||
LINK_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY,
|
||||
link, objectStack, LINK_SEQUENCE);
|
||||
}
|
||||
|
||||
@@ -732,8 +735,8 @@ function writeWptType(node, coordinate, objectStack) {
|
||||
const namespaceURI = parentNode.namespaceURI;
|
||||
const properties = context['properties'];
|
||||
//FIXME Projection handling
|
||||
_ol_xml_.setAttributeNS(node, null, 'lat', coordinate[1]);
|
||||
_ol_xml_.setAttributeNS(node, null, 'lon', coordinate[0]);
|
||||
setAttributeNS(node, null, 'lat', coordinate[1]);
|
||||
setAttributeNS(node, null, 'lon', coordinate[0]);
|
||||
const geometryLayout = context['geometryLayout'];
|
||||
switch (geometryLayout) {
|
||||
case GeometryLayout.XYZM:
|
||||
@@ -757,10 +760,10 @@ function writeWptType(node, coordinate, objectStack) {
|
||||
const orderedKeys = (node.nodeName == 'rtept') ?
|
||||
RTEPT_TYPE_SEQUENCE[namespaceURI] :
|
||||
WPT_TYPE_SEQUENCE[namespaceURI];
|
||||
const values = _ol_xml_.makeSequence(properties, orderedKeys);
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
const values = makeSequence(properties, orderedKeys);
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
({node: node, 'properties': properties}),
|
||||
WPT_TYPE_SERIALIZERS, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
WPT_TYPE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values, objectStack, orderedKeys);
|
||||
}
|
||||
|
||||
@@ -782,9 +785,9 @@ function writeRte(node, feature, objectStack) {
|
||||
}
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
const orderedKeys = RTE_SEQUENCE[parentNode.namespaceURI];
|
||||
const values = _ol_xml_.makeSequence(properties, orderedKeys);
|
||||
_ol_xml_.pushSerializeAndPop(context,
|
||||
RTE_SERIALIZERS, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
const values = makeSequence(properties, orderedKeys);
|
||||
pushSerializeAndPop(context,
|
||||
RTE_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values, objectStack, orderedKeys);
|
||||
}
|
||||
|
||||
@@ -807,9 +810,9 @@ function writeTrk(node, feature, objectStack) {
|
||||
}
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
const orderedKeys = TRK_SEQUENCE[parentNode.namespaceURI];
|
||||
const values = _ol_xml_.makeSequence(properties, orderedKeys);
|
||||
_ol_xml_.pushSerializeAndPop(context,
|
||||
TRK_SERIALIZERS, _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
const values = makeSequence(properties, orderedKeys);
|
||||
pushSerializeAndPop(context,
|
||||
TRK_SERIALIZERS, OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values, objectStack, orderedKeys);
|
||||
}
|
||||
|
||||
@@ -823,7 +826,7 @@ function writeTrkSeg(node, lineString, objectStack) {
|
||||
/** @type {ol.XmlNodeStackItem} */
|
||||
const context = {node: node, 'geometryLayout': lineString.getLayout(),
|
||||
'properties': {}};
|
||||
_ol_xml_.pushSerializeAndPop(context,
|
||||
pushSerializeAndPop(context,
|
||||
TRKSEG_SERIALIZERS, TRKSEG_NODE_FACTORY,
|
||||
lineString.getCoordinates(), objectStack);
|
||||
}
|
||||
@@ -876,16 +879,16 @@ GPX.prototype.writeFeatures;
|
||||
GPX.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
//FIXME Serialize metadata
|
||||
const gpx = _ol_xml_.createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
|
||||
const gpx = createElementNS('http://www.topografix.com/GPX/1/1', 'gpx');
|
||||
const xmlnsUri = 'http://www.w3.org/2000/xmlns/';
|
||||
const xmlSchemaInstanceUri = 'http://www.w3.org/2001/XMLSchema-instance';
|
||||
_ol_xml_.setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
|
||||
_ol_xml_.setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
|
||||
setAttributeNS(gpx, xmlnsUri, 'xmlns:xsi', xmlSchemaInstanceUri);
|
||||
setAttributeNS(gpx, xmlSchemaInstanceUri, 'xsi:schemaLocation',
|
||||
SCHEMA_LOCATION);
|
||||
gpx.setAttribute('version', '1.1');
|
||||
gpx.setAttribute('creator', 'OpenLayers');
|
||||
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
({node: gpx}), GPX_SERIALIZERS, GPX_NODE_FACTORY, features, [opt_options]);
|
||||
return gpx;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ import Point from '../geom/Point.js';
|
||||
import Polygon from '../geom/Polygon.js';
|
||||
import {isEmpty} from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {pushParseAndPop, makeStructureNS} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -52,7 +52,7 @@ OSMXML.readNode_ = function(node, objectStack) {
|
||||
];
|
||||
state.nodes[id] = coordinates;
|
||||
|
||||
const values = _ol_xml_.pushParseAndPop({
|
||||
const values = pushParseAndPop({
|
||||
tags: {}
|
||||
}, OSMXML.NODE_PARSERS_, node, objectStack);
|
||||
if (!isEmpty(values.tags)) {
|
||||
@@ -73,7 +73,7 @@ OSMXML.readNode_ = function(node, objectStack) {
|
||||
*/
|
||||
OSMXML.readWay_ = function(node, objectStack) {
|
||||
const id = node.getAttribute('id');
|
||||
const values = _ol_xml_.pushParseAndPop({
|
||||
const values = pushParseAndPop({
|
||||
id: id,
|
||||
ndrefs: [],
|
||||
tags: {}
|
||||
@@ -120,7 +120,7 @@ OSMXML.NAMESPACE_URIS_ = [
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OSMXML.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OSMXML.WAY_PARSERS_ = makeStructureNS(
|
||||
OSMXML.NAMESPACE_URIS_, {
|
||||
'nd': OSMXML.readNd_,
|
||||
'tag': OSMXML.readTag_
|
||||
@@ -132,7 +132,7 @@ OSMXML.WAY_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OSMXML.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OSMXML.PARSERS_ = makeStructureNS(
|
||||
OSMXML.NAMESPACE_URIS_, {
|
||||
'node': OSMXML.readNode_,
|
||||
'way': OSMXML.readWay_
|
||||
@@ -144,7 +144,7 @@ OSMXML.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OSMXML.NODE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OSMXML.NODE_PARSERS_ = makeStructureNS(
|
||||
OSMXML.NAMESPACE_URIS_, {
|
||||
'tag': OSMXML.readTag_
|
||||
});
|
||||
@@ -168,7 +168,7 @@ OSMXML.prototype.readFeatures;
|
||||
OSMXML.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
const options = this.getReadOptions(node, opt_options);
|
||||
if (node.localName == 'osm') {
|
||||
const state = _ol_xml_.pushParseAndPop({
|
||||
const state = pushParseAndPop({
|
||||
nodes: {},
|
||||
ways: [],
|
||||
features: []
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {makeObjectPropertyPusher, makeObjectPropertySetter, makeStructureNS, pushParseAndPop} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
@@ -35,7 +35,7 @@ OWS.prototype.readFromDocument = function(doc) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
OWS.prototype.readFromNode = function(node) {
|
||||
const owsObject = _ol_xml_.pushParseAndPop({},
|
||||
const owsObject = pushParseAndPop({},
|
||||
OWS.PARSERS_, node, []);
|
||||
return owsObject ? owsObject : null;
|
||||
};
|
||||
@@ -48,7 +48,7 @@ OWS.prototype.readFromNode = function(node) {
|
||||
* @return {Object|undefined} The address.
|
||||
*/
|
||||
OWS.readAddress_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.ADDRESS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -60,7 +60,7 @@ OWS.readAddress_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} The values.
|
||||
*/
|
||||
OWS.readAllowedValues_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.ALLOWED_VALUES_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ OWS.readConstraint_ = function(node, objectStack) {
|
||||
if (!name) {
|
||||
return undefined;
|
||||
}
|
||||
return _ol_xml_.pushParseAndPop({'name': name},
|
||||
return pushParseAndPop({'name': name},
|
||||
OWS.CONSTRAINT_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -89,7 +89,7 @@ OWS.readConstraint_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} The contact info.
|
||||
*/
|
||||
OWS.readContactInfo_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.CONTACT_INFO_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -101,7 +101,7 @@ OWS.readContactInfo_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} The DCP.
|
||||
*/
|
||||
OWS.readDcp_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.DCP_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@ OWS.readGet_ = function(node, objectStack) {
|
||||
if (!href) {
|
||||
return undefined;
|
||||
}
|
||||
return _ol_xml_.pushParseAndPop({'href': href},
|
||||
return pushParseAndPop({'href': href},
|
||||
OWS.REQUEST_METHOD_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -129,7 +129,7 @@ OWS.readGet_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} The HTTP object.
|
||||
*/
|
||||
OWS.readHttp_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({}, OWS.HTTP_PARSERS_,
|
||||
return pushParseAndPop({}, OWS.HTTP_PARSERS_,
|
||||
node, objectStack);
|
||||
};
|
||||
|
||||
@@ -142,7 +142,7 @@ OWS.readHttp_ = function(node, objectStack) {
|
||||
*/
|
||||
OWS.readOperation_ = function(node, objectStack) {
|
||||
const name = node.getAttribute('name');
|
||||
const value = _ol_xml_.pushParseAndPop({},
|
||||
const value = pushParseAndPop({},
|
||||
OWS.OPERATION_PARSERS_, node, objectStack);
|
||||
if (!value) {
|
||||
return undefined;
|
||||
@@ -161,7 +161,7 @@ OWS.readOperation_ = function(node, objectStack) {
|
||||
*/
|
||||
OWS.readOperationsMetadata_ = function(node,
|
||||
objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.OPERATIONS_METADATA_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -174,7 +174,7 @@ OWS.readOperationsMetadata_ = function(node,
|
||||
* @return {Object|undefined} The phone.
|
||||
*/
|
||||
OWS.readPhone_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
OWS.PHONE_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -187,7 +187,7 @@ OWS.readPhone_ = function(node, objectStack) {
|
||||
*/
|
||||
OWS.readServiceIdentification_ = function(node,
|
||||
objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, OWS.SERVICE_IDENTIFICATION_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -200,7 +200,7 @@ OWS.readServiceIdentification_ = function(node,
|
||||
* @return {Object|undefined} The service contact.
|
||||
*/
|
||||
OWS.readServiceContact_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, OWS.SERVICE_CONTACT_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -213,7 +213,7 @@ OWS.readServiceContact_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} The service provider.
|
||||
*/
|
||||
OWS.readServiceProvider_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, OWS.SERVICE_PROVIDER_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -246,13 +246,13 @@ OWS.NAMESPACE_URIS_ = [
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'ServiceIdentification': _ol_xml_.makeObjectPropertySetter(
|
||||
'ServiceIdentification': makeObjectPropertySetter(
|
||||
OWS.readServiceIdentification_),
|
||||
'ServiceProvider': _ol_xml_.makeObjectPropertySetter(
|
||||
'ServiceProvider': makeObjectPropertySetter(
|
||||
OWS.readServiceProvider_),
|
||||
'OperationsMetadata': _ol_xml_.makeObjectPropertySetter(
|
||||
'OperationsMetadata': makeObjectPropertySetter(
|
||||
OWS.readOperationsMetadata_)
|
||||
});
|
||||
|
||||
@@ -262,16 +262,16 @@ OWS.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.ADDRESS_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'DeliveryPoint': _ol_xml_.makeObjectPropertySetter(
|
||||
'DeliveryPoint': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'City': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'AdministrativeArea': _ol_xml_.makeObjectPropertySetter(
|
||||
'City': makeObjectPropertySetter(XSD.readString),
|
||||
'AdministrativeArea': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'PostalCode': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'ElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
|
||||
'PostalCode': makeObjectPropertySetter(XSD.readString),
|
||||
'Country': makeObjectPropertySetter(XSD.readString),
|
||||
'ElectronicMailAddress': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
});
|
||||
|
||||
@@ -281,9 +281,9 @@ OWS.ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.ALLOWED_VALUES_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Value': _ol_xml_.makeObjectPropertyPusher(OWS.readValue_)
|
||||
'Value': makeObjectPropertyPusher(OWS.readValue_)
|
||||
});
|
||||
|
||||
|
||||
@@ -292,9 +292,9 @@ OWS.ALLOWED_VALUES_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.CONSTRAINT_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'AllowedValues': _ol_xml_.makeObjectPropertySetter(
|
||||
'AllowedValues': makeObjectPropertySetter(
|
||||
OWS.readAllowedValues_)
|
||||
});
|
||||
|
||||
@@ -304,10 +304,10 @@ OWS.CONSTRAINT_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.CONTACT_INFO_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Phone': _ol_xml_.makeObjectPropertySetter(OWS.readPhone_),
|
||||
'Address': _ol_xml_.makeObjectPropertySetter(OWS.readAddress_)
|
||||
'Phone': makeObjectPropertySetter(OWS.readPhone_),
|
||||
'Address': makeObjectPropertySetter(OWS.readAddress_)
|
||||
});
|
||||
|
||||
|
||||
@@ -316,9 +316,9 @@ OWS.CONTACT_INFO_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.DCP_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'HTTP': _ol_xml_.makeObjectPropertySetter(OWS.readHttp_)
|
||||
'HTTP': makeObjectPropertySetter(OWS.readHttp_)
|
||||
});
|
||||
|
||||
|
||||
@@ -327,9 +327,9 @@ OWS.DCP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.HTTP_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Get': _ol_xml_.makeObjectPropertyPusher(OWS.readGet_),
|
||||
'Get': makeObjectPropertyPusher(OWS.readGet_),
|
||||
'Post': undefined // TODO
|
||||
});
|
||||
|
||||
@@ -339,9 +339,9 @@ OWS.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.OPERATION_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'DCP': _ol_xml_.makeObjectPropertySetter(OWS.readDcp_)
|
||||
'DCP': makeObjectPropertySetter(OWS.readDcp_)
|
||||
});
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ OWS.OPERATION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.OPERATIONS_METADATA_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Operation': OWS.readOperation_
|
||||
});
|
||||
@@ -361,10 +361,10 @@ OWS.OPERATIONS_METADATA_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.PHONE_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Voice': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Facsimile': _ol_xml_.makeObjectPropertySetter(XSD.readString)
|
||||
'Voice': makeObjectPropertySetter(XSD.readString),
|
||||
'Facsimile': makeObjectPropertySetter(XSD.readString)
|
||||
});
|
||||
|
||||
|
||||
@@ -373,9 +373,9 @@ OWS.PHONE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
OWS.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
OWS.REQUEST_METHOD_PARSERS_ = makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Constraint': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Constraint': makeObjectPropertyPusher(
|
||||
OWS.readConstraint_)
|
||||
});
|
||||
|
||||
@@ -386,12 +386,12 @@ OWS.REQUEST_METHOD_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @private
|
||||
*/
|
||||
OWS.SERVICE_CONTACT_PARSERS_ =
|
||||
_ol_xml_.makeStructureNS(
|
||||
makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'IndividualName': _ol_xml_.makeObjectPropertySetter(
|
||||
'IndividualName': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'PositionName': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'ContactInfo': _ol_xml_.makeObjectPropertySetter(
|
||||
'PositionName': makeObjectPropertySetter(XSD.readString),
|
||||
'ContactInfo': makeObjectPropertySetter(
|
||||
OWS.readContactInfo_)
|
||||
});
|
||||
|
||||
@@ -402,15 +402,15 @@ OWS.SERVICE_CONTACT_PARSERS_ =
|
||||
* @private
|
||||
*/
|
||||
OWS.SERVICE_IDENTIFICATION_PARSERS_ =
|
||||
_ol_xml_.makeStructureNS(
|
||||
makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'ServiceTypeVersion': _ol_xml_.makeObjectPropertySetter(
|
||||
'Abstract': makeObjectPropertySetter(XSD.readString),
|
||||
'AccessConstraints': makeObjectPropertySetter(XSD.readString),
|
||||
'Fees': makeObjectPropertySetter(XSD.readString),
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'ServiceTypeVersion': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'ServiceType': _ol_xml_.makeObjectPropertySetter(XSD.readString)
|
||||
'ServiceType': makeObjectPropertySetter(XSD.readString)
|
||||
});
|
||||
|
||||
|
||||
@@ -420,11 +420,11 @@ OWS.SERVICE_IDENTIFICATION_PARSERS_ =
|
||||
* @private
|
||||
*/
|
||||
OWS.SERVICE_PROVIDER_PARSERS_ =
|
||||
_ol_xml_.makeStructureNS(
|
||||
makeStructureNS(
|
||||
OWS.NAMESPACE_URIS_, {
|
||||
'ProviderName': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'ProviderSite': _ol_xml_.makeObjectPropertySetter(XLink.readHref),
|
||||
'ServiceContact': _ol_xml_.makeObjectPropertySetter(
|
||||
'ProviderName': makeObjectPropertySetter(XSD.readString),
|
||||
'ProviderSite': makeObjectPropertySetter(XLink.readHref),
|
||||
'ServiceContact': makeObjectPropertySetter(
|
||||
OWS.readServiceContact_)
|
||||
});
|
||||
export default OWS;
|
||||
|
||||
@@ -12,7 +12,9 @@ import XSD from '../format/XSD.js';
|
||||
import Geometry from '../geom/Geometry.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {get as getProjection} from '../proj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {createElementNS, isDocument, isNode, makeArrayPusher, makeChildAppender,
|
||||
makeObjectPropertySetter, makeSimpleNodeFactory, parse, parseNode,
|
||||
pushParseAndPop, pushSerializeAndPop, setAttributeNS} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -157,8 +159,8 @@ WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
const objectStack = [context];
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][
|
||||
'featureMember'] =
|
||||
_ol_xml_.makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
|
||||
let features = _ol_xml_.pushParseAndPop([],
|
||||
makeArrayPusher(GMLBase.prototype.readFeaturesInternal);
|
||||
let features = pushParseAndPop([],
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
|
||||
objectStack, this.gmlFormat_);
|
||||
if (!features) {
|
||||
@@ -176,13 +178,13 @@ WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
|
||||
* @api
|
||||
*/
|
||||
WFS.prototype.readTransactionResponse = function(source) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readTransactionResponseFromDocument(
|
||||
/** @type {Document} */ (source));
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readTransactionResponseFromNode(/** @type {Node} */ (source));
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readTransactionResponseFromDocument(doc);
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -199,14 +201,14 @@ WFS.prototype.readTransactionResponse = function(source) {
|
||||
* @api
|
||||
*/
|
||||
WFS.prototype.readFeatureCollectionMetadata = function(source) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readFeatureCollectionMetadataFromDocument(
|
||||
/** @type {Document} */ (source));
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readFeatureCollectionMetadataFromNode(
|
||||
/** @type {Node} */ (source));
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readFeatureCollectionMetadataFromDocument(doc);
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -236,7 +238,7 @@ WFS.prototype.readFeatureCollectionMetadataFromDocument = function(doc) {
|
||||
*/
|
||||
WFS.FEATURE_COLLECTION_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'boundedBy': _ol_xml_.makeObjectPropertySetter(
|
||||
'boundedBy': makeObjectPropertySetter(
|
||||
GMLBase.prototype.readGeometryElement, 'bounds')
|
||||
}
|
||||
};
|
||||
@@ -252,7 +254,7 @@ WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) {
|
||||
const value = XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('numberOfFeatures'));
|
||||
result['numberOfFeatures'] = value;
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
/** @type {ol.WFSFeatureCollectionMetadata} */ (result),
|
||||
WFS.FEATURE_COLLECTION_PARSERS_, node, [], this.gmlFormat_);
|
||||
};
|
||||
@@ -265,11 +267,11 @@ WFS.prototype.readFeatureCollectionMetadataFromNode = function(node) {
|
||||
*/
|
||||
WFS.TRANSACTION_SUMMARY_PARSERS_ = {
|
||||
'http://www.opengis.net/wfs': {
|
||||
'totalInserted': _ol_xml_.makeObjectPropertySetter(
|
||||
'totalInserted': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'totalUpdated': _ol_xml_.makeObjectPropertySetter(
|
||||
'totalUpdated': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'totalDeleted': _ol_xml_.makeObjectPropertySetter(
|
||||
'totalDeleted': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger)
|
||||
}
|
||||
};
|
||||
@@ -282,7 +284,7 @@ WFS.TRANSACTION_SUMMARY_PARSERS_ = {
|
||||
* @private
|
||||
*/
|
||||
WFS.readTransactionSummary_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WFS.TRANSACTION_SUMMARY_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -294,7 +296,7 @@ WFS.readTransactionSummary_ = function(node, objectStack) {
|
||||
*/
|
||||
WFS.OGC_FID_PARSERS_ = {
|
||||
'http://www.opengis.net/ogc': {
|
||||
'FeatureId': _ol_xml_.makeArrayPusher(function(node, objectStack) {
|
||||
'FeatureId': makeArrayPusher(function(node, objectStack) {
|
||||
return node.getAttribute('fid');
|
||||
})
|
||||
}
|
||||
@@ -307,7 +309,7 @@ WFS.OGC_FID_PARSERS_ = {
|
||||
* @private
|
||||
*/
|
||||
WFS.fidParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(WFS.OGC_FID_PARSERS_, node, objectStack);
|
||||
parseNode(WFS.OGC_FID_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
|
||||
@@ -330,7 +332,7 @@ WFS.INSERT_RESULTS_PARSERS_ = {
|
||||
* @private
|
||||
*/
|
||||
WFS.readInsertResults_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
[], WFS.INSERT_RESULTS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -342,9 +344,9 @@ WFS.readInsertResults_ = function(node, objectStack) {
|
||||
*/
|
||||
WFS.TRANSACTION_RESPONSE_PARSERS_ = {
|
||||
'http://www.opengis.net/wfs': {
|
||||
'TransactionSummary': _ol_xml_.makeObjectPropertySetter(
|
||||
'TransactionSummary': makeObjectPropertySetter(
|
||||
WFS.readTransactionSummary_, 'transactionSummary'),
|
||||
'InsertResults': _ol_xml_.makeObjectPropertySetter(
|
||||
'InsertResults': makeObjectPropertySetter(
|
||||
WFS.readInsertResults_, 'insertIds')
|
||||
}
|
||||
};
|
||||
@@ -369,7 +371,7 @@ WFS.prototype.readTransactionResponseFromDocument = function(doc) {
|
||||
* @return {ol.WFSTransactionResponse|undefined} Transaction response.
|
||||
*/
|
||||
WFS.prototype.readTransactionResponseFromNode = function(node) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
/** @type {ol.WFSTransactionResponse} */({}),
|
||||
WFS.TRANSACTION_RESPONSE_PARSERS_, node, []);
|
||||
};
|
||||
@@ -381,7 +383,7 @@ WFS.prototype.readTransactionResponseFromNode = function(node) {
|
||||
*/
|
||||
WFS.QUERY_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/wfs': {
|
||||
'PropertyName': _ol_xml_.makeChildAppender(XSD.writeStringTextNode)
|
||||
'PropertyName': makeChildAppender(XSD.writeStringTextNode)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -397,7 +399,7 @@ WFS.writeFeature_ = function(node, feature, objectStack) {
|
||||
const featureType = context['featureType'];
|
||||
const featureNS = context['featureNS'];
|
||||
const gmlVersion = context['gmlVersion'];
|
||||
const child = _ol_xml_.createElementNS(featureNS, featureType);
|
||||
const child = createElementNS(featureNS, featureType);
|
||||
node.appendChild(child);
|
||||
if (gmlVersion === 2) {
|
||||
GML2.prototype.writeFeatureElement(child, feature, objectStack);
|
||||
@@ -414,8 +416,8 @@ WFS.writeFeature_ = function(node, feature, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
WFS.writeOgcFidFilter_ = function(node, fid, objectStack) {
|
||||
const filter = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = _ol_xml_.createElementNS(WFS.OGCNS, 'FeatureId');
|
||||
const filter = createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = createElementNS(WFS.OGCNS, 'FeatureId');
|
||||
filter.appendChild(child);
|
||||
child.setAttribute('fid', fid);
|
||||
node.appendChild(filter);
|
||||
@@ -455,7 +457,7 @@ WFS.writeDelete_ = function(node, feature, objectStack) {
|
||||
const featureNS = context['featureNS'];
|
||||
const typeName = WFS.getTypeName_(featurePrefix, featureType);
|
||||
node.setAttribute('typeName', typeName);
|
||||
_ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
const fid = feature.getId();
|
||||
if (fid !== undefined) {
|
||||
@@ -479,7 +481,7 @@ WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
const typeName = WFS.getTypeName_(featurePrefix, featureType);
|
||||
const geometryName = feature.getGeometryName();
|
||||
node.setAttribute('typeName', typeName);
|
||||
_ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
const fid = feature.getId();
|
||||
if (fid !== undefined) {
|
||||
@@ -495,11 +497,11 @@ WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
values.push({name: name, value: value});
|
||||
}
|
||||
}
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
||||
pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (
|
||||
{'gmlVersion': context['gmlVersion'], node: node,
|
||||
'hasZ': context['hasZ'], 'srsName': context['srsName']}),
|
||||
WFS.TRANSACTION_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Property'), values,
|
||||
makeSimpleNodeFactory('Property'), values,
|
||||
objectStack);
|
||||
WFS.writeOgcFidFilter_(node, fid, objectStack);
|
||||
}
|
||||
@@ -513,13 +515,13 @@ WFS.writeUpdate_ = function(node, feature, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
WFS.writeProperty_ = function(node, pair, objectStack) {
|
||||
const name = _ol_xml_.createElementNS(WFS.WFSNS, 'Name');
|
||||
const name = createElementNS(WFS.WFSNS, 'Name');
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const gmlVersion = context['gmlVersion'];
|
||||
node.appendChild(name);
|
||||
XSD.writeStringTextNode(name, pair.name);
|
||||
if (pair.value !== undefined && pair.value !== null) {
|
||||
const value = _ol_xml_.createElementNS(WFS.WFSNS, 'Value');
|
||||
const value = createElementNS(WFS.WFSNS, 'Value');
|
||||
node.appendChild(value);
|
||||
if (pair.value instanceof Geometry) {
|
||||
if (gmlVersion === 2) {
|
||||
@@ -562,11 +564,11 @@ WFS.writeNative_ = function(node, nativeElement, objectStack) {
|
||||
*/
|
||||
WFS.TRANSACTION_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/wfs': {
|
||||
'Insert': _ol_xml_.makeChildAppender(WFS.writeFeature_),
|
||||
'Update': _ol_xml_.makeChildAppender(WFS.writeUpdate_),
|
||||
'Delete': _ol_xml_.makeChildAppender(WFS.writeDelete_),
|
||||
'Property': _ol_xml_.makeChildAppender(WFS.writeProperty_),
|
||||
'Native': _ol_xml_.makeChildAppender(WFS.writeNative_)
|
||||
'Insert': makeChildAppender(WFS.writeFeature_),
|
||||
'Update': makeChildAppender(WFS.writeUpdate_),
|
||||
'Delete': makeChildAppender(WFS.writeDelete_),
|
||||
'Property': makeChildAppender(WFS.writeProperty_),
|
||||
'Native': makeChildAppender(WFS.writeNative_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -595,18 +597,18 @@ WFS.writeQuery_ = function(node, featureType, objectStack) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
if (featureNS) {
|
||||
_ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix,
|
||||
featureNS);
|
||||
}
|
||||
const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(item,
|
||||
pushSerializeAndPop(item,
|
||||
WFS.QUERY_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('PropertyName'), propertyNames,
|
||||
makeSimpleNodeFactory('PropertyName'), propertyNames,
|
||||
objectStack);
|
||||
const filter = context['filter'];
|
||||
if (filter) {
|
||||
const child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = createElementNS(WFS.OGCNS, 'Filter');
|
||||
node.appendChild(child);
|
||||
WFS.writeFilterCondition_(child, filter, objectStack);
|
||||
}
|
||||
@@ -622,9 +624,9 @@ WFS.writeQuery_ = function(node, featureType, objectStack) {
|
||||
WFS.writeFilterCondition_ = function(node, filter, objectStack) {
|
||||
/** @type {ol.XmlNodeStackItem} */
|
||||
const item = {node: node};
|
||||
_ol_xml_.pushSerializeAndPop(item,
|
||||
pushSerializeAndPop(item,
|
||||
WFS.GETFEATURE_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory(filter.getTagName()),
|
||||
makeSimpleNodeFactory(filter.getTagName()),
|
||||
[filter], objectStack);
|
||||
};
|
||||
|
||||
@@ -697,19 +699,19 @@ WFS.writeWithinFilter_ = function(node, filter, objectStack) {
|
||||
*/
|
||||
WFS.writeDuringFilter_ = function(node, filter, objectStack) {
|
||||
|
||||
const valueReference = _ol_xml_.createElementNS(WFS.FESNS, 'ValueReference');
|
||||
const valueReference = createElementNS(WFS.FESNS, 'ValueReference');
|
||||
XSD.writeStringTextNode(valueReference, filter.propertyName);
|
||||
node.appendChild(valueReference);
|
||||
|
||||
const timePeriod = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimePeriod');
|
||||
const timePeriod = createElementNS(GMLBase.GMLNS, 'TimePeriod');
|
||||
|
||||
node.appendChild(timePeriod);
|
||||
|
||||
const begin = _ol_xml_.createElementNS(GMLBase.GMLNS, 'begin');
|
||||
const begin = createElementNS(GMLBase.GMLNS, 'begin');
|
||||
timePeriod.appendChild(begin);
|
||||
WFS.writeTimeInstant_(begin, filter.begin);
|
||||
|
||||
const end = _ol_xml_.createElementNS(GMLBase.GMLNS, 'end');
|
||||
const end = createElementNS(GMLBase.GMLNS, 'end');
|
||||
timePeriod.appendChild(end);
|
||||
WFS.writeTimeInstant_(end, filter.end);
|
||||
};
|
||||
@@ -727,9 +729,9 @@ WFS.writeLogicalFilter_ = function(node, filter, objectStack) {
|
||||
const conditions = filter.conditions;
|
||||
for (let i = 0, ii = conditions.length; i < ii; ++i) {
|
||||
const condition = conditions[i];
|
||||
_ol_xml_.pushSerializeAndPop(item,
|
||||
pushSerializeAndPop(item,
|
||||
WFS.GETFEATURE_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory(condition.getTagName()),
|
||||
makeSimpleNodeFactory(condition.getTagName()),
|
||||
[condition], objectStack);
|
||||
}
|
||||
};
|
||||
@@ -745,9 +747,9 @@ WFS.writeNotFilter_ = function(node, filter, objectStack) {
|
||||
/** @type {ol.XmlNodeStackItem} */
|
||||
const item = {node: node};
|
||||
const condition = filter.condition;
|
||||
_ol_xml_.pushSerializeAndPop(item,
|
||||
pushSerializeAndPop(item,
|
||||
WFS.GETFEATURE_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory(condition.getTagName()),
|
||||
makeSimpleNodeFactory(condition.getTagName()),
|
||||
[condition], objectStack);
|
||||
};
|
||||
|
||||
@@ -787,11 +789,11 @@ WFS.writeIsNullFilter_ = function(node, filter, objectStack) {
|
||||
WFS.writeIsBetweenFilter_ = function(node, filter, objectStack) {
|
||||
WFS.writeOgcPropertyName_(node, filter.propertyName);
|
||||
|
||||
const lowerBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'LowerBoundary');
|
||||
const lowerBoundary = createElementNS(WFS.OGCNS, 'LowerBoundary');
|
||||
node.appendChild(lowerBoundary);
|
||||
WFS.writeOgcLiteral_(lowerBoundary, '' + filter.lowerBoundary);
|
||||
|
||||
const upperBoundary = _ol_xml_.createElementNS(WFS.OGCNS, 'UpperBoundary');
|
||||
const upperBoundary = createElementNS(WFS.OGCNS, 'UpperBoundary');
|
||||
node.appendChild(upperBoundary);
|
||||
WFS.writeOgcLiteral_(upperBoundary, '' + filter.upperBoundary);
|
||||
};
|
||||
@@ -822,7 +824,7 @@ WFS.writeIsLikeFilter_ = function(node, filter, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
WFS.writeOgcExpression_ = function(tagName, node, value) {
|
||||
const property = _ol_xml_.createElementNS(WFS.OGCNS, tagName);
|
||||
const property = createElementNS(WFS.OGCNS, tagName);
|
||||
XSD.writeStringTextNode(property, value);
|
||||
node.appendChild(property);
|
||||
};
|
||||
@@ -854,10 +856,10 @@ WFS.writeOgcLiteral_ = function(node, value) {
|
||||
* @private
|
||||
*/
|
||||
WFS.writeTimeInstant_ = function(node, time) {
|
||||
const timeInstant = _ol_xml_.createElementNS(GMLBase.GMLNS, 'TimeInstant');
|
||||
const timeInstant = createElementNS(GMLBase.GMLNS, 'TimeInstant');
|
||||
node.appendChild(timeInstant);
|
||||
|
||||
const timePosition = _ol_xml_.createElementNS(GMLBase.GMLNS, 'timePosition');
|
||||
const timePosition = createElementNS(GMLBase.GMLNS, 'timePosition');
|
||||
timeInstant.appendChild(timePosition);
|
||||
XSD.writeStringTextNode(timePosition, time);
|
||||
};
|
||||
@@ -869,26 +871,26 @@ WFS.writeTimeInstant_ = function(node, time) {
|
||||
*/
|
||||
WFS.GETFEATURE_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/wfs': {
|
||||
'Query': _ol_xml_.makeChildAppender(WFS.writeQuery_)
|
||||
'Query': makeChildAppender(WFS.writeQuery_)
|
||||
},
|
||||
'http://www.opengis.net/ogc': {
|
||||
'During': _ol_xml_.makeChildAppender(WFS.writeDuringFilter_),
|
||||
'And': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_),
|
||||
'Or': _ol_xml_.makeChildAppender(WFS.writeLogicalFilter_),
|
||||
'Not': _ol_xml_.makeChildAppender(WFS.writeNotFilter_),
|
||||
'BBOX': _ol_xml_.makeChildAppender(WFS.writeBboxFilter_),
|
||||
'Contains': _ol_xml_.makeChildAppender(WFS.writeContainsFilter_),
|
||||
'Intersects': _ol_xml_.makeChildAppender(WFS.writeIntersectsFilter_),
|
||||
'Within': _ol_xml_.makeChildAppender(WFS.writeWithinFilter_),
|
||||
'PropertyIsEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsNotEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsLessThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsLessThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsGreaterThan': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsGreaterThanOrEqualTo': _ol_xml_.makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsNull': _ol_xml_.makeChildAppender(WFS.writeIsNullFilter_),
|
||||
'PropertyIsBetween': _ol_xml_.makeChildAppender(WFS.writeIsBetweenFilter_),
|
||||
'PropertyIsLike': _ol_xml_.makeChildAppender(WFS.writeIsLikeFilter_)
|
||||
'During': makeChildAppender(WFS.writeDuringFilter_),
|
||||
'And': makeChildAppender(WFS.writeLogicalFilter_),
|
||||
'Or': makeChildAppender(WFS.writeLogicalFilter_),
|
||||
'Not': makeChildAppender(WFS.writeNotFilter_),
|
||||
'BBOX': makeChildAppender(WFS.writeBboxFilter_),
|
||||
'Contains': makeChildAppender(WFS.writeContainsFilter_),
|
||||
'Intersects': makeChildAppender(WFS.writeIntersectsFilter_),
|
||||
'Within': makeChildAppender(WFS.writeWithinFilter_),
|
||||
'PropertyIsEqualTo': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsNotEqualTo': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsLessThan': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsLessThanOrEqualTo': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsGreaterThan': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsGreaterThanOrEqualTo': makeChildAppender(WFS.writeComparisonFilter_),
|
||||
'PropertyIsNull': makeChildAppender(WFS.writeIsNullFilter_),
|
||||
'PropertyIsBetween': makeChildAppender(WFS.writeIsBetweenFilter_),
|
||||
'PropertyIsLike': makeChildAppender(WFS.writeIsLikeFilter_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -901,7 +903,7 @@ WFS.GETFEATURE_SERIALIZERS_ = {
|
||||
* @api
|
||||
*/
|
||||
WFS.writeFilter = function(filter) {
|
||||
const child = _ol_xml_.createElementNS(WFS.OGCNS, 'Filter');
|
||||
const child = createElementNS(WFS.OGCNS, 'Filter');
|
||||
WFS.writeFilterCondition_(child, filter, []);
|
||||
return child;
|
||||
};
|
||||
@@ -917,9 +919,9 @@ WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
|
||||
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context));
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(item,
|
||||
pushSerializeAndPop(item,
|
||||
WFS.GETFEATURE_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Query'), featureTypes,
|
||||
makeSimpleNodeFactory('Query'), featureTypes,
|
||||
objectStack);
|
||||
};
|
||||
|
||||
@@ -932,7 +934,7 @@ WFS.writeGetFeature_ = function(node, featureTypes, objectStack) {
|
||||
* @api
|
||||
*/
|
||||
WFS.prototype.writeGetFeature = function(options) {
|
||||
const node = _ol_xml_.createElementNS(WFS.WFSNS, 'GetFeature');
|
||||
const node = createElementNS(WFS.WFSNS, 'GetFeature');
|
||||
node.setAttribute('service', 'WFS');
|
||||
node.setAttribute('version', '1.1.0');
|
||||
let filter;
|
||||
@@ -969,7 +971,7 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', this.schemaLocation_);
|
||||
/** @type {ol.XmlNodeStackItem} */
|
||||
const context = {
|
||||
@@ -1001,7 +1003,7 @@ WFS.prototype.writeGetFeature = function(options) {
|
||||
WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
options) {
|
||||
const objectStack = [];
|
||||
const node = _ol_xml_.createElementNS(WFS.WFSNS, 'Transaction');
|
||||
const node = createElementNS(WFS.WFSNS, 'Transaction');
|
||||
const version = options.version ?
|
||||
options.version : WFS.DEFAULT_VERSION;
|
||||
const gmlVersion = version === '1.0.0' ? 2 : 3;
|
||||
@@ -1017,7 +1019,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
}
|
||||
}
|
||||
const schemaLocation = WFS.SCHEMA_LOCATIONS[version];
|
||||
_ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', schemaLocation);
|
||||
const featurePrefix = options.featurePrefix ? options.featurePrefix : WFS.FEATURE_PREFIX;
|
||||
if (inserts) {
|
||||
@@ -1025,9 +1027,9 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||
assign(obj, baseObj);
|
||||
_ol_xml_.pushSerializeAndPop(obj,
|
||||
pushSerializeAndPop(obj,
|
||||
WFS.TRANSACTION_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Insert'), inserts,
|
||||
makeSimpleNodeFactory('Insert'), inserts,
|
||||
objectStack);
|
||||
}
|
||||
if (updates) {
|
||||
@@ -1035,25 +1037,25 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes,
|
||||
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||
'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName};
|
||||
assign(obj, baseObj);
|
||||
_ol_xml_.pushSerializeAndPop(obj,
|
||||
pushSerializeAndPop(obj,
|
||||
WFS.TRANSACTION_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Update'), updates,
|
||||
makeSimpleNodeFactory('Update'), updates,
|
||||
objectStack);
|
||||
}
|
||||
if (deletes) {
|
||||
_ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||
pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
||||
WFS.TRANSACTION_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Delete'), deletes,
|
||||
makeSimpleNodeFactory('Delete'), deletes,
|
||||
objectStack);
|
||||
}
|
||||
if (options.nativeElements) {
|
||||
_ol_xml_.pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||
pushSerializeAndPop({node: node, 'featureNS': options.featureNS,
|
||||
'featureType': options.featureType, 'featurePrefix': featurePrefix,
|
||||
'gmlVersion': gmlVersion, 'srsName': options.srsName},
|
||||
WFS.TRANSACTION_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('Native'), options.nativeElements,
|
||||
makeSimpleNodeFactory('Native'), options.nativeElements,
|
||||
objectStack);
|
||||
}
|
||||
return node;
|
||||
|
||||
@@ -5,7 +5,8 @@ import {inherits} from '../index.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {makeArrayPusher, makeObjectPropertyPusher, makeObjectPropertySetter,
|
||||
makeStructureNS, pushParseAndPop} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -57,7 +58,7 @@ WMSCapabilities.prototype.readFromDocument = function(doc) {
|
||||
*/
|
||||
WMSCapabilities.prototype.readFromNode = function(node) {
|
||||
this.version = node.getAttribute('version').trim();
|
||||
const wmsCapabilityObject = _ol_xml_.pushParseAndPop({
|
||||
const wmsCapabilityObject = pushParseAndPop({
|
||||
'version': this.version
|
||||
}, WMSCapabilities.PARSERS_, node, []);
|
||||
return wmsCapabilityObject ? wmsCapabilityObject : null;
|
||||
@@ -71,7 +72,7 @@ WMSCapabilities.prototype.readFromNode = function(node) {
|
||||
* @return {Object|undefined} Attribution object.
|
||||
*/
|
||||
WMSCapabilities.readAttribution_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.ATTRIBUTION_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -110,7 +111,7 @@ WMSCapabilities.readBoundingBox_ = function(node, objectStack) {
|
||||
* @return {ol.Extent|undefined} Bounding box object.
|
||||
*/
|
||||
WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
|
||||
const geographicBoundingBox = _ol_xml_.pushParseAndPop(
|
||||
const geographicBoundingBox = pushParseAndPop(
|
||||
{},
|
||||
WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_,
|
||||
node, objectStack);
|
||||
@@ -143,7 +144,7 @@ WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Capability object.
|
||||
*/
|
||||
WMSCapabilities.readCapability_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.CAPABILITY_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -155,7 +156,7 @@ WMSCapabilities.readCapability_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Service object.
|
||||
*/
|
||||
WMSCapabilities.readService_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.SERVICE_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -167,7 +168,7 @@ WMSCapabilities.readService_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Contact information object.
|
||||
*/
|
||||
WMSCapabilities.readContactInformation_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.CONTACT_INFORMATION_PARSERS_,
|
||||
node, objectStack);
|
||||
};
|
||||
@@ -180,7 +181,7 @@ WMSCapabilities.readContactInformation_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Contact person object.
|
||||
*/
|
||||
WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.CONTACT_PERSON_PARSERS_,
|
||||
node, objectStack);
|
||||
};
|
||||
@@ -193,7 +194,7 @@ WMSCapabilities.readContactPersonPrimary_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Contact address object.
|
||||
*/
|
||||
WMSCapabilities.readContactAddress_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.CONTACT_ADDRESS_PARSERS_,
|
||||
node, objectStack);
|
||||
};
|
||||
@@ -206,7 +207,7 @@ WMSCapabilities.readContactAddress_ = function(node, objectStack) {
|
||||
* @return {Array.<string>|undefined} Format array.
|
||||
*/
|
||||
WMSCapabilities.readException_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
[], WMSCapabilities.EXCEPTION_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -218,7 +219,7 @@ WMSCapabilities.readException_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Layer object.
|
||||
*/
|
||||
WMSCapabilities.readCapabilityLayer_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -233,7 +234,7 @@ WMSCapabilities.readLayer_ = function(node, objectStack) {
|
||||
const parentLayerObject = /** @type {Object.<string,*>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
|
||||
const layerObject = _ol_xml_.pushParseAndPop(
|
||||
const layerObject = pushParseAndPop(
|
||||
{}, WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||
|
||||
if (!layerObject) {
|
||||
@@ -332,7 +333,7 @@ WMSCapabilities.readDimension_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Online resource object.
|
||||
*/
|
||||
WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_,
|
||||
node, objectStack);
|
||||
};
|
||||
@@ -345,7 +346,7 @@ WMSCapabilities.readFormatOnlineresource_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Request object.
|
||||
*/
|
||||
WMSCapabilities.readRequest_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.REQUEST_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -357,7 +358,7 @@ WMSCapabilities.readRequest_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} DCP type object.
|
||||
*/
|
||||
WMSCapabilities.readDCPType_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.DCPTYPE_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -369,7 +370,7 @@ WMSCapabilities.readDCPType_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} HTTP object.
|
||||
*/
|
||||
WMSCapabilities.readHTTP_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.HTTP_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -381,7 +382,7 @@ WMSCapabilities.readHTTP_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Operation type object.
|
||||
*/
|
||||
WMSCapabilities.readOperationType_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.OPERATIONTYPE_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -448,7 +449,7 @@ WMSCapabilities.readMetadataURL_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Style object.
|
||||
*/
|
||||
WMSCapabilities.readStyle_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
{}, WMSCapabilities.STYLE_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -460,7 +461,7 @@ WMSCapabilities.readStyle_ = function(node, objectStack) {
|
||||
* @return {Array.<string>|undefined} Keyword list.
|
||||
*/
|
||||
WMSCapabilities.readKeywordList_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop(
|
||||
return pushParseAndPop(
|
||||
[], WMSCapabilities.KEYWORDLIST_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -481,11 +482,11 @@ WMSCapabilities.NAMESPACE_URIS_ = [
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Service': _ol_xml_.makeObjectPropertySetter(
|
||||
'Service': makeObjectPropertySetter(
|
||||
WMSCapabilities.readService_),
|
||||
'Capability': _ol_xml_.makeObjectPropertySetter(
|
||||
'Capability': makeObjectPropertySetter(
|
||||
WMSCapabilities.readCapability_)
|
||||
});
|
||||
|
||||
@@ -495,13 +496,13 @@ WMSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.CAPABILITY_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Request': _ol_xml_.makeObjectPropertySetter(
|
||||
'Request': makeObjectPropertySetter(
|
||||
WMSCapabilities.readRequest_),
|
||||
'Exception': _ol_xml_.makeObjectPropertySetter(
|
||||
'Exception': makeObjectPropertySetter(
|
||||
WMSCapabilities.readException_),
|
||||
'Layer': _ol_xml_.makeObjectPropertySetter(
|
||||
'Layer': makeObjectPropertySetter(
|
||||
WMSCapabilities.readCapabilityLayer_)
|
||||
});
|
||||
|
||||
@@ -511,25 +512,25 @@ WMSCapabilities.CAPABILITY_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.SERVICE_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'KeywordList': _ol_xml_.makeObjectPropertySetter(
|
||||
'Name': makeObjectPropertySetter(XSD.readString),
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': makeObjectPropertySetter(XSD.readString),
|
||||
'KeywordList': makeObjectPropertySetter(
|
||||
WMSCapabilities.readKeywordList_),
|
||||
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
|
||||
'OnlineResource': makeObjectPropertySetter(
|
||||
XLink.readHref),
|
||||
'ContactInformation': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactInformation': makeObjectPropertySetter(
|
||||
WMSCapabilities.readContactInformation_),
|
||||
'Fees': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'AccessConstraints': _ol_xml_.makeObjectPropertySetter(
|
||||
'Fees': makeObjectPropertySetter(XSD.readString),
|
||||
'AccessConstraints': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'LayerLimit': _ol_xml_.makeObjectPropertySetter(
|
||||
'LayerLimit': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MaxWidth': _ol_xml_.makeObjectPropertySetter(
|
||||
'MaxWidth': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MaxHeight': _ol_xml_.makeObjectPropertySetter(
|
||||
'MaxHeight': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger)
|
||||
});
|
||||
|
||||
@@ -539,19 +540,19 @@ WMSCapabilities.SERVICE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'ContactPersonPrimary': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactPersonPrimary': makeObjectPropertySetter(
|
||||
WMSCapabilities.readContactPersonPrimary_),
|
||||
'ContactPosition': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactPosition': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'ContactAddress': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactAddress': makeObjectPropertySetter(
|
||||
WMSCapabilities.readContactAddress_),
|
||||
'ContactVoiceTelephone': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactVoiceTelephone': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'ContactFacsimileTelephone': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactFacsimileTelephone': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'ContactElectronicMailAddress': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactElectronicMailAddress': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
});
|
||||
|
||||
@@ -561,11 +562,11 @@ WMSCapabilities.CONTACT_INFORMATION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.CONTACT_PERSON_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'ContactPerson': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactPerson': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'ContactOrganization': _ol_xml_.makeObjectPropertySetter(
|
||||
'ContactOrganization': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
});
|
||||
|
||||
@@ -575,15 +576,15 @@ WMSCapabilities.CONTACT_PERSON_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'AddressType': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Address': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'City': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'StateOrProvince': _ol_xml_.makeObjectPropertySetter(
|
||||
'AddressType': makeObjectPropertySetter(XSD.readString),
|
||||
'Address': makeObjectPropertySetter(XSD.readString),
|
||||
'City': makeObjectPropertySetter(XSD.readString),
|
||||
'StateOrProvince': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'PostCode': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Country': _ol_xml_.makeObjectPropertySetter(XSD.readString)
|
||||
'PostCode': makeObjectPropertySetter(XSD.readString),
|
||||
'Country': makeObjectPropertySetter(XSD.readString)
|
||||
});
|
||||
|
||||
|
||||
@@ -592,9 +593,9 @@ WMSCapabilities.CONTACT_ADDRESS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.EXCEPTION_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Format': _ol_xml_.makeArrayPusher(XSD.readString)
|
||||
'Format': makeArrayPusher(XSD.readString)
|
||||
});
|
||||
|
||||
|
||||
@@ -603,38 +604,38 @@ WMSCapabilities.EXCEPTION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.LAYER_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'KeywordList': _ol_xml_.makeObjectPropertySetter(
|
||||
'Name': makeObjectPropertySetter(XSD.readString),
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': makeObjectPropertySetter(XSD.readString),
|
||||
'KeywordList': makeObjectPropertySetter(
|
||||
WMSCapabilities.readKeywordList_),
|
||||
'CRS': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
|
||||
'EX_GeographicBoundingBox': _ol_xml_.makeObjectPropertySetter(
|
||||
'CRS': makeObjectPropertyPusher(XSD.readString),
|
||||
'EX_GeographicBoundingBox': makeObjectPropertySetter(
|
||||
WMSCapabilities.readEXGeographicBoundingBox_),
|
||||
'BoundingBox': _ol_xml_.makeObjectPropertyPusher(
|
||||
'BoundingBox': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readBoundingBox_),
|
||||
'Dimension': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Dimension': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readDimension_),
|
||||
'Attribution': _ol_xml_.makeObjectPropertySetter(
|
||||
'Attribution': makeObjectPropertySetter(
|
||||
WMSCapabilities.readAttribution_),
|
||||
'AuthorityURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'AuthorityURL': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readAuthorityURL_),
|
||||
'Identifier': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
|
||||
'MetadataURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Identifier': makeObjectPropertyPusher(XSD.readString),
|
||||
'MetadataURL': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readMetadataURL_),
|
||||
'DataURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'DataURL': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readFormatOnlineresource_),
|
||||
'FeatureListURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'FeatureListURL': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readFormatOnlineresource_),
|
||||
'Style': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Style': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readStyle_),
|
||||
'MinScaleDenominator': _ol_xml_.makeObjectPropertySetter(
|
||||
'MinScaleDenominator': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'MaxScaleDenominator': _ol_xml_.makeObjectPropertySetter(
|
||||
'MaxScaleDenominator': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'Layer': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Layer': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readLayer_)
|
||||
});
|
||||
|
||||
@@ -644,12 +645,12 @@ WMSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.ATTRIBUTION_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': makeObjectPropertySetter(
|
||||
XLink.readHref),
|
||||
'LogoURL': _ol_xml_.makeObjectPropertySetter(
|
||||
'LogoURL': makeObjectPropertySetter(
|
||||
WMSCapabilities.readSizedFormatOnlineresource_)
|
||||
});
|
||||
|
||||
@@ -660,14 +661,14 @@ WMSCapabilities.ATTRIBUTION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
|
||||
_ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'westBoundLongitude': _ol_xml_.makeObjectPropertySetter(
|
||||
makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'westBoundLongitude': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'eastBoundLongitude': _ol_xml_.makeObjectPropertySetter(
|
||||
'eastBoundLongitude': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'southBoundLatitude': _ol_xml_.makeObjectPropertySetter(
|
||||
'southBoundLatitude': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'northBoundLatitude': _ol_xml_.makeObjectPropertySetter(
|
||||
'northBoundLatitude': makeObjectPropertySetter(
|
||||
XSD.readDecimal)
|
||||
});
|
||||
|
||||
@@ -677,13 +678,13 @@ WMSCapabilities.EX_GEOGRAPHIC_BOUNDING_BOX_PARSERS_ =
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.REQUEST_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'GetCapabilities': _ol_xml_.makeObjectPropertySetter(
|
||||
'GetCapabilities': makeObjectPropertySetter(
|
||||
WMSCapabilities.readOperationType_),
|
||||
'GetMap': _ol_xml_.makeObjectPropertySetter(
|
||||
'GetMap': makeObjectPropertySetter(
|
||||
WMSCapabilities.readOperationType_),
|
||||
'GetFeatureInfo': _ol_xml_.makeObjectPropertySetter(
|
||||
'GetFeatureInfo': makeObjectPropertySetter(
|
||||
WMSCapabilities.readOperationType_)
|
||||
});
|
||||
|
||||
@@ -693,10 +694,10 @@ WMSCapabilities.REQUEST_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.OPERATIONTYPE_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Format': _ol_xml_.makeObjectPropertyPusher(XSD.readString),
|
||||
'DCPType': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Format': makeObjectPropertyPusher(XSD.readString),
|
||||
'DCPType': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readDCPType_)
|
||||
});
|
||||
|
||||
@@ -706,9 +707,9 @@ WMSCapabilities.OPERATIONTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.DCPTYPE_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'HTTP': _ol_xml_.makeObjectPropertySetter(
|
||||
'HTTP': makeObjectPropertySetter(
|
||||
WMSCapabilities.readHTTP_)
|
||||
});
|
||||
|
||||
@@ -718,11 +719,11 @@ WMSCapabilities.DCPTYPE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.HTTP_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Get': _ol_xml_.makeObjectPropertySetter(
|
||||
'Get': makeObjectPropertySetter(
|
||||
WMSCapabilities.readFormatOnlineresource_),
|
||||
'Post': _ol_xml_.makeObjectPropertySetter(
|
||||
'Post': makeObjectPropertySetter(
|
||||
WMSCapabilities.readFormatOnlineresource_)
|
||||
});
|
||||
|
||||
@@ -732,16 +733,16 @@ WMSCapabilities.HTTP_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.STYLE_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Name': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Name': makeObjectPropertySetter(XSD.readString),
|
||||
'Title': makeObjectPropertySetter(XSD.readString),
|
||||
'Abstract': makeObjectPropertySetter(XSD.readString),
|
||||
'LegendURL': makeObjectPropertyPusher(
|
||||
WMSCapabilities.readSizedFormatOnlineresource_),
|
||||
'StyleSheetURL': _ol_xml_.makeObjectPropertySetter(
|
||||
'StyleSheetURL': makeObjectPropertySetter(
|
||||
WMSCapabilities.readFormatOnlineresource_),
|
||||
'StyleURL': _ol_xml_.makeObjectPropertySetter(
|
||||
'StyleURL': makeObjectPropertySetter(
|
||||
WMSCapabilities.readFormatOnlineresource_)
|
||||
});
|
||||
|
||||
@@ -752,9 +753,9 @@ WMSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
|
||||
_ol_xml_.makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Format': _ol_xml_.makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': _ol_xml_.makeObjectPropertySetter(
|
||||
makeStructureNS(WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Format': makeObjectPropertySetter(XSD.readString),
|
||||
'OnlineResource': makeObjectPropertySetter(
|
||||
XLink.readHref)
|
||||
});
|
||||
|
||||
@@ -764,8 +765,8 @@ WMSCapabilities.FORMAT_ONLINERESOURCE_PARSERS_ =
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMSCapabilities.KEYWORDLIST_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMSCapabilities.KEYWORDLIST_PARSERS_ = makeStructureNS(
|
||||
WMSCapabilities.NAMESPACE_URIS_, {
|
||||
'Keyword': _ol_xml_.makeArrayPusher(XSD.readString)
|
||||
'Keyword': makeArrayPusher(XSD.readString)
|
||||
});
|
||||
export default WMSCapabilities;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {extend, includes} from '../array.js';
|
||||
import GML2 from '../format/GML2.js';
|
||||
import XMLFeature from '../format/XMLFeature.js';
|
||||
import {assign} from '../obj.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {makeArrayPusher, makeStructureNS, pushParseAndPop} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -116,12 +116,12 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
|
||||
context['featureNS'] = this.featureNS_;
|
||||
|
||||
const parsers = {};
|
||||
parsers[featureType] = _ol_xml_.makeArrayPusher(
|
||||
parsers[featureType] = makeArrayPusher(
|
||||
this.gmlFormat_.readFeatureElement, this.gmlFormat_);
|
||||
const parsersNS = _ol_xml_.makeStructureNS(
|
||||
const parsersNS = makeStructureNS(
|
||||
[context['featureNS'], null], parsers);
|
||||
layer.setAttribute('namespaceURI', this.featureNS_);
|
||||
const layerFeatures = _ol_xml_.pushParseAndPop(
|
||||
const layerFeatures = pushParseAndPop(
|
||||
[], parsersNS, layer, objectStack, this.gmlFormat_);
|
||||
if (layerFeatures) {
|
||||
extend(features, layerFeatures);
|
||||
@@ -129,7 +129,7 @@ WMSGetFeatureInfo.prototype.readFeatures_ = function(node, objectStack) {
|
||||
}
|
||||
}
|
||||
if (localName == 'FeatureCollection') {
|
||||
const gmlFeatures = _ol_xml_.pushParseAndPop([],
|
||||
const gmlFeatures = pushParseAndPop([],
|
||||
this.gmlFormat_.FEATURE_COLLECTION_PARSERS, node,
|
||||
[{}], this.gmlFormat_);
|
||||
if (gmlFeatures) {
|
||||
|
||||
@@ -7,7 +7,8 @@ import OWS from '../format/OWS.js';
|
||||
import XLink from '../format/XLink.js';
|
||||
import XML from '../format/XML.js';
|
||||
import XSD from '../format/XSD.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {pushParseAndPop, makeStructureNS,
|
||||
makeObjectPropertySetter, makeObjectPropertyPusher, makeArrayPusher} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -64,7 +65,7 @@ WMTSCapabilities.prototype.readFromNode = function(node) {
|
||||
return null;
|
||||
}
|
||||
WMTSCapabilityObject['version'] = version;
|
||||
WMTSCapabilityObject = _ol_xml_.pushParseAndPop(WMTSCapabilityObject,
|
||||
WMTSCapabilityObject = pushParseAndPop(WMTSCapabilityObject,
|
||||
WMTSCapabilities.PARSERS_, node, []);
|
||||
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
|
||||
};
|
||||
@@ -77,7 +78,7 @@ WMTSCapabilities.prototype.readFromNode = function(node) {
|
||||
* @return {Object|undefined} Attribution object.
|
||||
*/
|
||||
WMTSCapabilities.readContents_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -89,7 +90,7 @@ WMTSCapabilities.readContents_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Layers object.
|
||||
*/
|
||||
WMTSCapabilities.readLayer_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -101,7 +102,7 @@ WMTSCapabilities.readLayer_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Tile Matrix Set object.
|
||||
*/
|
||||
WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.TMS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -113,7 +114,7 @@ WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} Style object.
|
||||
*/
|
||||
WMTSCapabilities.readStyle_ = function(node, objectStack) {
|
||||
const style = _ol_xml_.pushParseAndPop({},
|
||||
const style = pushParseAndPop({},
|
||||
WMTSCapabilities.STYLE_PARSERS_, node, objectStack);
|
||||
if (!style) {
|
||||
return undefined;
|
||||
@@ -133,7 +134,7 @@ WMTSCapabilities.readStyle_ = function(node, objectStack) {
|
||||
*/
|
||||
WMTSCapabilities.readTileMatrixSetLink_ = function(node,
|
||||
objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.TMS_LINKS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -145,7 +146,7 @@ WMTSCapabilities.readTileMatrixSetLink_ = function(node,
|
||||
* @return {Object|undefined} Dimension object.
|
||||
*/
|
||||
WMTSCapabilities.readDimensions_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.DIMENSION_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -181,7 +182,7 @@ WMTSCapabilities.readResourceUrl_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} WGS84 BBox object.
|
||||
*/
|
||||
WMTSCapabilities.readWgs84BoundingBox_ = function(node, objectStack) {
|
||||
const coordinates = _ol_xml_.pushParseAndPop([],
|
||||
const coordinates = pushParseAndPop([],
|
||||
WMTSCapabilities.WGS84_BBOX_READERS_, node, objectStack);
|
||||
if (coordinates.length != 2) {
|
||||
return undefined;
|
||||
@@ -231,7 +232,7 @@ WMTSCapabilities.readCoordinates_ = function(node, objectStack) {
|
||||
* @return {Object|undefined} TileMatrix object.
|
||||
*/
|
||||
WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.TM_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -244,7 +245,7 @@ WMTSCapabilities.readTileMatrix_ = function(node, objectStack) {
|
||||
*/
|
||||
WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
|
||||
objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([],
|
||||
return pushParseAndPop([],
|
||||
WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_, node,
|
||||
objectStack);
|
||||
};
|
||||
@@ -257,7 +258,7 @@ WMTSCapabilities.readTileMatrixLimitsList_ = function(node,
|
||||
* @return {Object|undefined} TileMatrixLimits Array.
|
||||
*/
|
||||
WMTSCapabilities.readTileMatrixLimits_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop({},
|
||||
return pushParseAndPop({},
|
||||
WMTSCapabilities.TMS_LIMITS_PARSERS_, node, objectStack);
|
||||
};
|
||||
|
||||
@@ -289,9 +290,9 @@ WMTSCapabilities.OWS_NAMESPACE_URIS_ = [
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'Contents': _ol_xml_.makeObjectPropertySetter(
|
||||
'Contents': makeObjectPropertySetter(
|
||||
WMTSCapabilities.readContents_)
|
||||
});
|
||||
|
||||
@@ -301,11 +302,11 @@ WMTSCapabilities.PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.CONTENTS_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'Layer': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Layer': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readLayer_),
|
||||
'TileMatrixSet': _ol_xml_.makeObjectPropertyPusher(
|
||||
'TileMatrixSet': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readTileMatrixSet_)
|
||||
});
|
||||
|
||||
@@ -315,26 +316,26 @@ WMTSCapabilities.CONTENTS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.LAYER_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'Style': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Style': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readStyle_),
|
||||
'Format': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Format': makeObjectPropertyPusher(
|
||||
XSD.readString),
|
||||
'TileMatrixSetLink': _ol_xml_.makeObjectPropertyPusher(
|
||||
'TileMatrixSetLink': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readTileMatrixSetLink_),
|
||||
'Dimension': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Dimension': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readDimensions_),
|
||||
'ResourceURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'ResourceURL': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readResourceUrl_)
|
||||
}, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(
|
||||
}, makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Title': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'Abstract': _ol_xml_.makeObjectPropertySetter(
|
||||
'Abstract': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'WGS84BoundingBox': _ol_xml_.makeObjectPropertySetter(
|
||||
'WGS84BoundingBox': makeObjectPropertySetter(
|
||||
WMTSCapabilities.readWgs84BoundingBox_),
|
||||
'Identifier': _ol_xml_.makeObjectPropertySetter(
|
||||
'Identifier': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
}));
|
||||
|
||||
@@ -344,14 +345,14 @@ WMTSCapabilities.LAYER_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.STYLE_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'LegendURL': _ol_xml_.makeObjectPropertyPusher(
|
||||
'LegendURL': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readLegendUrl_)
|
||||
}, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Title': _ol_xml_.makeObjectPropertySetter(
|
||||
}, makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Title': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'Identifier': _ol_xml_.makeObjectPropertySetter(
|
||||
'Identifier': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
}));
|
||||
|
||||
@@ -361,11 +362,11 @@ WMTSCapabilities.STYLE_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.TMS_LINKS_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'TileMatrixSet': _ol_xml_.makeObjectPropertySetter(
|
||||
'TileMatrixSet': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'TileMatrixSetLimits': _ol_xml_.makeObjectPropertySetter(
|
||||
'TileMatrixSetLimits': makeObjectPropertySetter(
|
||||
WMTSCapabilities.readTileMatrixLimitsList_)
|
||||
});
|
||||
|
||||
@@ -374,9 +375,9 @@ WMTSCapabilities.TMS_LINKS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'TileMatrixLimits': _ol_xml_.makeArrayPusher(
|
||||
'TileMatrixLimits': makeArrayPusher(
|
||||
WMTSCapabilities.readTileMatrixLimits_)
|
||||
});
|
||||
|
||||
@@ -386,17 +387,17 @@ WMTSCapabilities.TMS_LIMITS_LIST_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.TMS_LIMITS_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'TileMatrix': _ol_xml_.makeObjectPropertySetter(
|
||||
'TileMatrix': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'MinTileRow': _ol_xml_.makeObjectPropertySetter(
|
||||
'MinTileRow': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MaxTileRow': _ol_xml_.makeObjectPropertySetter(
|
||||
'MaxTileRow': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MinTileCol': _ol_xml_.makeObjectPropertySetter(
|
||||
'MinTileCol': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MaxTileCol': _ol_xml_.makeObjectPropertySetter(
|
||||
'MaxTileCol': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger)
|
||||
});
|
||||
|
||||
@@ -406,14 +407,14 @@ WMTSCapabilities.TMS_LIMITS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.DIMENSION_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'Default': _ol_xml_.makeObjectPropertySetter(
|
||||
'Default': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'Value': _ol_xml_.makeObjectPropertyPusher(
|
||||
'Value': makeObjectPropertyPusher(
|
||||
XSD.readString)
|
||||
}, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Identifier': _ol_xml_.makeObjectPropertySetter(
|
||||
}, makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Identifier': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
}));
|
||||
|
||||
@@ -423,11 +424,11 @@ WMTSCapabilities.DIMENSION_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.WGS84_BBOX_READERS_ = makeStructureNS(
|
||||
WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'LowerCorner': _ol_xml_.makeArrayPusher(
|
||||
'LowerCorner': makeArrayPusher(
|
||||
WMTSCapabilities.readCoordinates_),
|
||||
'UpperCorner': _ol_xml_.makeArrayPusher(
|
||||
'UpperCorner': makeArrayPusher(
|
||||
WMTSCapabilities.readCoordinates_)
|
||||
});
|
||||
|
||||
@@ -437,16 +438,16 @@ WMTSCapabilities.WGS84_BBOX_READERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.TMS_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'WellKnownScaleSet': _ol_xml_.makeObjectPropertySetter(
|
||||
'WellKnownScaleSet': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'TileMatrix': _ol_xml_.makeObjectPropertyPusher(
|
||||
'TileMatrix': makeObjectPropertyPusher(
|
||||
WMTSCapabilities.readTileMatrix_)
|
||||
}, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'SupportedCRS': _ol_xml_.makeObjectPropertySetter(
|
||||
}, makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'SupportedCRS': makeObjectPropertySetter(
|
||||
XSD.readString),
|
||||
'Identifier': _ol_xml_.makeObjectPropertySetter(
|
||||
'Identifier': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
}));
|
||||
|
||||
@@ -456,22 +457,22 @@ WMTSCapabilities.TMS_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
* @type {Object.<string, Object.<string, ol.XmlParser>>}
|
||||
* @private
|
||||
*/
|
||||
WMTSCapabilities.TM_PARSERS_ = _ol_xml_.makeStructureNS(
|
||||
WMTSCapabilities.TM_PARSERS_ = makeStructureNS(
|
||||
WMTSCapabilities.NAMESPACE_URIS_, {
|
||||
'TopLeftCorner': _ol_xml_.makeObjectPropertySetter(
|
||||
'TopLeftCorner': makeObjectPropertySetter(
|
||||
WMTSCapabilities.readCoordinates_),
|
||||
'ScaleDenominator': _ol_xml_.makeObjectPropertySetter(
|
||||
'ScaleDenominator': makeObjectPropertySetter(
|
||||
XSD.readDecimal),
|
||||
'TileWidth': _ol_xml_.makeObjectPropertySetter(
|
||||
'TileWidth': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'TileHeight': _ol_xml_.makeObjectPropertySetter(
|
||||
'TileHeight': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MatrixWidth': _ol_xml_.makeObjectPropertySetter(
|
||||
'MatrixWidth': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger),
|
||||
'MatrixHeight': _ol_xml_.makeObjectPropertySetter(
|
||||
'MatrixHeight': makeObjectPropertySetter(
|
||||
XSD.readNonNegativeInteger)
|
||||
}, _ol_xml_.makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Identifier': _ol_xml_.makeObjectPropertySetter(
|
||||
}, makeStructureNS(WMTSCapabilities.OWS_NAMESPACE_URIS_, {
|
||||
'Identifier': makeObjectPropertySetter(
|
||||
XSD.readString)
|
||||
}));
|
||||
export default WMTSCapabilities;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/format/XML
|
||||
*/
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {isDocument, isNode, parse} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -20,12 +20,12 @@ const XML = function() {
|
||||
* @return {Object} The parsed result.
|
||||
*/
|
||||
XML.prototype.read = function(source) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readFromDocument(/** @type {Document} */ (source));
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readFromNode(/** @type {Node} */ (source));
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readFromDocument(doc);
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {inherits} from '../index.js';
|
||||
import {extend} from '../array.js';
|
||||
import FeatureFormat from '../format/Feature.js';
|
||||
import FormatType from '../format/FormatType.js';
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {isDocument, isNode, parse} from '../xml.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -43,13 +43,13 @@ XMLFeature.prototype.getType = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
XMLFeature.prototype.readFeature = function(source, opt_options) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readFeatureFromDocument(
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readFeatureFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readFeatureFromDocument(doc, opt_options);
|
||||
} else {
|
||||
return null;
|
||||
@@ -87,13 +87,13 @@ XMLFeature.prototype.readFeatureFromNode = function(node, opt_options) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
XMLFeature.prototype.readFeatures = function(source, opt_options) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readFeaturesFromDocument(
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readFeaturesFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readFeaturesFromDocument(doc, opt_options);
|
||||
} else {
|
||||
return [];
|
||||
@@ -135,13 +135,13 @@ XMLFeature.prototype.readFeaturesFromNode = function(node, opt_options) {};
|
||||
* @inheritDoc
|
||||
*/
|
||||
XMLFeature.prototype.readGeometry = function(source, opt_options) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readGeometryFromDocument(
|
||||
/** @type {Document} */ (source), opt_options);
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readGeometryFromNode(/** @type {Node} */ (source), opt_options);
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readGeometryFromDocument(doc, opt_options);
|
||||
} else {
|
||||
return null;
|
||||
@@ -175,12 +175,12 @@ XMLFeature.prototype.readGeometryFromNode = function(node, opt_options) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
XMLFeature.prototype.readProjection = function(source) {
|
||||
if (_ol_xml_.isDocument(source)) {
|
||||
if (isDocument(source)) {
|
||||
return this.readProjectionFromDocument(/** @type {Document} */ (source));
|
||||
} else if (_ol_xml_.isNode(source)) {
|
||||
} else if (isNode(source)) {
|
||||
return this.readProjectionFromNode(/** @type {Node} */ (source));
|
||||
} else if (typeof source === 'string') {
|
||||
const doc = _ol_xml_.parse(source);
|
||||
const doc = parse(source);
|
||||
return this.readProjectionFromDocument(doc);
|
||||
} else {
|
||||
return null;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* @module ol/format/XSD
|
||||
*/
|
||||
import _ol_xml_ from '../xml.js';
|
||||
import {getAllTextContent, DOCUMENT} from '../xml.js';
|
||||
import {padNumber} from '../string.js';
|
||||
const XSD = {};
|
||||
|
||||
@@ -11,7 +11,7 @@ const XSD = {};
|
||||
* @return {boolean|undefined} Boolean.
|
||||
*/
|
||||
XSD.readBoolean = function(node) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false);
|
||||
const s = getAllTextContent(node, false);
|
||||
return XSD.readBooleanString(s);
|
||||
};
|
||||
|
||||
@@ -35,7 +35,7 @@ XSD.readBooleanString = function(string) {
|
||||
* @return {number|undefined} DateTime in seconds.
|
||||
*/
|
||||
XSD.readDateTime = function(node) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false);
|
||||
const s = getAllTextContent(node, false);
|
||||
const dateTime = Date.parse(s);
|
||||
return isNaN(dateTime) ? undefined : dateTime / 1000;
|
||||
};
|
||||
@@ -46,7 +46,7 @@ XSD.readDateTime = function(node) {
|
||||
* @return {number|undefined} Decimal.
|
||||
*/
|
||||
XSD.readDecimal = function(node) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false);
|
||||
const s = getAllTextContent(node, false);
|
||||
return XSD.readDecimalString(s);
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ XSD.readDecimalString = function(string) {
|
||||
* @return {number|undefined} Non negative integer.
|
||||
*/
|
||||
XSD.readNonNegativeInteger = function(node) {
|
||||
const s = _ol_xml_.getAllTextContent(node, false);
|
||||
const s = getAllTextContent(node, false);
|
||||
return XSD.readNonNegativeIntegerString(s);
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ XSD.readNonNegativeIntegerString = function(string) {
|
||||
* @return {string|undefined} String.
|
||||
*/
|
||||
XSD.readString = function(node) {
|
||||
return _ol_xml_.getAllTextContent(node, false).trim();
|
||||
return getAllTextContent(node, false).trim();
|
||||
};
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ XSD.writeBooleanTextNode = function(node, bool) {
|
||||
* @param {string} string String.
|
||||
*/
|
||||
XSD.writeCDATASection = function(node, string) {
|
||||
node.appendChild(_ol_xml_.DOCUMENT.createCDATASection(string));
|
||||
node.appendChild(DOCUMENT.createCDATASection(string));
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ XSD.writeDateTimeTextNode = function(node, dateTime) {
|
||||
padNumber(date.getUTCHours(), 2) + ':' +
|
||||
padNumber(date.getUTCMinutes(), 2) + ':' +
|
||||
padNumber(date.getUTCSeconds(), 2) + 'Z';
|
||||
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
|
||||
node.appendChild(DOCUMENT.createTextNode(string));
|
||||
};
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ XSD.writeDateTimeTextNode = function(node, dateTime) {
|
||||
*/
|
||||
XSD.writeDecimalTextNode = function(node, decimal) {
|
||||
const string = decimal.toPrecision();
|
||||
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
|
||||
node.appendChild(DOCUMENT.createTextNode(string));
|
||||
};
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ XSD.writeDecimalTextNode = function(node, decimal) {
|
||||
*/
|
||||
XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) {
|
||||
const string = nonNegativeInteger.toString();
|
||||
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
|
||||
node.appendChild(DOCUMENT.createTextNode(string));
|
||||
};
|
||||
|
||||
|
||||
@@ -158,6 +158,6 @@ XSD.writeNonNegativeIntegerTextNode = function(node, nonNegativeInteger) {
|
||||
* @param {string} string String.
|
||||
*/
|
||||
XSD.writeStringTextNode = function(node, string) {
|
||||
node.appendChild(_ol_xml_.DOCUMENT.createTextNode(string));
|
||||
node.appendChild(DOCUMENT.createTextNode(string));
|
||||
};
|
||||
export default XSD;
|
||||
|
||||
110
src/ol/xml.js
110
src/ol/xml.js
@@ -2,7 +2,6 @@
|
||||
* @module ol/xml
|
||||
*/
|
||||
import {extend} from './array.js';
|
||||
const _ol_xml_ = {};
|
||||
|
||||
|
||||
/**
|
||||
@@ -12,7 +11,7 @@ const _ol_xml_ = {};
|
||||
* @const
|
||||
* @type {Document}
|
||||
*/
|
||||
_ol_xml_.DOCUMENT = document.implementation.createDocument('', '', null);
|
||||
export const DOCUMENT = document.implementation.createDocument('', '', null);
|
||||
|
||||
|
||||
/**
|
||||
@@ -20,9 +19,9 @@ _ol_xml_.DOCUMENT = document.implementation.createDocument('', '', null);
|
||||
* @param {string} qualifiedName Qualified name.
|
||||
* @return {Node} Node.
|
||||
*/
|
||||
_ol_xml_.createElementNS = function(namespaceURI, qualifiedName) {
|
||||
return _ol_xml_.DOCUMENT.createElementNS(namespaceURI, qualifiedName);
|
||||
};
|
||||
export function createElementNS(namespaceURI, qualifiedName) {
|
||||
return DOCUMENT.createElementNS(namespaceURI, qualifiedName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -33,9 +32,9 @@ _ol_xml_.createElementNS = function(namespaceURI, qualifiedName) {
|
||||
* @return {string} All text content.
|
||||
* @api
|
||||
*/
|
||||
_ol_xml_.getAllTextContent = function(node, normalizeWhitespace) {
|
||||
return _ol_xml_.getAllTextContent_(node, normalizeWhitespace, []).join('');
|
||||
};
|
||||
export function getAllTextContent(node, normalizeWhitespace) {
|
||||
return getAllTextContent_(node, normalizeWhitespace, []).join('');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,7 +46,7 @@ _ol_xml_.getAllTextContent = function(node, normalizeWhitespace) {
|
||||
* @private
|
||||
* @return {Array.<string>} Accumulator.
|
||||
*/
|
||||
_ol_xml_.getAllTextContent_ = function(node, normalizeWhitespace, accumulator) {
|
||||
export function getAllTextContent_(node, normalizeWhitespace, accumulator) {
|
||||
if (node.nodeType == Node.CDATA_SECTION_NODE ||
|
||||
node.nodeType == Node.TEXT_NODE) {
|
||||
if (normalizeWhitespace) {
|
||||
@@ -58,29 +57,29 @@ _ol_xml_.getAllTextContent_ = function(node, normalizeWhitespace, accumulator) {
|
||||
} else {
|
||||
let n;
|
||||
for (n = node.firstChild; n; n = n.nextSibling) {
|
||||
_ol_xml_.getAllTextContent_(n, normalizeWhitespace, accumulator);
|
||||
getAllTextContent_(n, normalizeWhitespace, accumulator);
|
||||
}
|
||||
}
|
||||
return accumulator;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {?} value Value.
|
||||
* @return {boolean} Is document.
|
||||
*/
|
||||
_ol_xml_.isDocument = function(value) {
|
||||
export function isDocument(value) {
|
||||
return value instanceof Document;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param {?} value Value.
|
||||
* @return {boolean} Is node.
|
||||
*/
|
||||
_ol_xml_.isNode = function(value) {
|
||||
export function isNode(value) {
|
||||
return value instanceof Node;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -89,9 +88,9 @@ _ol_xml_.isNode = function(value) {
|
||||
* @param {string} name Attribute name.
|
||||
* @return {string} Value
|
||||
*/
|
||||
_ol_xml_.getAttributeNS = function(node, namespaceURI, name) {
|
||||
export function getAttributeNS(node, namespaceURI, name) {
|
||||
return node.getAttributeNS(namespaceURI, name) || '';
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -100,9 +99,9 @@ _ol_xml_.getAttributeNS = function(node, namespaceURI, name) {
|
||||
* @param {string} name Attribute name.
|
||||
* @param {string|number} value Value.
|
||||
*/
|
||||
_ol_xml_.setAttributeNS = function(node, namespaceURI, name, value) {
|
||||
export function setAttributeNS(node, namespaceURI, name, value) {
|
||||
node.setAttributeNS(namespaceURI, name, value);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -111,9 +110,9 @@ _ol_xml_.setAttributeNS = function(node, namespaceURI, name, value) {
|
||||
* @return {Document} Document.
|
||||
* @api
|
||||
*/
|
||||
_ol_xml_.parse = function(xml) {
|
||||
export function parse(xml) {
|
||||
return new DOMParser().parseFromString(xml, 'application/xml');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -125,7 +124,7 @@ _ol_xml_.parse = function(xml) {
|
||||
* @return {ol.XmlParser} Parser.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeArrayExtender = function(valueReader, opt_this) {
|
||||
export function makeArrayExtender(valueReader, opt_this) {
|
||||
return (
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
@@ -140,7 +139,7 @@ _ol_xml_.makeArrayExtender = function(valueReader, opt_this) {
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -151,7 +150,7 @@ _ol_xml_.makeArrayExtender = function(valueReader, opt_this) {
|
||||
* @return {ol.XmlParser} Parser.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeArrayPusher = function(valueReader, opt_this) {
|
||||
export function makeArrayPusher(valueReader, opt_this) {
|
||||
return (
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
@@ -165,7 +164,7 @@ _ol_xml_.makeArrayPusher = function(valueReader, opt_this) {
|
||||
array.push(value);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -176,7 +175,7 @@ _ol_xml_.makeArrayPusher = function(valueReader, opt_this) {
|
||||
* @return {ol.XmlParser} Parser.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeReplacer = function(valueReader, opt_this) {
|
||||
export function makeReplacer(valueReader, opt_this) {
|
||||
return (
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
@@ -189,7 +188,7 @@ _ol_xml_.makeReplacer = function(valueReader, opt_this) {
|
||||
objectStack[objectStack.length - 1] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -201,7 +200,7 @@ _ol_xml_.makeReplacer = function(valueReader, opt_this) {
|
||||
* @return {ol.XmlParser} Parser.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeObjectPropertyPusher = function(valueReader, opt_property, opt_this) {
|
||||
export function makeObjectPropertyPusher(valueReader, opt_property, opt_this) {
|
||||
return (
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
@@ -224,7 +223,7 @@ _ol_xml_.makeObjectPropertyPusher = function(valueReader, opt_property, opt_this
|
||||
array.push(value);
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -235,7 +234,7 @@ _ol_xml_.makeObjectPropertyPusher = function(valueReader, opt_property, opt_this
|
||||
* @return {ol.XmlParser} Parser.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeObjectPropertySetter = function(valueReader, opt_property, opt_this) {
|
||||
export function makeObjectPropertySetter(valueReader, opt_property, opt_this) {
|
||||
return (
|
||||
/**
|
||||
* @param {Node} node Node.
|
||||
@@ -252,7 +251,7 @@ _ol_xml_.makeObjectPropertySetter = function(valueReader, opt_property, opt_this
|
||||
object[property] = value;
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -265,7 +264,7 @@ _ol_xml_.makeObjectPropertySetter = function(valueReader, opt_property, opt_this
|
||||
* @return {ol.XmlSerializer} Serializer.
|
||||
* @template T, V
|
||||
*/
|
||||
_ol_xml_.makeChildAppender = function(nodeWriter, opt_this) {
|
||||
export function makeChildAppender(nodeWriter, opt_this) {
|
||||
return function(node, value, objectStack) {
|
||||
nodeWriter.call(opt_this !== undefined ? opt_this : this,
|
||||
node, value, objectStack);
|
||||
@@ -273,7 +272,7 @@ _ol_xml_.makeChildAppender = function(nodeWriter, opt_this) {
|
||||
const parentNode = parent.node;
|
||||
parentNode.appendChild(node);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -289,7 +288,7 @@ _ol_xml_.makeChildAppender = function(nodeWriter, opt_this) {
|
||||
* @return {ol.XmlSerializer} Serializer.
|
||||
* @template T, V
|
||||
*/
|
||||
_ol_xml_.makeArraySerializer = function(nodeWriter, opt_this) {
|
||||
export function makeArraySerializer(nodeWriter, opt_this) {
|
||||
let serializersNS, nodeFactory;
|
||||
return function(node, value, objectStack) {
|
||||
if (serializersNS === undefined) {
|
||||
@@ -297,11 +296,11 @@ _ol_xml_.makeArraySerializer = function(nodeWriter, opt_this) {
|
||||
const serializers = {};
|
||||
serializers[node.localName] = nodeWriter;
|
||||
serializersNS[node.namespaceURI] = serializers;
|
||||
nodeFactory = _ol_xml_.makeSimpleNodeFactory(node.localName);
|
||||
nodeFactory = makeSimpleNodeFactory(node.localName);
|
||||
}
|
||||
_ol_xml_.serialize(serializersNS, nodeFactory, value, objectStack);
|
||||
serialize(serializersNS, nodeFactory, value, objectStack);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -317,7 +316,7 @@ _ol_xml_.makeArraySerializer = function(nodeWriter, opt_this) {
|
||||
* be used.
|
||||
* @return {function(*, Array.<*>, string=): (Node|undefined)} Node factory.
|
||||
*/
|
||||
_ol_xml_.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) {
|
||||
export function makeSimpleNodeFactory(opt_nodeName, opt_namespaceURI) {
|
||||
const fixedNodeName = opt_nodeName;
|
||||
return (
|
||||
/**
|
||||
@@ -337,10 +336,10 @@ _ol_xml_.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) {
|
||||
if (opt_namespaceURI === undefined) {
|
||||
namespaceURI = node.namespaceURI;
|
||||
}
|
||||
return _ol_xml_.createElementNS(namespaceURI, /** @type {string} */ (nodeName));
|
||||
return createElementNS(namespaceURI, /** @type {string} */ (nodeName));
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -350,7 +349,7 @@ _ol_xml_.makeSimpleNodeFactory = function(opt_nodeName, opt_namespaceURI) {
|
||||
* @const
|
||||
* @type {function(*, Array.<*>, string=): (Node|undefined)}
|
||||
*/
|
||||
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY = _ol_xml_.makeSimpleNodeFactory();
|
||||
export const OBJECT_PROPERTY_NODE_FACTORY = makeSimpleNodeFactory();
|
||||
|
||||
|
||||
/**
|
||||
@@ -365,14 +364,14 @@ _ol_xml_.OBJECT_PROPERTY_NODE_FACTORY = _ol_xml_.makeSimpleNodeFactory();
|
||||
* present in `object` will be `undefined` in the resulting array.
|
||||
* @template V
|
||||
*/
|
||||
_ol_xml_.makeSequence = function(object, orderedKeys) {
|
||||
export function makeSequence(object, orderedKeys) {
|
||||
const length = orderedKeys.length;
|
||||
const sequence = new Array(length);
|
||||
for (let i = 0; i < length; ++i) {
|
||||
sequence[i] = object[orderedKeys[i]];
|
||||
}
|
||||
return sequence;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -385,7 +384,7 @@ _ol_xml_.makeSequence = function(object, orderedKeys) {
|
||||
* @return {Object.<string, T>} Namespaced structure.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) {
|
||||
export function makeStructureNS(namespaceURIs, structure, opt_structureNS) {
|
||||
/**
|
||||
* @type {Object.<string, *>}
|
||||
*/
|
||||
@@ -395,7 +394,7 @@ _ol_xml_.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) {
|
||||
structureNS[namespaceURIs[i]] = structure;
|
||||
}
|
||||
return structureNS;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -406,7 +405,7 @@ _ol_xml_.makeStructureNS = function(namespaceURIs, structure, opt_structureNS) {
|
||||
* @param {Array.<*>} objectStack Object stack.
|
||||
* @param {*=} opt_this The object to use as `this`.
|
||||
*/
|
||||
_ol_xml_.parseNode = function(parsersNS, node, objectStack, opt_this) {
|
||||
export function parseNode(parsersNS, node, objectStack, opt_this) {
|
||||
let n;
|
||||
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
|
||||
const parsers = parsersNS[n.namespaceURI];
|
||||
@@ -417,7 +416,7 @@ _ol_xml_.parseNode = function(parsersNS, node, objectStack, opt_this) {
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -431,12 +430,12 @@ _ol_xml_.parseNode = function(parsersNS, node, objectStack, opt_this) {
|
||||
* @return {T} Object.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.pushParseAndPop = function(
|
||||
export function pushParseAndPop(
|
||||
object, parsersNS, node, objectStack, opt_this) {
|
||||
objectStack.push(object);
|
||||
_ol_xml_.parseNode(parsersNS, node, objectStack, opt_this);
|
||||
parseNode(parsersNS, node, objectStack, opt_this);
|
||||
return objectStack.pop();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -461,7 +460,7 @@ _ol_xml_.pushParseAndPop = function(
|
||||
* serializers.
|
||||
* @template T
|
||||
*/
|
||||
_ol_xml_.serialize = function(
|
||||
export function serialize(
|
||||
serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) {
|
||||
const length = (opt_keys !== undefined ? opt_keys : values).length;
|
||||
let value, node;
|
||||
@@ -476,7 +475,7 @@ _ol_xml_.serialize = function(
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -502,11 +501,10 @@ _ol_xml_.serialize = function(
|
||||
* @return {O|undefined} Object.
|
||||
* @template O, T
|
||||
*/
|
||||
_ol_xml_.pushSerializeAndPop = function(object,
|
||||
export function pushSerializeAndPop(object,
|
||||
serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this) {
|
||||
objectStack.push(object);
|
||||
_ol_xml_.serialize(
|
||||
serialize(
|
||||
serializersNS, nodeFactory, values, objectStack, opt_keys, opt_this);
|
||||
return objectStack.pop();
|
||||
};
|
||||
export default _ol_xml_;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
import {createElementNS, parse} from '../../../../src/ol/xml.js';
|
||||
|
||||
const readGeometry = function(format, text, opt_options) {
|
||||
const doc = _ol_xml_.parse(text);
|
||||
const doc = parse(text);
|
||||
// we need an intermediate node for testing purposes
|
||||
const node = document.createElement('PRE');
|
||||
node.appendChild(doc.documentElement);
|
||||
@@ -146,7 +146,7 @@ describe('ol.format.GML2', function() {
|
||||
let node;
|
||||
const featureNS = 'http://www.openlayers.org/';
|
||||
beforeEach(function() {
|
||||
node = _ol_xml_.createElementNS(featureNS, 'layer');
|
||||
node = createElementNS(featureNS, 'layer');
|
||||
});
|
||||
|
||||
it('can serialize a LineString', function() {
|
||||
@@ -173,7 +173,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Polygon', function() {
|
||||
@@ -204,7 +204,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Point', function() {
|
||||
@@ -231,7 +231,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Point', function() {
|
||||
@@ -262,7 +262,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Line String', function() {
|
||||
@@ -293,7 +293,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
|
||||
it('can serialize a Multi Polygon', function() {
|
||||
@@ -328,7 +328,7 @@ describe('ol.format.GML2', function() {
|
||||
}];
|
||||
format.writeFeatureElement(node, feature, objectStack);
|
||||
|
||||
expect(node).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(node).to.xmleql(parse(expected));
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -358,7 +358,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 0]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read a point geometry with scientific notation', function() {
|
||||
@@ -428,7 +428,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([1, 2, 0]);
|
||||
const serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -445,7 +445,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read, transform and write a linestring geometry', function() {
|
||||
@@ -484,7 +484,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
const serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -503,7 +503,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
|
||||
const serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a point geometry with correct axis order',
|
||||
@@ -517,7 +517,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
|
||||
const serialized = formatWGS84.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a surface geometry with right axis order',
|
||||
@@ -549,7 +549,7 @@ describe('ol.format.GML3', function() {
|
||||
srsName: 'urn:x-ogc:def:crs:EPSG:4326',
|
||||
surface: false});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -582,7 +582,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[1, 2, 0], [3, 4, 0], [5, 6, 0], [1, 2, 0]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -615,7 +615,7 @@ describe('ol.format.GML3', function() {
|
||||
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -659,7 +659,7 @@ describe('ol.format.GML3', function() {
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -681,7 +681,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -727,7 +727,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g).to.be.an(MultiPoint);
|
||||
expect(g.getCoordinates()).to.eql([[1, 2, 0], [2, 3, 0], [3, 4, 0]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multipoint geometry', function() {
|
||||
@@ -776,7 +776,7 @@ describe('ol.format.GML3', function() {
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', multiCurve: false});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multilinestring geometry', function() {
|
||||
@@ -852,7 +852,7 @@ describe('ol.format.GML3', function() {
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', multiSurface: false});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multipolygon geometry', function() {
|
||||
@@ -920,7 +920,7 @@ describe('ol.format.GML3', function() {
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a singular multicurve-curve geometry', function() {
|
||||
@@ -952,7 +952,7 @@ describe('ol.format.GML3', function() {
|
||||
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1008,7 +1008,7 @@ describe('ol.format.GML3', function() {
|
||||
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read a plural multisurface geometry', function() {
|
||||
@@ -1111,7 +1111,7 @@ describe('ol.format.GML3', function() {
|
||||
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
|
||||
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
|
||||
const serialized = format.writeGeometryNode(g);
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1277,7 +1277,7 @@ describe('ol.format.GML3', function() {
|
||||
|
||||
it('writes back features as GML', function() {
|
||||
const serialized = gmlFormat.writeFeaturesNode(features);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text), {ignoreElementOrder: true});
|
||||
expect(serialized).to.xmleql(parse(text), {ignoreElementOrder: true});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
import {parse} from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.GPX', function() {
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a rte with multiple rtepts', function() {
|
||||
@@ -99,7 +99,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a rte', function() {
|
||||
@@ -128,7 +128,7 @@ describe('ol.format.GPX', function() {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('does not write rte attributes in rtepts', function() {
|
||||
@@ -145,7 +145,7 @@ describe('ol.format.GPX', function() {
|
||||
'</gpx>';
|
||||
const fs = format.readFeatures(text);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -200,7 +200,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with an empty trkseg', function() {
|
||||
@@ -222,7 +222,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([[]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read/write a trk with a trkseg with multiple trkpts', function() {
|
||||
@@ -255,7 +255,7 @@ describe('ol.format.GPX', function() {
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a trk with a trkseg', function() {
|
||||
@@ -294,7 +294,7 @@ describe('ol.format.GPX', function() {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with multiple trksegs', function() {
|
||||
@@ -338,7 +338,7 @@ describe('ol.format.GPX', function() {
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('does not write trk attributes in trkpts', function() {
|
||||
@@ -373,7 +373,7 @@ describe('ol.format.GPX', function() {
|
||||
'</gpx>';
|
||||
const fs = format.readFeatures(text);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -397,7 +397,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a wpt', function() {
|
||||
@@ -422,7 +422,7 @@ describe('ol.format.GPX', function() {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele', function() {
|
||||
@@ -444,7 +444,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3]);
|
||||
expect(g.getLayout()).to.be('XYZ');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with time', function() {
|
||||
@@ -466,7 +466,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYM');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele and time', function() {
|
||||
@@ -489,7 +489,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read and write various wpt attributes', function() {
|
||||
@@ -542,7 +542,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('ageofdgpsdata')).to.be(9);
|
||||
expect(f.get('dgpsid')).to.be(10);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -672,7 +672,7 @@ describe('ol.format.GPX', function() {
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" ' +
|
||||
'creator="OpenLayers"></gpx>';
|
||||
expect(gpx).to.xmleql(_ol_xml_.parse(expected));
|
||||
expect(gpx).to.xmleql(parse(expected));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
import Style from '../../../../src/ol/style/Style.js';
|
||||
import Text from '../../../../src/ol/style/Text.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
import {parse} from '../../../../src/ol/xml.js';
|
||||
|
||||
|
||||
describe('ol.format.KML', function() {
|
||||
@@ -128,7 +128,7 @@ describe('ol.format.KML', function() {
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark/>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write a Feature as string', function() {
|
||||
@@ -142,7 +142,7 @@ describe('ol.format.KML', function() {
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark/>' +
|
||||
'</kml>';
|
||||
expect(_ol_xml_.parse(node)).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(parse(node)).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write a Feature\'s id', function() {
|
||||
@@ -158,7 +158,7 @@ describe('ol.format.KML', function() {
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark id="foo"/>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -189,7 +189,7 @@ describe('ol.format.KML', function() {
|
||||
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
|
||||
' <Placemark/>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ describe('ol.format.KML', function() {
|
||||
' </LineString>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read Point geometries', function() {
|
||||
@@ -332,7 +332,7 @@ describe('ol.format.KML', function() {
|
||||
' </Point>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZ Point geometries', function() {
|
||||
@@ -352,7 +352,7 @@ describe('ol.format.KML', function() {
|
||||
' </Point>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can transform and write XYZ Point geometries', function() {
|
||||
@@ -384,7 +384,7 @@ describe('ol.format.KML', function() {
|
||||
' </Point>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
|
||||
removeTransform(getProjection('EPSG:4326'), getProjection('double'));
|
||||
removeTransform(getProjection('double'), getProjection('EPSG:4326'));
|
||||
@@ -407,7 +407,7 @@ describe('ol.format.KML', function() {
|
||||
' </Point>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZM Point geometries', function() {
|
||||
@@ -427,7 +427,7 @@ describe('ol.format.KML', function() {
|
||||
' </Point>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read LineString geometries', function() {
|
||||
@@ -471,7 +471,7 @@ describe('ol.format.KML', function() {
|
||||
' </LineString>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZ LineString geometries', function() {
|
||||
@@ -492,7 +492,7 @@ describe('ol.format.KML', function() {
|
||||
' </LineString>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYM LineString geometries', function() {
|
||||
@@ -513,7 +513,7 @@ describe('ol.format.KML', function() {
|
||||
' </LineString>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZM LineString geometries', function() {
|
||||
@@ -534,7 +534,7 @@ describe('ol.format.KML', function() {
|
||||
' </LineString>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read LinearRing geometries', function() {
|
||||
@@ -573,7 +573,7 @@ describe('ol.format.KML', function() {
|
||||
' </LinearRing>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZ LinearRing geometries', function() {
|
||||
@@ -594,7 +594,7 @@ describe('ol.format.KML', function() {
|
||||
' </LinearRing>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYM LinearRing geometries', function() {
|
||||
@@ -615,7 +615,7 @@ describe('ol.format.KML', function() {
|
||||
' </LinearRing>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZM LinearRing geometries', function() {
|
||||
@@ -636,7 +636,7 @@ describe('ol.format.KML', function() {
|
||||
' </LinearRing>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read Polygon geometries', function() {
|
||||
@@ -688,7 +688,7 @@ describe('ol.format.KML', function() {
|
||||
' </Polygon>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZ Polygon geometries', function() {
|
||||
@@ -715,7 +715,7 @@ describe('ol.format.KML', function() {
|
||||
' </Polygon>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYM Polygon geometries', function() {
|
||||
@@ -742,7 +742,7 @@ describe('ol.format.KML', function() {
|
||||
' </Polygon>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write XYZM Polygon geometries', function() {
|
||||
@@ -768,7 +768,7 @@ describe('ol.format.KML', function() {
|
||||
' </Polygon>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read complex Polygon geometries', function() {
|
||||
@@ -842,7 +842,7 @@ describe('ol.format.KML', function() {
|
||||
' </Polygon>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read MultiPolygon geometries', function() {
|
||||
@@ -920,7 +920,7 @@ describe('ol.format.KML', function() {
|
||||
' </MultiGeometry>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read MultiPoint geometries', function() {
|
||||
@@ -981,7 +981,7 @@ describe('ol.format.KML', function() {
|
||||
' </MultiGeometry>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read MultiLineString geometries', function() {
|
||||
@@ -1046,7 +1046,7 @@ describe('ol.format.KML', function() {
|
||||
' </MultiGeometry>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read MultiPolygon geometries', function() {
|
||||
@@ -1126,7 +1126,7 @@ describe('ol.format.KML', function() {
|
||||
' </MultiGeometry>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read empty GeometryCollection geometries', function() {
|
||||
@@ -1237,7 +1237,7 @@ describe('ol.format.KML', function() {
|
||||
' </MultiGeometry>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read gx:Track', function() {
|
||||
@@ -1428,7 +1428,7 @@ describe('ol.format.KML', function() {
|
||||
' <description>My description</description>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write Feature\'s boolean attributes', function() {
|
||||
@@ -1448,7 +1448,7 @@ describe('ol.format.KML', function() {
|
||||
' <visibility>0</visibility>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1539,7 +1539,7 @@ describe('ol.format.KML', function() {
|
||||
' </ExtendedData>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write ExtendedData with values', function() {
|
||||
@@ -1565,7 +1565,7 @@ describe('ol.format.KML', function() {
|
||||
' </ExtendedData>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write ExtendedData pair with displayName and value', function() {
|
||||
@@ -1594,7 +1594,7 @@ describe('ol.format.KML', function() {
|
||||
' </ExtendedData>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can read ExtendedData', function() {
|
||||
@@ -2308,7 +2308,7 @@ describe('ol.format.KML', function() {
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('does not write styles when writeStyles option is false', function() {
|
||||
@@ -2330,7 +2330,7 @@ describe('ol.format.KML', function() {
|
||||
' <Placemark>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('skips image styles that are not icon styles', function() {
|
||||
@@ -2356,7 +2356,7 @@ describe('ol.format.KML', function() {
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write an feature\'s text style', function() {
|
||||
@@ -2388,7 +2388,7 @@ describe('ol.format.KML', function() {
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write an feature\'s stroke style', function() {
|
||||
@@ -2416,7 +2416,7 @@ describe('ol.format.KML', function() {
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write an feature\'s fill style', function() {
|
||||
@@ -2442,7 +2442,7 @@ describe('ol.format.KML', function() {
|
||||
' </Style>' +
|
||||
' </Placemark>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('can write multiple features with Style', function() {
|
||||
@@ -2479,7 +2479,7 @@ describe('ol.format.KML', function() {
|
||||
' </Placemark>' +
|
||||
' </Document>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3008,7 +3008,7 @@ describe('ol.format.KML', function() {
|
||||
' </Placemark>' +
|
||||
' </Document>' +
|
||||
'</kml>';
|
||||
expect(node).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(node).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import OWS from '../../../../src/ol/format/OWS.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
import {parse} from '../../../../src/ol/xml.js';
|
||||
|
||||
|
||||
describe('ol.format.OWS 1.1', function() {
|
||||
@@ -7,7 +7,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
const parser = new OWS();
|
||||
|
||||
it('should read ServiceProvider tag properly', function() {
|
||||
const doc = _ol_xml_.parse(
|
||||
const doc = parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceProvider>' +
|
||||
@@ -56,7 +56,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
});
|
||||
|
||||
it('should read ServiceIdentification tag properly', function() {
|
||||
const doc = _ol_xml_.parse(
|
||||
const doc = parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceIdentification>' +
|
||||
@@ -91,7 +91,7 @@ describe('ol.format.OWS 1.1', function() {
|
||||
});
|
||||
|
||||
it('should read OperationsMetadata tag properly', function() {
|
||||
const doc = _ol_xml_.parse(
|
||||
const doc = parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:OperationsMetadata>' +
|
||||
|
||||
@@ -26,7 +26,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
|
||||
import Polygon from '../../../../src/ol/geom/Polygon.js';
|
||||
import {addCommon, clearAllProjections, transform} from '../../../../src/ol/proj.js';
|
||||
import {register} from '../../../../src/ol/proj/proj4.js';
|
||||
import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
import {parse} from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.WFS', function() {
|
||||
|
||||
@@ -251,7 +251,7 @@ describe('ol.format.WFS', function() {
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
propertyNames: ['STATE_NAME', 'STATE_FIPS', 'STATE_ABBR']
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates paging headers', function() {
|
||||
@@ -276,7 +276,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states']
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a BBOX filter', function() {
|
||||
@@ -303,7 +303,7 @@ describe('ol.format.WFS', function() {
|
||||
geometryName: 'the_geom',
|
||||
bbox: [1, 2, 3, 4]
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a property filter', function() {
|
||||
@@ -325,7 +325,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: equalToFilter('name', 'New York', false)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates two property filters', function() {
|
||||
@@ -355,7 +355,7 @@ describe('ol.format.WFS', function() {
|
||||
equalToFilter('name', 'New York'),
|
||||
equalToFilter('area', 1234))
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates greater/less than property filters', function() {
|
||||
@@ -404,7 +404,7 @@ describe('ol.format.WFS', function() {
|
||||
)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates isBetween property filter', function() {
|
||||
@@ -427,7 +427,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: betweenFilter('area', 100, 1000)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates isNull property filter', function() {
|
||||
@@ -448,7 +448,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: isNullFilter('area')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates isLike property filter', function() {
|
||||
@@ -470,7 +470,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: likeFilter('name', 'New*')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates isLike property filter with arguments', function() {
|
||||
@@ -492,7 +492,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: likeFilter('name', 'New*', '*', '.', '!', false)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a Not filter', function() {
|
||||
@@ -516,7 +516,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: notFilter(equalToFilter('name', 'New York'))
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates an AND filter', function() {
|
||||
@@ -556,7 +556,7 @@ describe('ol.format.WFS', function() {
|
||||
greaterThanFilter('population', 2000000)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a contains filter', function() {
|
||||
@@ -593,7 +593,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a intersects filter', function() {
|
||||
@@ -630,7 +630,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates a within filter', function() {
|
||||
@@ -667,7 +667,7 @@ describe('ol.format.WFS', function() {
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates During property filter', function() {
|
||||
@@ -698,7 +698,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states'],
|
||||
filter: duringFilter('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z')
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized.firstElementChild).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -714,7 +714,7 @@ describe('ol.format.WFS', function() {
|
||||
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>';
|
||||
const serialized = new WFS().writeTransaction(null, null, null,
|
||||
{handle: 'handle_t'});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -745,7 +745,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'feature',
|
||||
gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -776,7 +776,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
it('creates the correct update if geometry name is alias', function() {
|
||||
@@ -796,7 +796,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -882,7 +882,7 @@ describe('ol.format.WFS', function() {
|
||||
featurePrefix: 'foo',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -924,7 +924,7 @@ describe('ol.format.WFS', function() {
|
||||
featureType: 'states',
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -951,7 +951,7 @@ describe('ol.format.WFS', function() {
|
||||
value: 'Another native line goes here'
|
||||
}]
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -996,7 +996,7 @@ describe('ol.format.WFS', function() {
|
||||
version: '1.0.0'
|
||||
});
|
||||
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1038,7 +1038,7 @@ describe('ol.format.WFS', function() {
|
||||
featureType: 'topp:states',
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1081,7 +1081,7 @@ describe('ol.format.WFS', function() {
|
||||
version: '1.0.0'
|
||||
});
|
||||
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1121,7 +1121,7 @@ describe('ol.format.WFS', function() {
|
||||
hasZ: true,
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1141,7 +1141,7 @@ describe('ol.format.WFS', function() {
|
||||
featureTypes: ['states', 'cities'],
|
||||
featurePrefix: 'topp'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1320,7 +1320,7 @@ describe('ol.format.WFS', function() {
|
||||
equalToFilter('waterway', 'riverbank')
|
||||
)
|
||||
);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
expect(serialized).to.xmleql(parse(text));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user