Remove all remaining unnecessary casts
There is still such a cast in the goog library itself. See https://github.com/google/closure-library/pull/637
This commit is contained in:
+3
-3
@@ -98,13 +98,13 @@ ol.Feature = function(opt_geometryOrProperties) {
|
|||||||
if (opt_geometryOrProperties !== undefined) {
|
if (opt_geometryOrProperties !== undefined) {
|
||||||
if (opt_geometryOrProperties instanceof ol.geom.Geometry ||
|
if (opt_geometryOrProperties instanceof ol.geom.Geometry ||
|
||||||
!opt_geometryOrProperties) {
|
!opt_geometryOrProperties) {
|
||||||
var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrProperties);
|
var geometry = opt_geometryOrProperties;
|
||||||
this.setGeometry(geometry);
|
this.setGeometry(geometry);
|
||||||
} else {
|
} else {
|
||||||
goog.asserts.assert(goog.isObject(opt_geometryOrProperties),
|
goog.asserts.assert(goog.isObject(opt_geometryOrProperties),
|
||||||
'opt_geometryOrProperties should be an Object');
|
'opt_geometryOrProperties should be an Object');
|
||||||
var properties = /** @type {Object.<string, *>} */
|
/** @type {Object.<string, *>} */
|
||||||
(opt_geometryOrProperties);
|
var properties = opt_geometryOrProperties;
|
||||||
this.setProperties(properties);
|
this.setProperties(properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,8 +105,8 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Box', 'localName should be Box');
|
goog.asserts.assert(node.localName == 'Box', 'localName should be Box');
|
||||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>} */
|
||||||
/** @type {Array.<number>} */ ([null]),
|
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||||
this.BOX_PARSERS_, node, objectStack, this);
|
this.BOX_PARSERS_, node, objectStack, this);
|
||||||
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
||||||
flatCoordinates[1][1], flatCoordinates[1][3],
|
flatCoordinates[1][1], flatCoordinates[1][3],
|
||||||
@@ -124,8 +124,8 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
||||||
'localName should be innerBoundaryIs');
|
'localName should be innerBoundaryIs');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
this.RING_PARSERS, node, objectStack, this);
|
this.RING_PARSERS, node, objectStack, this);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
@@ -149,8 +149,8 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
||||||
'localName should be outerBoundaryIs');
|
'localName should be outerBoundaryIs');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
this.RING_PARSERS, node, objectStack, this);
|
this.RING_PARSERS, node, objectStack, this);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiCurve',
|
goog.asserts.assert(node.localName == 'MultiCurve',
|
||||||
'localName should be MultiCurve');
|
'localName should be MultiCurve');
|
||||||
var lineStrings = ol.xml.pushParseAndPop(
|
/** @type {Array.<ol.geom.LineString>} */
|
||||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
var lineStrings = ol.xml.pushParseAndPop([],
|
||||||
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
this.MULTICURVE_PARSERS_, node, objectStack, this);
|
||||||
if (lineStrings) {
|
if (lineStrings) {
|
||||||
var multiLineString = new ol.geom.MultiLineString(null);
|
var multiLineString = new ol.geom.MultiLineString(null);
|
||||||
@@ -122,8 +122,8 @@ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiSurface',
|
goog.asserts.assert(node.localName == 'MultiSurface',
|
||||||
'localName should be MultiSurface');
|
'localName should be MultiSurface');
|
||||||
var polygons = ol.xml.pushParseAndPop(
|
/** @type {Array.<ol.geom.Polygon>} */
|
||||||
/** @type {Array.<ol.geom.Polygon>} */ ([]),
|
var polygons = ol.xml.pushParseAndPop([],
|
||||||
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
this.MULTISURFACE_PARSERS_, node, objectStack, this);
|
||||||
if (polygons) {
|
if (polygons) {
|
||||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||||
@@ -177,8 +177,7 @@ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'patches',
|
goog.asserts.assert(node.localName == 'patches',
|
||||||
'localName should be patches');
|
'localName should be patches');
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop([null],
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
|
||||||
this.PATCHES_PARSERS_, node, objectStack, this);
|
this.PATCHES_PARSERS_, node, objectStack, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -194,8 +193,7 @@ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'segments',
|
goog.asserts.assert(node.localName == 'segments',
|
||||||
'localName should be segments');
|
'localName should be segments');
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop([null],
|
||||||
/** @type {Array.<number>} */ ([null]),
|
|
||||||
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
this.SEGMENTS_PARSERS_, node, objectStack, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -211,8 +209,7 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) {
|
|||||||
'npde.nodeType should be ELEMENT');
|
'npde.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'PolygonPatch',
|
goog.asserts.assert(node.localName == 'PolygonPatch',
|
||||||
'localName should be PolygonPatch');
|
'localName should be PolygonPatch');
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop([null],
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
|
||||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -228,8 +225,7 @@ ol.format.GML3.prototype.readLineStringSegment_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'LineStringSegment',
|
goog.asserts.assert(node.localName == 'LineStringSegment',
|
||||||
'localName should be LineStringSegment');
|
'localName should be LineStringSegment');
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop([null],
|
||||||
/** @type {Array.<number>} */ ([null]),
|
|
||||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
this.GEOMETRY_FLAT_COORDINATES_PARSERS_,
|
||||||
node, objectStack, this);
|
node, objectStack, this);
|
||||||
};
|
};
|
||||||
@@ -245,8 +241,8 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'interior',
|
goog.asserts.assert(node.localName == 'interior',
|
||||||
'localName should be interior');
|
'localName should be interior');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
this.RING_PARSERS, node, objectStack, this);
|
this.RING_PARSERS, node, objectStack, this);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
@@ -270,8 +266,8 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'exterior',
|
goog.asserts.assert(node.localName == 'exterior',
|
||||||
'localName should be exterior');
|
'localName should be exterior');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
this.RING_PARSERS, node, objectStack, this);
|
this.RING_PARSERS, node, objectStack, this);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
@@ -296,8 +292,8 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Surface',
|
goog.asserts.assert(node.localName == 'Surface',
|
||||||
'localName should be Surface');
|
'localName should be Surface');
|
||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
/** @type {Array.<Array.<number>>} */
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||||
this.SURFACE_PARSERS_, node, objectStack, this);
|
this.SURFACE_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
@@ -327,8 +323,8 @@ ol.format.GML3.prototype.readCurve_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Curve', 'localName should be Curve');
|
goog.asserts.assert(node.localName == 'Curve', 'localName should be Curve');
|
||||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>} */
|
||||||
/** @type {Array.<number>} */ ([null]),
|
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||||
this.CURVE_PARSERS_, node, objectStack, this);
|
this.CURVE_PARSERS_, node, objectStack, this);
|
||||||
if (flatCoordinates) {
|
if (flatCoordinates) {
|
||||||
var lineString = new ol.geom.LineString(null);
|
var lineString = new ol.geom.LineString(null);
|
||||||
@@ -351,8 +347,8 @@ ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Envelope',
|
goog.asserts.assert(node.localName == 'Envelope',
|
||||||
'localName should be Envelope');
|
'localName should be Envelope');
|
||||||
var flatCoordinates = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>} */
|
||||||
/** @type {Array.<number>} */ ([null]),
|
var flatCoordinates = ol.xml.pushParseAndPop([null],
|
||||||
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
this.ENVELOPE_PARSERS_, node, objectStack, this);
|
||||||
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
return ol.extent.createOrUpdate(flatCoordinates[1][0],
|
||||||
flatCoordinates[1][1], flatCoordinates[2][0],
|
flatCoordinates[1][1], flatCoordinates[2][0],
|
||||||
|
|||||||
@@ -177,7 +177,8 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
|
|||||||
var context = objectStack[0];
|
var context = objectStack[0];
|
||||||
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
goog.asserts.assert(goog.isObject(context), 'context should be an Object');
|
||||||
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
context['srsName'] = node.firstElementChild.getAttribute('srsName');
|
||||||
var geometry = ol.xml.pushParseAndPop(/** @type {ol.geom.Geometry} */(null),
|
/** @type {ol.geom.Geometry} */
|
||||||
|
var geometry = ol.xml.pushParseAndPop(null,
|
||||||
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
this.GEOMETRY_PARSERS_, node, objectStack, this);
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
return /** @type {ol.geom.Geometry} */ (
|
return /** @type {ol.geom.Geometry} */ (
|
||||||
@@ -261,8 +262,8 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiPoint',
|
goog.asserts.assert(node.localName == 'MultiPoint',
|
||||||
'localName should be MultiPoint');
|
'localName should be MultiPoint');
|
||||||
var coordinates = ol.xml.pushParseAndPop(
|
/** @type {Array.<Array.<number>>} */
|
||||||
/** @type {Array.<Array.<number>>} */ ([]),
|
var coordinates = ol.xml.pushParseAndPop([],
|
||||||
this.MULTIPOINT_PARSERS_, node, objectStack, this);
|
this.MULTIPOINT_PARSERS_, node, objectStack, this);
|
||||||
if (coordinates) {
|
if (coordinates) {
|
||||||
return new ol.geom.MultiPoint(coordinates);
|
return new ol.geom.MultiPoint(coordinates);
|
||||||
@@ -282,8 +283,8 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiLineString',
|
goog.asserts.assert(node.localName == 'MultiLineString',
|
||||||
'localName should be MultiLineString');
|
'localName should be MultiLineString');
|
||||||
var lineStrings = ol.xml.pushParseAndPop(
|
/** @type {Array.<ol.geom.LineString>} */
|
||||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
var lineStrings = ol.xml.pushParseAndPop([],
|
||||||
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
this.MULTILINESTRING_PARSERS_, node, objectStack, this);
|
||||||
if (lineStrings) {
|
if (lineStrings) {
|
||||||
var multiLineString = new ol.geom.MultiLineString(null);
|
var multiLineString = new ol.geom.MultiLineString(null);
|
||||||
@@ -305,8 +306,8 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiPolygon',
|
goog.asserts.assert(node.localName == 'MultiPolygon',
|
||||||
'localName should be MultiPolygon');
|
'localName should be MultiPolygon');
|
||||||
var polygons = ol.xml.pushParseAndPop(
|
/** @type {Array.<ol.geom.Polygon>} */
|
||||||
/** @type {Array.<ol.geom.Polygon>} */ ([]),
|
var polygons = ol.xml.pushParseAndPop([],
|
||||||
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
|
||||||
if (polygons) {
|
if (polygons) {
|
||||||
var multiPolygon = new ol.geom.MultiPolygon(null);
|
var multiPolygon = new ol.geom.MultiPolygon(null);
|
||||||
@@ -399,7 +400,7 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'LinearRing',
|
goog.asserts.assert(node.localName == 'LinearRing',
|
||||||
'localName should be LinearRing');
|
'localName should be LinearRing');
|
||||||
var ring = ol.xml.pushParseAndPop(/** @type {Array.<number>} */(null),
|
var ring = ol.xml.pushParseAndPop(null,
|
||||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||||
objectStack, this);
|
objectStack, this);
|
||||||
if (ring) {
|
if (ring) {
|
||||||
@@ -442,8 +443,8 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Polygon',
|
goog.asserts.assert(node.localName == 'Polygon',
|
||||||
'localName should be Polygon');
|
'localName should be Polygon');
|
||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
/** @type {Array.<Array.<number>>} */
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||||
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
@@ -472,10 +473,9 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) {
|
|||||||
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
ol.format.GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(null,
|
||||||
null,
|
|
||||||
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
|
||||||
objectStack, this));
|
objectStack, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -486,8 +486,8 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (node.localName == 'gpx') {
|
if (node.localName == 'gpx') {
|
||||||
var features = ol.xml.pushParseAndPop(
|
/** @type {Array.<ol.Feature>} */
|
||||||
/** @type {Array.<ol.Feature>} */ ([]), ol.format.GPX.GPX_PARSERS_,
|
var features = ol.xml.pushParseAndPop([], ol.format.GPX.GPX_PARSERS_,
|
||||||
node, [this.getReadOptions(node, opt_options)]);
|
node, [this.getReadOptions(node, opt_options)]);
|
||||||
if (features) {
|
if (features) {
|
||||||
this.handleReadExtensions_(features);
|
this.handleReadExtensions_(features);
|
||||||
@@ -600,7 +600,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
|
|||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI];
|
var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI];
|
||||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
ol.xml.pushSerializeAndPop(context,
|
||||||
ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
ol.format.GPX.RTE_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
||||||
values, objectStack, orderedKeys);
|
values, objectStack, orderedKeys);
|
||||||
};
|
};
|
||||||
@@ -615,6 +615,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) {
|
|||||||
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
||||||
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
|
var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]);
|
||||||
var properties = feature.getProperties();
|
var properties = feature.getProperties();
|
||||||
|
/** @type {ol.xml.NodeStackItem} */
|
||||||
var context = {node: node, 'properties': properties};
|
var context = {node: node, 'properties': properties};
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
if (geometry) {
|
if (geometry) {
|
||||||
@@ -627,7 +628,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
|||||||
var parentNode = objectStack[objectStack.length - 1].node;
|
var parentNode = objectStack[objectStack.length - 1].node;
|
||||||
var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI];
|
var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI];
|
||||||
var values = ol.xml.makeSequence(properties, orderedKeys);
|
var values = ol.xml.makeSequence(properties, orderedKeys);
|
||||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
ol.xml.pushSerializeAndPop(context,
|
||||||
ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
ol.format.GPX.TRK_SERIALIZERS_, ol.xml.OBJECT_PROPERTY_NODE_FACTORY,
|
||||||
values, objectStack, orderedKeys);
|
values, objectStack, orderedKeys);
|
||||||
};
|
};
|
||||||
@@ -640,9 +641,10 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
|
ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) {
|
||||||
|
/** @type {ol.xml.NodeStackItem} */
|
||||||
var context = {node: node, 'geometryLayout': lineString.getLayout(),
|
var context = {node: node, 'geometryLayout': lineString.getLayout(),
|
||||||
'properties': {}};
|
'properties': {}};
|
||||||
ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context),
|
ol.xml.pushSerializeAndPop(context,
|
||||||
ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_,
|
ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_,
|
||||||
lineString.getCoordinates(), objectStack);
|
lineString.getCoordinates(), objectStack);
|
||||||
};
|
};
|
||||||
|
|||||||
+17
-21
@@ -567,8 +567,7 @@ ol.format.KML.readScale_ = function(node) {
|
|||||||
* @return {Array.<ol.style.Style>|string|undefined} StyleMap.
|
* @return {Array.<ol.style.Style>|string|undefined} StyleMap.
|
||||||
*/
|
*/
|
||||||
ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
|
ol.format.KML.readStyleMapValue_ = function(node, objectStack) {
|
||||||
return ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(undefined,
|
||||||
/** @type {Array.<ol.style.Style>|string|undefined} */ (undefined),
|
|
||||||
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
|
ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -784,8 +783,8 @@ ol.format.KML.readFlatLinearRing_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'LinearRing',
|
goog.asserts.assert(node.localName == 'LinearRing',
|
||||||
'localName should be LinearRing');
|
'localName should be LinearRing');
|
||||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(
|
return ol.xml.pushParseAndPop(null,
|
||||||
null, ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack));
|
ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -835,8 +834,7 @@ ol.format.KML.readGxMultiTrack_ = function(node, objectStack) {
|
|||||||
'namespaceURI of the node should be known to the KML parser');
|
'namespaceURI of the node should be known to the KML parser');
|
||||||
goog.asserts.assert(node.localName == 'MultiTrack',
|
goog.asserts.assert(node.localName == 'MultiTrack',
|
||||||
'localName should be MultiTrack');
|
'localName should be MultiTrack');
|
||||||
var lineStrings = ol.xml.pushParseAndPop(
|
var lineStrings = ol.xml.pushParseAndPop([],
|
||||||
/** @type {Array.<ol.geom.LineString>} */ ([]),
|
|
||||||
ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack);
|
ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack);
|
||||||
if (!lineStrings) {
|
if (!lineStrings) {
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -913,8 +911,8 @@ ol.format.KML.readIcon_ = function(node, objectStack) {
|
|||||||
ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) {
|
||||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
return /** @type {Array.<number>} */ (ol.xml.pushParseAndPop(null,
|
return ol.xml.pushParseAndPop(null,
|
||||||
ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack));
|
ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -929,7 +927,7 @@ ol.format.KML.readLineString_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'LineString',
|
goog.asserts.assert(node.localName == 'LineString',
|
||||||
'localName should be LineString');
|
'localName should be LineString');
|
||||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
var properties = ol.xml.pushParseAndPop({},
|
||||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||||
objectStack);
|
objectStack);
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
@@ -956,7 +954,7 @@ ol.format.KML.readLinearRing_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'LinearRing',
|
goog.asserts.assert(node.localName == 'LinearRing',
|
||||||
'localName should be LinearRing');
|
'localName should be LinearRing');
|
||||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
var properties = ol.xml.pushParseAndPop({},
|
||||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||||
objectStack);
|
objectStack);
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
@@ -984,8 +982,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'MultiGeometry',
|
goog.asserts.assert(node.localName == 'MultiGeometry',
|
||||||
'localName should be MultiGeometry');
|
'localName should be MultiGeometry');
|
||||||
var geometries = ol.xml.pushParseAndPop(
|
var geometries = ol.xml.pushParseAndPop([],
|
||||||
/** @type {Array.<ol.geom.Geometry>} */ ([]),
|
|
||||||
ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack);
|
ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack);
|
||||||
if (!geometries) {
|
if (!geometries) {
|
||||||
return null;
|
return null;
|
||||||
@@ -1058,7 +1055,7 @@ ol.format.KML.readPoint_ = function(node, objectStack) {
|
|||||||
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
|
||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'Point', 'localName should be Point');
|
goog.asserts.assert(node.localName == 'Point', 'localName should be Point');
|
||||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
var properties = ol.xml.pushParseAndPop({},
|
||||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||||
objectStack);
|
objectStack);
|
||||||
var flatCoordinates =
|
var flatCoordinates =
|
||||||
@@ -1090,8 +1087,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) {
|
|||||||
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
var properties = ol.xml.pushParseAndPop(/** @type {Object<string,*>} */ ({}),
|
||||||
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node,
|
||||||
objectStack);
|
objectStack);
|
||||||
var flatLinearRings = ol.xml.pushParseAndPop(
|
var flatLinearRings = ol.xml.pushParseAndPop([null],
|
||||||
/** @type {Array.<Array.<number>>} */ ([null]),
|
|
||||||
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack);
|
||||||
if (flatLinearRings && flatLinearRings[0]) {
|
if (flatLinearRings && flatLinearRings[0]) {
|
||||||
var polygon = new ol.geom.Polygon(null);
|
var polygon = new ol.geom.Polygon(null);
|
||||||
@@ -1329,8 +1325,8 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
goog.asserts.assert(node.localName == 'innerBoundaryIs',
|
||||||
'localName should be innerBoundaryIs');
|
'localName should be innerBoundaryIs');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
ol.format.KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
ol.format.KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
@@ -1354,8 +1350,8 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) {
|
|||||||
'node.nodeType should be ELEMENT');
|
'node.nodeType should be ELEMENT');
|
||||||
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
goog.asserts.assert(node.localName == 'outerBoundaryIs',
|
||||||
'localName should be outerBoundaryIs');
|
'localName should be outerBoundaryIs');
|
||||||
var flatLinearRing = ol.xml.pushParseAndPop(
|
/** @type {Array.<number>|undefined} */
|
||||||
/** @type {Array.<number>|undefined} */ (undefined),
|
var flatLinearRing = ol.xml.pushParseAndPop(undefined,
|
||||||
ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack);
|
||||||
if (flatLinearRing) {
|
if (flatLinearRing) {
|
||||||
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
var flatLinearRings = /** @type {Array.<Array.<number>>} */
|
||||||
@@ -1765,8 +1761,8 @@ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) {
|
|||||||
'Style': this.readSharedStyle_.bind(this),
|
'Style': this.readSharedStyle_.bind(this),
|
||||||
'StyleMap': this.readSharedStyleMap_.bind(this)
|
'StyleMap': this.readSharedStyleMap_.bind(this)
|
||||||
});
|
});
|
||||||
var features = ol.xml.pushParseAndPop(/** @type {Array.<ol.Feature>} */ ([]),
|
/** @type {Array.<ol.Feature>} */
|
||||||
parsersNS, node, objectStack, this);
|
var features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack, this);
|
||||||
if (features) {
|
if (features) {
|
||||||
return features;
|
return features;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -64,10 +64,11 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) {
|
|||||||
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]);
|
||||||
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||||
var id = node.getAttribute('id');
|
var id = node.getAttribute('id');
|
||||||
var coordinates = /** @type {Array.<number>} */ ([
|
/** @type {ol.Coordinate} */
|
||||||
|
var coordinates = [
|
||||||
parseFloat(node.getAttribute('lon')),
|
parseFloat(node.getAttribute('lon')),
|
||||||
parseFloat(node.getAttribute('lat'))
|
parseFloat(node.getAttribute('lat'))
|
||||||
]);
|
];
|
||||||
state.nodes[id] = coordinates;
|
state.nodes[id] = coordinates;
|
||||||
|
|
||||||
var values = ol.xml.pushParseAndPop({
|
var values = ol.xml.pushParseAndPop({
|
||||||
@@ -100,7 +101,8 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) {
|
|||||||
tags: {}
|
tags: {}
|
||||||
}, ol.format.OSMXML.WAY_PARSERS_, node, objectStack);
|
}, ol.format.OSMXML.WAY_PARSERS_, node, objectStack);
|
||||||
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
var state = /** @type {Object} */ (objectStack[objectStack.length - 1]);
|
||||||
var flatCoordinates = /** @type {Array.<number>} */ ([]);
|
/** @type {Array.<number>} */
|
||||||
|
var flatCoordinates = [];
|
||||||
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
|
for (var i = 0, ii = values.ndrefs.length; i < ii; i++) {
|
||||||
var point = state.nodes[values.ndrefs[i]];
|
var point = state.nodes[values.ndrefs[i]];
|
||||||
ol.array.extend(flatCoordinates, point);
|
ol.array.extend(flatCoordinates, point);
|
||||||
|
|||||||
@@ -154,10 +154,10 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt
|
|||||||
eastBoundLongitude === undefined || northBoundLatitude === undefined) {
|
eastBoundLongitude === undefined || northBoundLatitude === undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return /** @type {ol.Extent} */ ([
|
return [
|
||||||
westBoundLongitude, southBoundLatitude,
|
westBoundLongitude, southBoundLatitude,
|
||||||
eastBoundLongitude, northBoundLatitude
|
eastBoundLongitude, northBoundLatitude
|
||||||
]);
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -288,8 +288,8 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) {
|
|||||||
var parentLayerObject = /** @type {Object.<string,*>} */
|
var parentLayerObject = /** @type {Object.<string,*>} */
|
||||||
(objectStack[objectStack.length - 1]);
|
(objectStack[objectStack.length - 1]);
|
||||||
|
|
||||||
var layerObject = /** @type {Object.<string,*>} */ (ol.xml.pushParseAndPop(
|
var layerObject = ol.xml.pushParseAndPop(
|
||||||
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack));
|
{}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack);
|
||||||
|
|
||||||
if (!layerObject) {
|
if (!layerObject) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesti
|
|||||||
coordinates = /** @type {Array} */ (coordinates[0]);
|
coordinates = /** @type {Array} */ (coordinates[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stride = (/** @type {Array} */ (coordinates)).length;
|
stride = coordinates.length;
|
||||||
layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride);
|
layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride);
|
||||||
}
|
}
|
||||||
this.layout = layout;
|
this.layout = layout;
|
||||||
|
|||||||
@@ -438,7 +438,7 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
|
|||||||
// only the primary finger will synth mouse events
|
// only the primary finger will synth mouse events
|
||||||
if (this.isPrimaryTouch_(t)) {
|
if (this.isPrimaryTouch_(t)) {
|
||||||
// remember x/y of last touch
|
// remember x/y of last touch
|
||||||
var lt = /** @type {ol.Pixel} */ ([t.clientX, t.clientY]);
|
var lt = [t.clientX, t.clientY];
|
||||||
lts.push(lt);
|
lts.push(lt);
|
||||||
|
|
||||||
goog.global.setTimeout(function() {
|
goog.global.setTimeout(function() {
|
||||||
|
|||||||
@@ -269,8 +269,7 @@ ol.render.canvas.Replay.prototype.replay_ = function(
|
|||||||
!feature.getGeometry()) {
|
!feature.getGeometry()) {
|
||||||
i = /** @type {number} */ (instruction[2]);
|
i = /** @type {number} */ (instruction[2]);
|
||||||
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
} else if (opt_hitExtent !== undefined && !ol.extent.intersects(
|
||||||
/** @type {Array<number>} */ (opt_hitExtent),
|
opt_hitExtent, feature.getGeometry().getExtent())) {
|
||||||
feature.getGeometry().getExtent())) {
|
|
||||||
i = /** @type {number} */ (instruction[2]);
|
i = /** @type {number} */ (instruction[2]);
|
||||||
} else {
|
} else {
|
||||||
++i;
|
++i;
|
||||||
|
|||||||
Reference in New Issue
Block a user