Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
@@ -29,8 +29,8 @@ import _ol_xml_ from '../xml.js';
|
||||
* @extends {ol.format.GMLBase}
|
||||
* @api
|
||||
*/
|
||||
var GML3 = function(opt_options) {
|
||||
var options = /** @type {olx.format.GMLOptions} */
|
||||
const GML3 = function(opt_options) {
|
||||
const options = /** @type {olx.format.GMLOptions} */
|
||||
(opt_options ? opt_options : {});
|
||||
|
||||
GMLBase.call(this, options);
|
||||
@@ -97,10 +97,10 @@ GML3.schemaLocation_ = GMLBase.GMLNS +
|
||||
*/
|
||||
GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.LineString>} */
|
||||
var lineStrings = _ol_xml_.pushParseAndPop([],
|
||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||
const lineStrings = _ol_xml_.pushParseAndPop([],
|
||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||
if (lineStrings) {
|
||||
var multiLineString = new MultiLineString(null);
|
||||
const multiLineString = new MultiLineString(null);
|
||||
multiLineString.setLineStrings(lineStrings);
|
||||
return multiLineString;
|
||||
} else {
|
||||
@@ -117,10 +117,10 @@ GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
||||
/** @type {Array.<ol.geom.Polygon>} */
|
||||
var polygons = _ol_xml_.pushParseAndPop([],
|
||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||
const polygons = _ol_xml_.pushParseAndPop([],
|
||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||
if (polygons) {
|
||||
var multiPolygon = new MultiPolygon(null);
|
||||
const multiPolygon = new MultiPolygon(null);
|
||||
multiPolygon.setPolygons(polygons);
|
||||
return multiPolygon;
|
||||
} else {
|
||||
@@ -146,7 +146,7 @@ GML3.prototype.curveMemberParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
|
||||
_ol_xml_.parseNode(this.SURFACEMEMBER_PARSERS_,
|
||||
node, objectStack, this);
|
||||
node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ GML3.prototype.surfaceMemberParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readPatch_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
this.PATCHES_PARSERS_, node, objectStack, this);
|
||||
this.PATCHES_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ GML3.prototype.readPatch_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readSegment_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
||||
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ GML3.prototype.readSegment_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -194,8 +194,8 @@ GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
return _ol_xml_.pushParseAndPop([null],
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
||||
node, objectStack, this);
|
||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
||||
node, objectStack, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -206,10 +206,10 @@ GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.interiorParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
flatLinearRings.push(flatLinearRing);
|
||||
}
|
||||
@@ -223,10 +223,10 @@ GML3.prototype.interiorParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>|undefined} */
|
||||
var flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
const flatLinearRing = _ol_xml_.pushParseAndPop(undefined,
|
||||
this.RING_PARSERS, node, objectStack, this);
|
||||
if (flatLinearRing) {
|
||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
const flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||
(objectStack[objectStack.length - 1]);
|
||||
flatLinearRings[0] = flatLinearRing;
|
||||
}
|
||||
@@ -241,19 +241,19 @@ GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
/** @type {Array.<Array.<number>>} */
|
||||
var flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
const flatLinearRings = _ol_xml_.pushParseAndPop([null],
|
||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||
if (flatLinearRings && flatLinearRings[0]) {
|
||||
var polygon = new Polygon(null);
|
||||
var flatCoordinates = flatLinearRings[0];
|
||||
var ends = [flatCoordinates.length];
|
||||
var i, ii;
|
||||
const polygon = new Polygon(null);
|
||||
const flatCoordinates = flatLinearRings[0];
|
||||
const ends = [flatCoordinates.length];
|
||||
let i, ii;
|
||||
for (i = 1, ii = flatLinearRings.length; i < ii; ++i) {
|
||||
extend(flatCoordinates, flatLinearRings[i]);
|
||||
ends.push(flatCoordinates.length);
|
||||
}
|
||||
polygon.setFlatCoordinates(
|
||||
GeometryLayout.XYZ, flatCoordinates, ends);
|
||||
GeometryLayout.XYZ, flatCoordinates, ends);
|
||||
return polygon;
|
||||
} else {
|
||||
return undefined;
|
||||
@@ -269,10 +269,10 @@ GML3.prototype.readSurface_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
this.CURVE_PARSERS_, node, objectStack, this);
|
||||
const flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
this.CURVE_PARSERS_, node, objectStack, this);
|
||||
if (flatCoordinates) {
|
||||
var lineString = new LineString(null);
|
||||
const lineString = new LineString(null);
|
||||
lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
|
||||
return lineString;
|
||||
} else {
|
||||
@@ -289,11 +289,11 @@ GML3.prototype.readCurve_ = function(node, objectStack) {
|
||||
*/
|
||||
GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
||||
const flatCoordinates = _ol_xml_.pushParseAndPop([null],
|
||||
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
||||
return createOrUpdate(flatCoordinates[1][0],
|
||||
flatCoordinates[1][1], flatCoordinates[2][0],
|
||||
flatCoordinates[2][1]);
|
||||
flatCoordinates[1][1], flatCoordinates[2][0],
|
||||
flatCoordinates[2][1]);
|
||||
};
|
||||
|
||||
|
||||
@@ -304,11 +304,11 @@ GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
var s = _ol_xml_.getAllTextContent(node, false);
|
||||
var re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
|
||||
let s = _ol_xml_.getAllTextContent(node, false);
|
||||
const re = /^\s*([+\-]?\d*\.?\d+(?:[eE][+\-]?\d+)?)\s*/;
|
||||
/** @type {Array.<number>} */
|
||||
var flatCoordinates = [];
|
||||
var m;
|
||||
const flatCoordinates = [];
|
||||
let m;
|
||||
while ((m = re.exec(s))) {
|
||||
flatCoordinates.push(parseFloat(m[1]));
|
||||
s = s.substr(m[0].length);
|
||||
@@ -316,23 +316,23 @@ GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
if (s !== '') {
|
||||
return undefined;
|
||||
}
|
||||
var context = objectStack[0];
|
||||
var containerSrs = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
const context = objectStack[0];
|
||||
const containerSrs = context['srsName'];
|
||||
let axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = getProjection(containerSrs);
|
||||
const proj = getProjection(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
if (axisOrientation === 'neu') {
|
||||
var i, ii;
|
||||
let i, ii;
|
||||
for (i = 0, ii = flatCoordinates.length; i < ii; i += 3) {
|
||||
var y = flatCoordinates[i];
|
||||
var x = flatCoordinates[i + 1];
|
||||
const y = flatCoordinates[i];
|
||||
const x = flatCoordinates[i + 1];
|
||||
flatCoordinates[i] = x;
|
||||
flatCoordinates[i + 1] = y;
|
||||
}
|
||||
}
|
||||
var len = flatCoordinates.length;
|
||||
const len = flatCoordinates.length;
|
||||
if (len == 2) {
|
||||
flatCoordinates.push(0);
|
||||
}
|
||||
@@ -350,33 +350,33 @@ GML3.prototype.readFlatPos_ = function(node, objectStack) {
|
||||
* @return {Array.<number>|undefined} Flat coordinates.
|
||||
*/
|
||||
GML3.prototype.readFlatPosList_ = function(node, objectStack) {
|
||||
var s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
var context = objectStack[0];
|
||||
var containerSrs = context['srsName'];
|
||||
var contextDimension = context['srsDimension'];
|
||||
var axisOrientation = 'enu';
|
||||
const s = _ol_xml_.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
|
||||
const context = objectStack[0];
|
||||
const containerSrs = context['srsName'];
|
||||
const contextDimension = context['srsDimension'];
|
||||
let axisOrientation = 'enu';
|
||||
if (containerSrs) {
|
||||
var proj = getProjection(containerSrs);
|
||||
const proj = getProjection(containerSrs);
|
||||
axisOrientation = proj.getAxisOrientation();
|
||||
}
|
||||
var coords = s.split(/\s+/);
|
||||
const coords = s.split(/\s+/);
|
||||
// The "dimension" attribute is from the GML 3.0.1 spec.
|
||||
var dim = 2;
|
||||
let dim = 2;
|
||||
if (node.getAttribute('srsDimension')) {
|
||||
dim = XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('srsDimension'));
|
||||
node.getAttribute('srsDimension'));
|
||||
} else if (node.getAttribute('dimension')) {
|
||||
dim = XSD.readNonNegativeIntegerString(
|
||||
node.getAttribute('dimension'));
|
||||
node.getAttribute('dimension'));
|
||||
} else if (node.parentNode.getAttribute('srsDimension')) {
|
||||
dim = XSD.readNonNegativeIntegerString(
|
||||
node.parentNode.getAttribute('srsDimension'));
|
||||
node.parentNode.getAttribute('srsDimension'));
|
||||
} else if (contextDimension) {
|
||||
dim = XSD.readNonNegativeIntegerString(contextDimension);
|
||||
}
|
||||
var x, y, z;
|
||||
var flatCoordinates = [];
|
||||
for (var i = 0, ii = coords.length; i < ii; i += dim) {
|
||||
let x, y, z;
|
||||
const flatCoordinates = [];
|
||||
for (let i = 0, ii = coords.length; i < ii; i += dim) {
|
||||
x = parseFloat(coords[i]);
|
||||
y = parseFloat(coords[i + 1]);
|
||||
z = (dim === 3) ? parseFloat(coords[i + 2]) : 0;
|
||||
@@ -425,22 +425,22 @@ GML3.prototype.GEOMETRY_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Point': _ol_xml_.makeReplacer(GMLBase.prototype.readPoint),
|
||||
'MultiPoint': _ol_xml_.makeReplacer(
|
||||
GMLBase.prototype.readMultiPoint),
|
||||
GMLBase.prototype.readMultiPoint),
|
||||
'LineString': _ol_xml_.makeReplacer(
|
||||
GMLBase.prototype.readLineString),
|
||||
GMLBase.prototype.readLineString),
|
||||
'MultiLineString': _ol_xml_.makeReplacer(
|
||||
GMLBase.prototype.readMultiLineString),
|
||||
GMLBase.prototype.readMultiLineString),
|
||||
'LinearRing': _ol_xml_.makeReplacer(
|
||||
GMLBase.prototype.readLinearRing),
|
||||
GMLBase.prototype.readLinearRing),
|
||||
'Polygon': _ol_xml_.makeReplacer(GMLBase.prototype.readPolygon),
|
||||
'MultiPolygon': _ol_xml_.makeReplacer(
|
||||
GMLBase.prototype.readMultiPolygon),
|
||||
GMLBase.prototype.readMultiPolygon),
|
||||
'Surface': _ol_xml_.makeReplacer(GML3.prototype.readSurface_),
|
||||
'MultiSurface': _ol_xml_.makeReplacer(
|
||||
GML3.prototype.readMultiSurface_),
|
||||
GML3.prototype.readMultiSurface_),
|
||||
'Curve': _ol_xml_.makeReplacer(GML3.prototype.readCurve_),
|
||||
'MultiCurve': _ol_xml_.makeReplacer(
|
||||
GML3.prototype.readMultiCurve_),
|
||||
GML3.prototype.readMultiCurve_),
|
||||
'Envelope': _ol_xml_.makeReplacer(GML3.prototype.readEnvelope_)
|
||||
}
|
||||
};
|
||||
@@ -454,9 +454,9 @@ GML3.prototype.GEOMETRY_PARSERS_ = {
|
||||
GML3.prototype.MULTICURVE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'curveMember': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_),
|
||||
GML3.prototype.curveMemberParser_),
|
||||
'curveMembers': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.curveMemberParser_)
|
||||
GML3.prototype.curveMemberParser_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -469,9 +469,9 @@ GML3.prototype.MULTICURVE_PARSERS_ = {
|
||||
GML3.prototype.MULTISURFACE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'surfaceMember': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_),
|
||||
GML3.prototype.surfaceMemberParser_),
|
||||
'surfaceMembers': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.surfaceMemberParser_)
|
||||
GML3.prototype.surfaceMemberParser_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -484,7 +484,7 @@ GML3.prototype.MULTISURFACE_PARSERS_ = {
|
||||
GML3.prototype.CURVEMEMBER_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LineString': _ol_xml_.makeArrayPusher(
|
||||
GMLBase.prototype.readLineString),
|
||||
GMLBase.prototype.readLineString),
|
||||
'Curve': _ol_xml_.makeArrayPusher(GML3.prototype.readCurve_)
|
||||
}
|
||||
};
|
||||
@@ -535,9 +535,9 @@ GML3.prototype.CURVE_PARSERS_ = {
|
||||
GML3.prototype.ENVELOPE_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lowerCorner': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_),
|
||||
GML3.prototype.readFlatPosList_),
|
||||
'upperCorner': _ol_xml_.makeArrayPusher(
|
||||
GML3.prototype.readFlatPosList_)
|
||||
GML3.prototype.readFlatPosList_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -550,7 +550,7 @@ GML3.prototype.ENVELOPE_PARSERS_ = {
|
||||
GML3.prototype.PATCHES_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'PolygonPatch': _ol_xml_.makeReplacer(
|
||||
GML3.prototype.readPolygonPatch_)
|
||||
GML3.prototype.readPolygonPatch_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -563,7 +563,7 @@ GML3.prototype.PATCHES_PARSERS_ = {
|
||||
GML3.prototype.SEGMENTS_PARSERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'LineStringSegment': _ol_xml_.makeReplacer(
|
||||
GML3.prototype.readLineStringSegment_)
|
||||
GML3.prototype.readLineStringSegment_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -575,17 +575,17 @@ GML3.prototype.SEGMENTS_PARSERS_ = {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writePos_ = function(node, value, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var hasZ = context['hasZ'];
|
||||
var srsDimension = hasZ ? 3 : 2;
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const hasZ = context['hasZ'];
|
||||
const srsDimension = hasZ ? 3 : 2;
|
||||
node.setAttribute('srsDimension', srsDimension);
|
||||
var srsName = context['srsName'];
|
||||
var axisOrientation = 'enu';
|
||||
const srsName = context['srsName'];
|
||||
let axisOrientation = 'enu';
|
||||
if (srsName) {
|
||||
axisOrientation = getProjection(srsName).getAxisOrientation();
|
||||
}
|
||||
var point = value.getCoordinates();
|
||||
var coords;
|
||||
const point = value.getCoordinates();
|
||||
let coords;
|
||||
// only 2d for simple features profile
|
||||
if (axisOrientation.substr(0, 2) === 'en') {
|
||||
coords = (point[0] + ' ' + point[1]);
|
||||
@@ -594,7 +594,7 @@ GML3.prototype.writePos_ = function(node, value, objectStack) {
|
||||
}
|
||||
if (hasZ) {
|
||||
// For newly created points, Z can be undefined.
|
||||
var z = point[2] || 0;
|
||||
const z = point[2] || 0;
|
||||
coords += ' ' + z;
|
||||
}
|
||||
XSD.writeStringTextNode(node, coords);
|
||||
@@ -609,16 +609,16 @@ GML3.prototype.writePos_ = function(node, value, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||
var axisOrientation = 'enu';
|
||||
let axisOrientation = 'enu';
|
||||
if (opt_srsName) {
|
||||
axisOrientation = getProjection(opt_srsName).getAxisOrientation();
|
||||
}
|
||||
var coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||
let coords = ((axisOrientation.substr(0, 2) === 'en') ?
|
||||
point[0] + ' ' + point[1] :
|
||||
point[1] + ' ' + point[0]);
|
||||
if (opt_hasZ) {
|
||||
// For newly created points, Z can be undefined.
|
||||
var z = point[2] || 0;
|
||||
const z = point[2] || 0;
|
||||
coords += ' ' + z;
|
||||
}
|
||||
|
||||
@@ -633,17 +633,17 @@ GML3.prototype.getCoords_ = function(point, opt_srsName, opt_hasZ) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writePosList_ = function(node, value, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var hasZ = context['hasZ'];
|
||||
var srsDimension = hasZ ? 3 : 2;
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const hasZ = context['hasZ'];
|
||||
const srsDimension = hasZ ? 3 : 2;
|
||||
node.setAttribute('srsDimension', srsDimension);
|
||||
var srsName = context['srsName'];
|
||||
const srsName = context['srsName'];
|
||||
// only 2d for simple features profile
|
||||
var points = value.getCoordinates();
|
||||
var len = points.length;
|
||||
var parts = new Array(len);
|
||||
var point;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
const points = value.getCoordinates();
|
||||
const len = points.length;
|
||||
const parts = new Array(len);
|
||||
let point;
|
||||
for (let i = 0; i < len; ++i) {
|
||||
point = points[i];
|
||||
parts[i] = this.getCoords_(point, srsName, hasZ);
|
||||
}
|
||||
@@ -658,12 +658,12 @@ GML3.prototype.writePosList_ = function(node, value, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writePoint_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var srsName = context['srsName'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const srsName = context['srsName'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var pos = _ol_xml_.createElementNS(node.namespaceURI, 'pos');
|
||||
const pos = _ol_xml_.createElementNS(node.namespaceURI, 'pos');
|
||||
node.appendChild(pos);
|
||||
this.writePos_(pos, geometry, objectStack);
|
||||
};
|
||||
@@ -687,18 +687,18 @@ GML3.ENVELOPE_SERIALIZERS_ = {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
GML3.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var srsName = context['srsName'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const srsName = context['srsName'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var keys = ['lowerCorner', 'upperCorner'];
|
||||
var values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
|
||||
const keys = ['lowerCorner', 'upperCorner'];
|
||||
const values = [extent[0] + ' ' + extent[1], extent[2] + ' ' + extent[3]];
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
({node: node}), GML3.ENVELOPE_SERIALIZERS_,
|
||||
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values,
|
||||
objectStack, keys, this);
|
||||
({node: node}), GML3.ENVELOPE_SERIALIZERS_,
|
||||
_ol_xml_.OBJECT_PROPERTY_NODE_FACTORY,
|
||||
values,
|
||||
objectStack, keys, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -709,12 +709,12 @@ GML3.prototype.writeEnvelope = function(node, extent, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var srsName = context['srsName'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const srsName = context['srsName'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
const posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
node.appendChild(posList);
|
||||
this.writePosList_(posList, geometry, objectStack);
|
||||
};
|
||||
@@ -728,14 +728,14 @@ GML3.prototype.writeLinearRing_ = function(node, geometry, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var parentNode = context.node;
|
||||
var exteriorWritten = context['exteriorWritten'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const parentNode = context.node;
|
||||
const exteriorWritten = context['exteriorWritten'];
|
||||
if (exteriorWritten === undefined) {
|
||||
context['exteriorWritten'] = true;
|
||||
}
|
||||
return _ol_xml_.createElementNS(parentNode.namespaceURI,
|
||||
exteriorWritten !== undefined ? 'interior' : 'exterior');
|
||||
exteriorWritten !== undefined ? 'interior' : 'exterior');
|
||||
};
|
||||
|
||||
|
||||
@@ -746,24 +746,24 @@ GML3.prototype.RING_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var hasZ = context['hasZ'];
|
||||
var srsName = context['srsName'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const hasZ = context['hasZ'];
|
||||
const srsName = context['srsName'];
|
||||
if (node.nodeName !== 'PolygonPatch' && srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
if (node.nodeName === 'Polygon' || node.nodeName === 'PolygonPatch') {
|
||||
var rings = geometry.getLinearRings();
|
||||
const rings = geometry.getLinearRings();
|
||||
_ol_xml_.pushSerializeAndPop(
|
||||
{node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML3.RING_SERIALIZERS_,
|
||||
this.RING_NODE_FACTORY_,
|
||||
rings, objectStack, undefined, this);
|
||||
{node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML3.RING_SERIALIZERS_,
|
||||
this.RING_NODE_FACTORY_,
|
||||
rings, objectStack, undefined, this);
|
||||
} else if (node.nodeName === 'Surface') {
|
||||
var patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
|
||||
const patches = _ol_xml_.createElementNS(node.namespaceURI, 'patches');
|
||||
node.appendChild(patches);
|
||||
this.writeSurfacePatches_(
|
||||
patches, geometry, objectStack);
|
||||
patches, geometry, objectStack);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -775,21 +775,21 @@ GML3.prototype.writeSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var srsName = context['srsName'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const srsName = context['srsName'];
|
||||
if (node.nodeName !== 'LineStringSegment' && srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
if (node.nodeName === 'LineString' ||
|
||||
node.nodeName === 'LineStringSegment') {
|
||||
var posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
const posList = _ol_xml_.createElementNS(node.namespaceURI, 'posList');
|
||||
node.appendChild(posList);
|
||||
this.writePosList_(posList, geometry, objectStack);
|
||||
} else if (node.nodeName === 'Curve') {
|
||||
var segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
|
||||
const segments = _ol_xml_.createElementNS(node.namespaceURI, 'segments');
|
||||
node.appendChild(segments);
|
||||
this.writeCurveSegments_(segments,
|
||||
geometry, objectStack);
|
||||
geometry, objectStack);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -801,18 +801,18 @@ GML3.prototype.writeCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var hasZ = context['hasZ'];
|
||||
var srsName = context['srsName'];
|
||||
var surface = context['surface'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const hasZ = context['hasZ'];
|
||||
const srsName = context['srsName'];
|
||||
const surface = context['surface'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var polygons = geometry.getPolygons();
|
||||
const polygons = geometry.getPolygons();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, surface: surface},
|
||||
GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||
objectStack, undefined, this);
|
||||
GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, polygons,
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -823,18 +823,18 @@ GML3.prototype.writeMultiSurfaceOrPolygon_ = function(node, geometry, objectStac
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var srsName = context['srsName'];
|
||||
var hasZ = context['hasZ'];
|
||||
objectStack) {
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const srsName = context['srsName'];
|
||||
const hasZ = context['hasZ'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var points = geometry.getPoints();
|
||||
const points = geometry.getPoints();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName},
|
||||
GML3.POINTMEMBER_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
|
||||
objectStack, undefined, this);
|
||||
GML3.POINTMEMBER_SERIALIZERS_,
|
||||
_ol_xml_.makeSimpleNodeFactory('pointMember'), points,
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -845,18 +845,18 @@ GML3.prototype.writeMultiPoint_ = function(node, geometry,
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectStack) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var hasZ = context['hasZ'];
|
||||
var srsName = context['srsName'];
|
||||
var curve = context['curve'];
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const hasZ = context['hasZ'];
|
||||
const srsName = context['srsName'];
|
||||
const curve = context['curve'];
|
||||
if (srsName) {
|
||||
node.setAttribute('srsName', srsName);
|
||||
}
|
||||
var lines = geometry.getLineStrings();
|
||||
const lines = geometry.getLineStrings();
|
||||
_ol_xml_.pushSerializeAndPop({node: node, hasZ: hasZ, srsName: srsName, curve: curve},
|
||||
GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||
objectStack, undefined, this);
|
||||
GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_,
|
||||
this.MULTIGEOMETRY_MEMBER_NODE_FACTORY_, lines,
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -867,7 +867,7 @@ GML3.prototype.writeMultiCurveOrLineString_ = function(node, geometry, objectSta
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
var linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
|
||||
const linearRing = _ol_xml_.createElementNS(node.namespaceURI, 'LinearRing');
|
||||
node.appendChild(linearRing);
|
||||
this.writeLinearRing_(linearRing, ring, objectStack);
|
||||
};
|
||||
@@ -880,8 +880,8 @@ GML3.prototype.writeRing_ = function(node, ring, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStack) {
|
||||
var child = this.GEOMETRY_NODE_FACTORY_(
|
||||
polygon, objectStack);
|
||||
const child = this.GEOMETRY_NODE_FACTORY_(
|
||||
polygon, objectStack);
|
||||
if (child) {
|
||||
node.appendChild(child);
|
||||
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
|
||||
@@ -896,7 +896,7 @@ GML3.prototype.writeSurfaceOrPolygonMember_ = function(node, polygon, objectStac
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writePointMember_ = function(node, point, objectStack) {
|
||||
var child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'Point');
|
||||
node.appendChild(child);
|
||||
this.writePoint_(child, point, objectStack);
|
||||
};
|
||||
@@ -909,7 +909,7 @@ GML3.prototype.writePointMember_ = function(node, point, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack) {
|
||||
var child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
|
||||
const child = this.GEOMETRY_NODE_FACTORY_(line, objectStack);
|
||||
if (child) {
|
||||
node.appendChild(child);
|
||||
this.writeCurveOrLineString_(child, line, objectStack);
|
||||
@@ -924,7 +924,7 @@ GML3.prototype.writeLineStringOrCurveMember_ = function(node, line, objectStack)
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
var child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI, 'PolygonPatch');
|
||||
node.appendChild(child);
|
||||
this.writeSurfaceOrPolygon_(child, polygon, objectStack);
|
||||
};
|
||||
@@ -937,8 +937,8 @@ GML3.prototype.writeSurfacePatches_ = function(node, polygon, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
|
||||
var child = _ol_xml_.createElementNS(node.namespaceURI,
|
||||
'LineStringSegment');
|
||||
const child = _ol_xml_.createElementNS(node.namespaceURI,
|
||||
'LineStringSegment');
|
||||
node.appendChild(child);
|
||||
this.writeCurveOrLineString_(child, line, objectStack);
|
||||
};
|
||||
@@ -950,14 +950,14 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
var context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
|
||||
var item = _ol_obj_.assign({}, context);
|
||||
const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]);
|
||||
const item = _ol_obj_.assign({}, context);
|
||||
item.node = node;
|
||||
var value;
|
||||
let value;
|
||||
if (Array.isArray(geometry)) {
|
||||
if (context.dataProjection) {
|
||||
value = transformExtent(
|
||||
geometry, context.featureProjection, context.dataProjection);
|
||||
geometry, context.featureProjection, context.dataProjection);
|
||||
} else {
|
||||
value = geometry;
|
||||
}
|
||||
@@ -965,9 +965,9 @@ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
value = transformWithOptions(/** @type {ol.geom.Geometry} */ (geometry), true, context);
|
||||
}
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), GML3.GEOMETRY_SERIALIZERS_,
|
||||
this.GEOMETRY_NODE_FACTORY_, [value],
|
||||
objectStack, undefined, this);
|
||||
(item), GML3.GEOMETRY_SERIALIZERS_,
|
||||
this.GEOMETRY_NODE_FACTORY_, [value],
|
||||
objectStack, undefined, this);
|
||||
};
|
||||
|
||||
|
||||
@@ -977,44 +977,45 @@ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) {
|
||||
* @param {Array.<*>} objectStack Node stack.
|
||||
*/
|
||||
GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
var fid = feature.getId();
|
||||
const fid = feature.getId();
|
||||
if (fid) {
|
||||
node.setAttribute('fid', fid);
|
||||
}
|
||||
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var featureNS = context['featureNS'];
|
||||
var geometryName = feature.getGeometryName();
|
||||
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const featureNS = context['featureNS'];
|
||||
const geometryName = feature.getGeometryName();
|
||||
if (!context.serializers) {
|
||||
context.serializers = {};
|
||||
context.serializers[featureNS] = {};
|
||||
}
|
||||
var properties = feature.getProperties();
|
||||
var keys = [], values = [];
|
||||
for (var key in properties) {
|
||||
var value = properties[key];
|
||||
const properties = feature.getProperties();
|
||||
const keys = [];
|
||||
const values = [];
|
||||
for (const key in properties) {
|
||||
const value = properties[key];
|
||||
if (value !== null) {
|
||||
keys.push(key);
|
||||
values.push(value);
|
||||
if (key == geometryName || value instanceof Geometry) {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
this.writeGeometryElement, this);
|
||||
this.writeGeometryElement, this);
|
||||
}
|
||||
} else {
|
||||
if (!(key in context.serializers[featureNS])) {
|
||||
context.serializers[featureNS][key] = _ol_xml_.makeChildAppender(
|
||||
XSD.writeStringTextNode);
|
||||
XSD.writeStringTextNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var item = _ol_obj_.assign({}, context);
|
||||
const item = _ol_obj_.assign({}, context);
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item), context.serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
|
||||
values,
|
||||
objectStack, keys);
|
||||
(item), context.serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(undefined, featureNS),
|
||||
values,
|
||||
objectStack, keys);
|
||||
};
|
||||
|
||||
|
||||
@@ -1025,20 +1026,20 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
|
||||
var context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
var featureType = context['featureType'];
|
||||
var featureNS = context['featureNS'];
|
||||
var serializers = {};
|
||||
const context = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||
const featureType = context['featureType'];
|
||||
const featureNS = context['featureNS'];
|
||||
const serializers = {};
|
||||
serializers[featureNS] = {};
|
||||
serializers[featureNS][featureType] = _ol_xml_.makeChildAppender(
|
||||
this.writeFeatureElement, this);
|
||||
var item = _ol_obj_.assign({}, context);
|
||||
this.writeFeatureElement, this);
|
||||
const item = _ol_obj_.assign({}, context);
|
||||
item.node = node;
|
||||
_ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */
|
||||
(item),
|
||||
serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(featureType, featureNS), features,
|
||||
objectStack);
|
||||
(item),
|
||||
serializers,
|
||||
_ol_xml_.makeSimpleNodeFactory(featureType, featureNS), features,
|
||||
objectStack);
|
||||
};
|
||||
|
||||
|
||||
@@ -1049,9 +1050,9 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) {
|
||||
GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'surfaceMember': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_),
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_),
|
||||
'polygonMember': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_)
|
||||
GML3.prototype.writeSurfaceOrPolygonMember_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1063,7 +1064,7 @@ GML3.SURFACEORPOLYGONMEMBER_SERIALIZERS_ = {
|
||||
GML3.POINTMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'pointMember': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writePointMember_)
|
||||
GML3.prototype.writePointMember_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1075,9 +1076,9 @@ GML3.POINTMEMBER_SERIALIZERS_ = {
|
||||
GML3.LINESTRINGORCURVEMEMBER_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'lineStringMember': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_),
|
||||
GML3.prototype.writeLineStringOrCurveMember_),
|
||||
'curveMember': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeLineStringOrCurveMember_)
|
||||
GML3.prototype.writeLineStringOrCurveMember_)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1101,28 +1102,28 @@ GML3.RING_SERIALIZERS_ = {
|
||||
GML3.GEOMETRY_SERIALIZERS_ = {
|
||||
'http://www.opengis.net/gml': {
|
||||
'Curve': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'MultiCurve': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
'Point': _ol_xml_.makeChildAppender(GML3.prototype.writePoint_),
|
||||
'MultiPoint': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeMultiPoint_),
|
||||
GML3.prototype.writeMultiPoint_),
|
||||
'LineString': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
GML3.prototype.writeCurveOrLineString_),
|
||||
'MultiLineString': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
GML3.prototype.writeMultiCurveOrLineString_),
|
||||
'LinearRing': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeLinearRing_),
|
||||
GML3.prototype.writeLinearRing_),
|
||||
'Polygon': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiPolygon': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Surface': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
GML3.prototype.writeSurfaceOrPolygon_),
|
||||
'MultiSurface': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
GML3.prototype.writeMultiSurfaceOrPolygon_),
|
||||
'Envelope': _ol_xml_.makeChildAppender(
|
||||
GML3.prototype.writeEnvelope)
|
||||
GML3.prototype.writeEnvelope)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1149,9 +1150,9 @@ GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_ = {
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var parentNode = objectStack[objectStack.length - 1].node;
|
||||
const parentNode = objectStack[objectStack.length - 1].node;
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
|
||||
GML3.MULTIGEOMETRY_TO_MEMBER_NODENAME_[parentNode.nodeName]);
|
||||
};
|
||||
|
||||
|
||||
@@ -1164,12 +1165,12 @@ GML3.prototype.MULTIGEOMETRY_MEMBER_NODE_FACTORY_ = function(value, objectStack,
|
||||
* @private
|
||||
*/
|
||||
GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeName) {
|
||||
var context = objectStack[objectStack.length - 1];
|
||||
var multiSurface = context['multiSurface'];
|
||||
var surface = context['surface'];
|
||||
var curve = context['curve'];
|
||||
var multiCurve = context['multiCurve'];
|
||||
var nodeName;
|
||||
const context = objectStack[objectStack.length - 1];
|
||||
const multiSurface = context['multiSurface'];
|
||||
const surface = context['surface'];
|
||||
const curve = context['curve'];
|
||||
const multiCurve = context['multiCurve'];
|
||||
let nodeName;
|
||||
if (!Array.isArray(value)) {
|
||||
nodeName = /** @type {ol.geom.Geometry} */ (value).getType();
|
||||
if (nodeName === 'MultiPolygon' && multiSurface === true) {
|
||||
@@ -1185,7 +1186,7 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
|
||||
nodeName = 'Envelope';
|
||||
}
|
||||
return _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
nodeName);
|
||||
nodeName);
|
||||
};
|
||||
|
||||
|
||||
@@ -1200,8 +1201,8 @@ GML3.prototype.GEOMETRY_NODE_FACTORY_ = function(value, objectStack, opt_nodeNam
|
||||
*/
|
||||
GML3.prototype.writeGeometryNode = function(geometry, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
var geom = _ol_xml_.createElementNS('http://www.opengis.net/gml', 'geom');
|
||||
var context = {node: geom, hasZ: this.hasZ, srsName: this.srsName,
|
||||
const geom = _ol_xml_.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_};
|
||||
if (opt_options) {
|
||||
@@ -1235,11 +1236,11 @@ GML3.prototype.writeFeatures;
|
||||
*/
|
||||
GML3.prototype.writeFeaturesNode = function(features, opt_options) {
|
||||
opt_options = this.adaptOptions(opt_options);
|
||||
var node = _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
'featureMembers');
|
||||
const node = _ol_xml_.createElementNS('http://www.opengis.net/gml',
|
||||
'featureMembers');
|
||||
_ol_xml_.setAttributeNS(node, 'http://www.w3.org/2001/XMLSchema-instance',
|
||||
'xsi:schemaLocation', this.schemaLocation);
|
||||
var context = {
|
||||
'xsi:schemaLocation', this.schemaLocation);
|
||||
const context = {
|
||||
srsName: this.srsName,
|
||||
hasZ: this.hasZ,
|
||||
curve: this.curve_,
|
||||
|
||||
Reference in New Issue
Block a user