From 289e571fb0acb4a4537937aafbb31ee905728e0c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 27 Jan 2016 11:33:12 +0100 Subject: [PATCH] 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 --- src/ol/feature.js | 6 ++-- src/ol/format/gml/gml2format.js | 12 ++++---- src/ol/format/gml/gml3format.js | 40 ++++++++++++-------------- src/ol/format/gml/gmlbaseformat.js | 26 ++++++++--------- src/ol/format/gpxformat.js | 12 ++++---- src/ol/format/kmlformat.js | 38 +++++++++++------------- src/ol/format/osmxmlformat.js | 8 ++++-- src/ol/format/wmscapabilitiesformat.js | 8 +++--- src/ol/geom/simplegeometry.js | 2 +- src/ol/pointer/touchsource.js | 2 +- src/ol/render/canvas/canvasreplay.js | 3 +- 11 files changed, 76 insertions(+), 81 deletions(-) diff --git a/src/ol/feature.js b/src/ol/feature.js index a99ff3747d..3d730a337f 100644 --- a/src/ol/feature.js +++ b/src/ol/feature.js @@ -98,13 +98,13 @@ ol.Feature = function(opt_geometryOrProperties) { if (opt_geometryOrProperties !== undefined) { if (opt_geometryOrProperties instanceof ol.geom.Geometry || !opt_geometryOrProperties) { - var geometry = /** @type {ol.geom.Geometry} */ (opt_geometryOrProperties); + var geometry = opt_geometryOrProperties; this.setGeometry(geometry); } else { goog.asserts.assert(goog.isObject(opt_geometryOrProperties), 'opt_geometryOrProperties should be an Object'); - var properties = /** @type {Object.} */ - (opt_geometryOrProperties); + /** @type {Object.} */ + var properties = opt_geometryOrProperties; this.setProperties(properties); } } diff --git a/src/ol/format/gml/gml2format.js b/src/ol/format/gml/gml2format.js index ff91f43de6..dc69fd0330 100644 --- a/src/ol/format/gml/gml2format.js +++ b/src/ol/format/gml/gml2format.js @@ -105,8 +105,8 @@ ol.format.GML2.prototype.readBox_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Box', 'localName should be Box'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([null]), + /** @type {Array.} */ + var flatCoordinates = ol.xml.pushParseAndPop([null], this.BOX_PARSERS_, node, objectStack, this); return ol.extent.createOrUpdate(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[1][3], @@ -124,8 +124,8 @@ ol.format.GML2.prototype.innerBoundaryIsParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'innerBoundaryIs', 'localName should be innerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ @@ -149,8 +149,8 @@ ol.format.GML2.prototype.outerBoundaryIsParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'outerBoundaryIs', 'localName should be outerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ diff --git a/src/ol/format/gml/gml3format.js b/src/ol/format/gml/gml3format.js index 7fa417d5fe..2696457e37 100644 --- a/src/ol/format/gml/gml3format.js +++ b/src/ol/format/gml/gml3format.js @@ -98,8 +98,8 @@ ol.format.GML3.prototype.readMultiCurve_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiCurve', 'localName should be MultiCurve'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + /** @type {Array.} */ + var lineStrings = ol.xml.pushParseAndPop([], this.MULTICURVE_PARSERS_, node, objectStack, this); if (lineStrings) { var multiLineString = new ol.geom.MultiLineString(null); @@ -122,8 +122,8 @@ ol.format.GML3.prototype.readMultiSurface_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiSurface', 'localName should be MultiSurface'); - var polygons = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + /** @type {Array.} */ + var polygons = ol.xml.pushParseAndPop([], this.MULTISURFACE_PARSERS_, node, objectStack, this); if (polygons) { var multiPolygon = new ol.geom.MultiPolygon(null); @@ -177,8 +177,7 @@ ol.format.GML3.prototype.readPatch_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'patches', 'localName should be patches'); - return ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([null]), + return ol.xml.pushParseAndPop([null], this.PATCHES_PARSERS_, node, objectStack, this); }; @@ -194,8 +193,7 @@ ol.format.GML3.prototype.readSegment_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'segments', 'localName should be segments'); - return ol.xml.pushParseAndPop( - /** @type {Array.} */ ([null]), + return ol.xml.pushParseAndPop([null], this.SEGMENTS_PARSERS_, node, objectStack, this); }; @@ -211,8 +209,7 @@ ol.format.GML3.prototype.readPolygonPatch_ = function(node, objectStack) { 'npde.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'PolygonPatch', 'localName should be PolygonPatch'); - return ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([null]), + return ol.xml.pushParseAndPop([null], 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'); goog.asserts.assert(node.localName == 'LineStringSegment', 'localName should be LineStringSegment'); - return ol.xml.pushParseAndPop( - /** @type {Array.} */ ([null]), + return ol.xml.pushParseAndPop([null], this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this); }; @@ -245,8 +241,8 @@ ol.format.GML3.prototype.interiorParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'interior', 'localName should be interior'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ @@ -270,8 +266,8 @@ ol.format.GML3.prototype.exteriorParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'exterior', 'localName should be exterior'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, this.RING_PARSERS, node, objectStack, this); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ @@ -296,8 +292,8 @@ ol.format.GML3.prototype.readSurface_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Surface', 'localName should be Surface'); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([null]), + /** @type {Array.>} */ + var flatLinearRings = ol.xml.pushParseAndPop([null], this.SURFACE_PARSERS_, node, objectStack, this); if (flatLinearRings && flatLinearRings[0]) { 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, 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Curve', 'localName should be Curve'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([null]), + /** @type {Array.} */ + var flatCoordinates = ol.xml.pushParseAndPop([null], this.CURVE_PARSERS_, node, objectStack, this); if (flatCoordinates) { var lineString = new ol.geom.LineString(null); @@ -351,8 +347,8 @@ ol.format.GML3.prototype.readEnvelope_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Envelope', 'localName should be Envelope'); - var flatCoordinates = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([null]), + /** @type {Array.} */ + var flatCoordinates = ol.xml.pushParseAndPop([null], this.ENVELOPE_PARSERS_, node, objectStack, this); return ol.extent.createOrUpdate(flatCoordinates[1][0], flatCoordinates[1][1], flatCoordinates[2][0], diff --git a/src/ol/format/gml/gmlbaseformat.js b/src/ol/format/gml/gmlbaseformat.js index 54d3626aa8..55ca4c5187 100644 --- a/src/ol/format/gml/gmlbaseformat.js +++ b/src/ol/format/gml/gmlbaseformat.js @@ -177,7 +177,8 @@ ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) { var context = objectStack[0]; goog.asserts.assert(goog.isObject(context), 'context should be an Object'); 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); if (geometry) { return /** @type {ol.geom.Geometry} */ ( @@ -261,8 +262,8 @@ ol.format.GMLBase.prototype.readMultiPoint = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiPoint', 'localName should be MultiPoint'); - var coordinates = ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([]), + /** @type {Array.>} */ + var coordinates = ol.xml.pushParseAndPop([], this.MULTIPOINT_PARSERS_, node, objectStack, this); if (coordinates) { return new ol.geom.MultiPoint(coordinates); @@ -282,8 +283,8 @@ ol.format.GMLBase.prototype.readMultiLineString = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiLineString', 'localName should be MultiLineString'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + /** @type {Array.} */ + var lineStrings = ol.xml.pushParseAndPop([], this.MULTILINESTRING_PARSERS_, node, objectStack, this); if (lineStrings) { var multiLineString = new ol.geom.MultiLineString(null); @@ -305,8 +306,8 @@ ol.format.GMLBase.prototype.readMultiPolygon = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiPolygon', 'localName should be MultiPolygon'); - var polygons = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + /** @type {Array.} */ + var polygons = ol.xml.pushParseAndPop([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this); if (polygons) { var multiPolygon = new ol.geom.MultiPolygon(null); @@ -399,7 +400,7 @@ ol.format.GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); - var ring = ol.xml.pushParseAndPop(/** @type {Array.} */(null), + var ring = ol.xml.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this); if (ring) { @@ -442,8 +443,8 @@ ol.format.GMLBase.prototype.readPolygon = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Polygon', 'localName should be Polygon'); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([null]), + /** @type {Array.>} */ + var flatLinearRings = ol.xml.pushParseAndPop([null], this.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack, this); if (flatLinearRings && flatLinearRings[0]) { 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) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); - return /** @type {Array.} */ (ol.xml.pushParseAndPop( - null, + return ol.xml.pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, - objectStack, this)); + objectStack, this); }; diff --git a/src/ol/format/gpxformat.js b/src/ol/format/gpxformat.js index ee51b3bf26..0f9cc027cc 100644 --- a/src/ol/format/gpxformat.js +++ b/src/ol/format/gpxformat.js @@ -486,8 +486,8 @@ ol.format.GPX.prototype.readFeaturesFromNode = function(node, opt_options) { return []; } if (node.localName == 'gpx') { - var features = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), ol.format.GPX.GPX_PARSERS_, + /** @type {Array.} */ + var features = ol.xml.pushParseAndPop([], ol.format.GPX.GPX_PARSERS_, node, [this.getReadOptions(node, opt_options)]); if (features) { this.handleReadExtensions_(features); @@ -600,7 +600,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) { var parentNode = objectStack[objectStack.length - 1].node; var orderedKeys = ol.format.GPX.RTE_SEQUENCE_[parentNode.namespaceURI]; 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, values, objectStack, orderedKeys); }; @@ -615,6 +615,7 @@ ol.format.GPX.writeRte_ = function(node, feature, objectStack) { ol.format.GPX.writeTrk_ = function(node, feature, objectStack) { var options = /** @type {olx.format.WriteOptions} */ (objectStack[0]); var properties = feature.getProperties(); + /** @type {ol.xml.NodeStackItem} */ var context = {node: node, 'properties': properties}; var geometry = feature.getGeometry(); if (geometry) { @@ -627,7 +628,7 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) { var parentNode = objectStack[objectStack.length - 1].node; var orderedKeys = ol.format.GPX.TRK_SEQUENCE_[parentNode.namespaceURI]; 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, values, objectStack, orderedKeys); }; @@ -640,9 +641,10 @@ ol.format.GPX.writeTrk_ = function(node, feature, objectStack) { * @private */ ol.format.GPX.writeTrkSeg_ = function(node, lineString, objectStack) { + /** @type {ol.xml.NodeStackItem} */ var context = {node: node, 'geometryLayout': lineString.getLayout(), 'properties': {}}; - ol.xml.pushSerializeAndPop(/** @type {ol.xml.NodeStackItem} */ (context), + ol.xml.pushSerializeAndPop(context, ol.format.GPX.TRKSEG_SERIALIZERS_, ol.format.GPX.TRKSEG_NODE_FACTORY_, lineString.getCoordinates(), objectStack); }; diff --git a/src/ol/format/kmlformat.js b/src/ol/format/kmlformat.js index 3cec0193f0..c9fdd07651 100644 --- a/src/ol/format/kmlformat.js +++ b/src/ol/format/kmlformat.js @@ -567,8 +567,7 @@ ol.format.KML.readScale_ = function(node) { * @return {Array.|string|undefined} StyleMap. */ ol.format.KML.readStyleMapValue_ = function(node, objectStack) { - return ol.xml.pushParseAndPop( - /** @type {Array.|string|undefined} */ (undefined), + return ol.xml.pushParseAndPop(undefined, ol.format.KML.STYLE_MAP_PARSERS_, node, objectStack); }; @@ -784,8 +783,8 @@ ol.format.KML.readFlatLinearRing_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); - return /** @type {Array.} */ (ol.xml.pushParseAndPop( - null, ol.format.KML.FLAT_LINEAR_RING_PARSERS_, node, objectStack)); + return ol.xml.pushParseAndPop(null, + 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'); goog.asserts.assert(node.localName == 'MultiTrack', 'localName should be MultiTrack'); - var lineStrings = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + var lineStrings = ol.xml.pushParseAndPop([], ol.format.KML.GX_MULTITRACK_GEOMETRY_PARSERS_, node, objectStack); if (!lineStrings) { return undefined; @@ -913,8 +911,8 @@ ol.format.KML.readIcon_ = function(node, objectStack) { ol.format.KML.readFlatCoordinatesFromNode_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); - return /** @type {Array.} */ (ol.xml.pushParseAndPop(null, - ol.format.KML.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack)); + return ol.xml.pushParseAndPop(null, + 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'); goog.asserts.assert(node.localName == 'LineString', 'localName should be LineString'); - var properties = ol.xml.pushParseAndPop(/** @type {Object} */ ({}), + var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = @@ -956,7 +954,7 @@ ol.format.KML.readLinearRing_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'LinearRing', 'localName should be LinearRing'); - var properties = ol.xml.pushParseAndPop(/** @type {Object} */ ({}), + var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = @@ -984,8 +982,7 @@ ol.format.KML.readMultiGeometry_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'MultiGeometry', 'localName should be MultiGeometry'); - var geometries = ol.xml.pushParseAndPop( - /** @type {Array.} */ ([]), + var geometries = ol.xml.pushParseAndPop([], ol.format.KML.MULTI_GEOMETRY_PARSERS_, node, objectStack); if (!geometries) { return null; @@ -1058,7 +1055,7 @@ ol.format.KML.readPoint_ = function(node, objectStack) { goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT, 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'Point', 'localName should be Point'); - var properties = ol.xml.pushParseAndPop(/** @type {Object} */ ({}), + var properties = ol.xml.pushParseAndPop({}, ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); var flatCoordinates = @@ -1090,8 +1087,7 @@ ol.format.KML.readPolygon_ = function(node, objectStack) { var properties = ol.xml.pushParseAndPop(/** @type {Object} */ ({}), ol.format.KML.EXTRUDE_AND_ALTITUDE_MODE_PARSERS_, node, objectStack); - var flatLinearRings = ol.xml.pushParseAndPop( - /** @type {Array.>} */ ([null]), + var flatLinearRings = ol.xml.pushParseAndPop([null], ol.format.KML.FLAT_LINEAR_RINGS_PARSERS_, node, objectStack); if (flatLinearRings && flatLinearRings[0]) { var polygon = new ol.geom.Polygon(null); @@ -1329,8 +1325,8 @@ ol.format.KML.innerBoundaryIsParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'innerBoundaryIs', 'localName should be innerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, ol.format.KML.INNER_BOUNDARY_IS_PARSERS_, node, objectStack); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ @@ -1354,8 +1350,8 @@ ol.format.KML.outerBoundaryIsParser_ = function(node, objectStack) { 'node.nodeType should be ELEMENT'); goog.asserts.assert(node.localName == 'outerBoundaryIs', 'localName should be outerBoundaryIs'); - var flatLinearRing = ol.xml.pushParseAndPop( - /** @type {Array.|undefined} */ (undefined), + /** @type {Array.|undefined} */ + var flatLinearRing = ol.xml.pushParseAndPop(undefined, ol.format.KML.OUTER_BOUNDARY_IS_PARSERS_, node, objectStack); if (flatLinearRing) { var flatLinearRings = /** @type {Array.>} */ @@ -1765,8 +1761,8 @@ ol.format.KML.prototype.readDocumentOrFolder_ = function(node, objectStack) { 'Style': this.readSharedStyle_.bind(this), 'StyleMap': this.readSharedStyleMap_.bind(this) }); - var features = ol.xml.pushParseAndPop(/** @type {Array.} */ ([]), - parsersNS, node, objectStack, this); + /** @type {Array.} */ + var features = ol.xml.pushParseAndPop([], parsersNS, node, objectStack, this); if (features) { return features; } else { diff --git a/src/ol/format/osmxmlformat.js b/src/ol/format/osmxmlformat.js index 54630e5526..d4a351e1ae 100644 --- a/src/ol/format/osmxmlformat.js +++ b/src/ol/format/osmxmlformat.js @@ -64,10 +64,11 @@ ol.format.OSMXML.readNode_ = function(node, objectStack) { var options = /** @type {olx.format.ReadOptions} */ (objectStack[0]); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); var id = node.getAttribute('id'); - var coordinates = /** @type {Array.} */ ([ + /** @type {ol.Coordinate} */ + var coordinates = [ parseFloat(node.getAttribute('lon')), parseFloat(node.getAttribute('lat')) - ]); + ]; state.nodes[id] = coordinates; var values = ol.xml.pushParseAndPop({ @@ -100,7 +101,8 @@ ol.format.OSMXML.readWay_ = function(node, objectStack) { tags: {} }, ol.format.OSMXML.WAY_PARSERS_, node, objectStack); var state = /** @type {Object} */ (objectStack[objectStack.length - 1]); - var flatCoordinates = /** @type {Array.} */ ([]); + /** @type {Array.} */ + var flatCoordinates = []; for (var i = 0, ii = values.ndrefs.length; i < ii; i++) { var point = state.nodes[values.ndrefs[i]]; ol.array.extend(flatCoordinates, point); diff --git a/src/ol/format/wmscapabilitiesformat.js b/src/ol/format/wmscapabilitiesformat.js index 0482cf659f..b9ae3f5bb5 100644 --- a/src/ol/format/wmscapabilitiesformat.js +++ b/src/ol/format/wmscapabilitiesformat.js @@ -154,10 +154,10 @@ ol.format.WMSCapabilities.readEXGeographicBoundingBox_ = function(node, objectSt eastBoundLongitude === undefined || northBoundLatitude === undefined) { return undefined; } - return /** @type {ol.Extent} */ ([ + return [ westBoundLongitude, southBoundLatitude, eastBoundLongitude, northBoundLatitude - ]); + ]; }; @@ -288,8 +288,8 @@ ol.format.WMSCapabilities.readLayer_ = function(node, objectStack) { var parentLayerObject = /** @type {Object.} */ (objectStack[objectStack.length - 1]); - var layerObject = /** @type {Object.} */ (ol.xml.pushParseAndPop( - {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack)); + var layerObject = ol.xml.pushParseAndPop( + {}, ol.format.WMSCapabilities.LAYER_PARSERS_, node, objectStack); if (!layerObject) { return undefined; diff --git a/src/ol/geom/simplegeometry.js b/src/ol/geom/simplegeometry.js index c1cbd6abf3..af14789c47 100644 --- a/src/ol/geom/simplegeometry.js +++ b/src/ol/geom/simplegeometry.js @@ -240,7 +240,7 @@ ol.geom.SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesti coordinates = /** @type {Array} */ (coordinates[0]); } } - stride = (/** @type {Array} */ (coordinates)).length; + stride = coordinates.length; layout = ol.geom.SimpleGeometry.getLayoutForStride_(stride); } this.layout = layout; diff --git a/src/ol/pointer/touchsource.js b/src/ol/pointer/touchsource.js index 9b218afc02..80098c1d1c 100644 --- a/src/ol/pointer/touchsource.js +++ b/src/ol/pointer/touchsource.js @@ -438,7 +438,7 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) { // only the primary finger will synth mouse events if (this.isPrimaryTouch_(t)) { // remember x/y of last touch - var lt = /** @type {ol.Pixel} */ ([t.clientX, t.clientY]); + var lt = [t.clientX, t.clientY]; lts.push(lt); goog.global.setTimeout(function() { diff --git a/src/ol/render/canvas/canvasreplay.js b/src/ol/render/canvas/canvasreplay.js index 9cc8dca3d7..5bd011f948 100644 --- a/src/ol/render/canvas/canvasreplay.js +++ b/src/ol/render/canvas/canvasreplay.js @@ -269,8 +269,7 @@ ol.render.canvas.Replay.prototype.replay_ = function( !feature.getGeometry()) { i = /** @type {number} */ (instruction[2]); } else if (opt_hitExtent !== undefined && !ol.extent.intersects( - /** @type {Array} */ (opt_hitExtent), - feature.getGeometry().getExtent())) { + opt_hitExtent, feature.getGeometry().getExtent())) { i = /** @type {number} */ (instruction[2]); } else { ++i;