diff --git a/src/ol/geom/geometry.js b/src/ol/geom/geometry.js index e3e534e76c..0037f6de4a 100644 --- a/src/ol/geom/geometry.js +++ b/src/ol/geom/geometry.js @@ -114,3 +114,9 @@ ol.geom.Geometry.prototype.getStride = function() { * @return {ol.geom.GeometryType} Geometry type. */ ol.geom.Geometry.prototype.getType = goog.abstractMethod; + + +/** + * @param {ol.TransformFunction} transformFn Transform. + */ +ol.geom.Geometry.prototype.transform = goog.abstractMethod; diff --git a/src/ol/geom/linestring.js b/src/ol/geom/linestring.js index af34ea6417..3750973196 100644 --- a/src/ol/geom/linestring.js +++ b/src/ol/geom/linestring.js @@ -62,3 +62,16 @@ ol.geom.LineString.prototype.setCoordinates = function(coordinates) { this.coordinates_ = coordinates; this.dispatchChangeEvent(); }; + + +/** + * @inheritDoc + */ +ol.geom.LineString.prototype.transform = function(transformFn) { + var coordinates = this.coordinates_; + var i, ii; + for (i = 0, ii = coordinates.length; i < ii; ++i) { + var coordinate = coordinates[i]; + transformFn(coordinate, coordinate, 2); + } +}; diff --git a/src/ol/geom/multilinestring.js b/src/ol/geom/multilinestring.js index 85370911bb..f42ad41be8 100644 --- a/src/ol/geom/multilinestring.js +++ b/src/ol/geom/multilinestring.js @@ -65,3 +65,20 @@ ol.geom.MultiLineString.prototype.getType = function() { ol.geom.MultiLineString.prototype.setCoordinatess = function(coordinatess) { this.coordinatess_ = coordinatess; }; + + +/** + * @inheritDoc + */ +ol.geom.MultiLineString.prototype.transform = function(transformFn) { + var coordinatess = this.coordinatess_; + var i, ii; + for (i = 0, ii = coordinatess.length; i < ii; ++i) { + var coordinates = coordinatess[i]; + var j, jj; + for (j = 0, jj = coordinates.length; j < jj; ++j) { + var coordinate = coordinates[j]; + transformFn(coordinate, coordinate, 2); + } + } +}; diff --git a/src/ol/geom/multipolygon.js b/src/ol/geom/multipolygon.js index 5d0b6dca13..19f5ca1e08 100644 --- a/src/ol/geom/multipolygon.js +++ b/src/ol/geom/multipolygon.js @@ -65,3 +65,24 @@ ol.geom.MultiPolygon.prototype.setRingss = function(ringss) { this.ringss_ = ringss; this.dispatchChangeEvent(); }; + + +/** + * @inheritDoc + */ +ol.geom.MultiPolygon.prototype.transform = function(transformFn) { + var ringss = this.ringss_; + var i, ii; + for (i = 0, ii = ringss.length; i < ii; ++i) { + var rings = ringss[i]; + var j, jj; + for (j = 0, jj = rings.length; j < jj; ++j) { + var coordinates = rings[j]; + var k, kk; + for (k = 0, kk = coordinates.length; k < kk; ++k) { + var coordinate = coordinates[k]; + transformFn(coordinate, coordinate, 2); + } + } + } +}; diff --git a/src/ol/geom/polygon.js b/src/ol/geom/polygon.js index 4274964c46..5d84c063b6 100644 --- a/src/ol/geom/polygon.js +++ b/src/ol/geom/polygon.js @@ -61,3 +61,20 @@ ol.geom.Polygon.prototype.setRings = function(rings) { this.rings_ = rings; this.dispatchChangeEvent(); }; + + +/** + * @inheritDoc + */ +ol.geom.Polygon.prototype.transform = function(transformFn) { + var rings = this.rings_; + var i, ii; + for (i = 0, ii = rings.length; i < ii; ++i) { + var coordinates = rings[i]; + var j, jj; + for (j = 0, jj = coordinates.length; j < jj; ++j) { + var coordinate = coordinates[j]; + transformFn(coordinate, coordinate, 2); + } + } +};