Consistent circle transform
Depending on compilation flags, applying a transform used to either: - work; - fail throwing an abstract method not implemented message; - fail silently. Now it should consistently work, like the other geometries. Adding a polygon factory method creating an approximation of a circle on a plane would be useful for users wanting the circle to be deformed. It would be similar to the `circular` function which creates an approximation of a circle on a sphere.
This commit is contained in:
@@ -5,6 +5,7 @@ goog.require('ol.extent');
|
||||
goog.require('ol.geom.GeometryType');
|
||||
goog.require('ol.geom.SimpleGeometry');
|
||||
goog.require('ol.geom.flat.deflate');
|
||||
goog.require('ol.proj');
|
||||
|
||||
|
||||
|
||||
@@ -199,6 +200,7 @@ ol.geom.Circle.prototype.setFlatCoordinates =
|
||||
|
||||
|
||||
/**
|
||||
* The radius is in the units of the projection.
|
||||
* @param {number} radius Radius.
|
||||
* @api
|
||||
*/
|
||||
@@ -210,6 +212,25 @@ ol.geom.Circle.prototype.setRadius = function(radius) {
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* Transform each coordinate of the circle from one coordinate reference system
|
||||
* to another. The geometry is modified in place.
|
||||
* If you do not want the geometry modified in place, first clone() it and
|
||||
* then use this function on the clone.
|
||||
*
|
||||
* Internally a circle is currently represented by two points: the center of
|
||||
* the circle `[cx, cy]`, and the point to the right of the circle
|
||||
* `[cx + r, cy]`. This `transform` function just transforms these two points.
|
||||
* So the resulting geometry is also a circle, and that circle does not
|
||||
* correspond to the shape that would be obtained by transforming every point
|
||||
* of the original circle.
|
||||
*
|
||||
* @param {ol.proj.ProjectionLike} source The current projection. Can be a
|
||||
* string identifier or a {@link ol.proj.Projection} object.
|
||||
* @param {ol.proj.ProjectionLike} destination The desired projection. Can be a
|
||||
* string identifier or a {@link ol.proj.Projection} object.
|
||||
* @return {ol.geom.Circle} This geometry. Note that original geometry is
|
||||
* modified in place.
|
||||
* @function
|
||||
* @api stable
|
||||
*/
|
||||
ol.geom.Circle.prototype.applyTransform = goog.abstractMethod;
|
||||
ol.geom.Circle.prototype.transform;
|
||||
|
||||
Reference in New Issue
Block a user