Improve type checking with cast

This commit is contained in:
Tom Payne
2013-11-10 02:21:13 +01:00
parent b46c38626b
commit d10fb12f27

View File

@@ -151,6 +151,7 @@ ol.geom.Geometry.prototype.getType = goog.abstractMethod;
*/
ol.geom.Geometry.prototype.setLayout =
function(layout, coordinates, nesting) {
/** @type {number} */
var stride;
if (goog.isDef(layout)) {
if (layout == ol.geom.Layout.XY) {
@@ -175,7 +176,7 @@ ol.geom.Geometry.prototype.setLayout =
coordinates = coordinates[0];
}
}
stride = coordinates.length;
stride = (/** @type {Array} */ (coordinates)).length;
if (stride == 2) {
layout = ol.geom.Layout.XY;
} else if (stride == 3) {