Move ol.Sphere#circle to ol.geom.Polygon.circular
Previously, ol.geom.Polygon was a transitive dependency of ol.proj (since ol.proj requires ol.sphere.NORMAL, and all spheres were capable of generating circular polygons). Instead, ol.proj should be lower-level. Since it deals only with coordinate arrays, it shouldn't depend on all of the geometry code. By adding a static `circular` function to `ol.geom.Polygon`, the dependency tree makes more sense. If you want to create a polygon that approximates a circle on a sphere, you require `ol.geom.Polygon` and `ol.Sphere` (or one of the constants). This makes room for geometries to have a `transform` method that takes projection-like arguments (meaning that `ol.geom.Geometry` will require `ol.proj`).
This commit is contained in:
@@ -11,6 +11,7 @@ goog.require('ol.BrowserFeature');
|
||||
goog.require('ol.Coordinate');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.sphere.WGS84');
|
||||
|
||||
@@ -186,7 +187,8 @@ ol.Geolocation.prototype.positionChange_ = function(position) {
|
||||
this.set(ol.GeolocationProperty.POSITION, projectedPosition);
|
||||
this.set(ol.GeolocationProperty.SPEED,
|
||||
goog.isNull(coords.speed) ? undefined : coords.speed);
|
||||
var geometry = ol.sphere.WGS84.circle(this.position_, coords.accuracy);
|
||||
var geometry = ol.geom.Polygon.circular(
|
||||
ol.sphere.WGS84, this.position_, coords.accuracy);
|
||||
geometry.applyTransform(this.transform_);
|
||||
this.set(ol.GeolocationProperty.ACCURACY_GEOMETRY, geometry);
|
||||
this.dispatchChangeEvent();
|
||||
|
||||
Reference in New Issue
Block a user