+3
-2
@@ -1,12 +1,12 @@
|
|||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.Map');
|
goog.require('ol.Map');
|
||||||
|
goog.require('ol.Sphere');
|
||||||
goog.require('ol.View');
|
goog.require('ol.View');
|
||||||
goog.require('ol.geom.Polygon');
|
goog.require('ol.geom.Polygon');
|
||||||
goog.require('ol.layer.Tile');
|
goog.require('ol.layer.Tile');
|
||||||
goog.require('ol.layer.Vector');
|
goog.require('ol.layer.Vector');
|
||||||
goog.require('ol.source.TileWMS');
|
goog.require('ol.source.TileWMS');
|
||||||
goog.require('ol.source.Vector');
|
goog.require('ol.source.Vector');
|
||||||
goog.require('ol.sphere.WGS84');
|
|
||||||
|
|
||||||
var vectorSource = new ol.source.Vector();
|
var vectorSource = new ol.source.Vector();
|
||||||
|
|
||||||
@@ -33,11 +33,12 @@ var map = new ol.Map({
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var wgs84Sphere = new ol.Sphere(6378137);
|
||||||
|
|
||||||
var radius = 800000;
|
var radius = 800000;
|
||||||
for (var x = -180; x < 180; x += 30) {
|
for (var x = -180; x < 180; x += 30) {
|
||||||
for (var y = -90; y < 90; y += 30) {
|
for (var y = -90; y < 90; y += 30) {
|
||||||
var circle = ol.geom.Polygon.circular(ol.sphere.WGS84, [x, y], radius, 64);
|
var circle = ol.geom.Polygon.circular(wgs84Sphere, [x, y], radius, 64);
|
||||||
vectorSource.addFeature(new ol.Feature(circle));
|
vectorSource.addFeature(new ol.Feature(circle));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,20 @@ goog.require('goog.math');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Class to create objects that can be used with {@link
|
||||||
|
* ol.geom.Polygon.circular}.
|
||||||
|
*
|
||||||
|
* For example to create a sphere whose radius is equal to the semi-major
|
||||||
|
* axis of the WGS84 ellipsoid:
|
||||||
|
*
|
||||||
|
* ```js
|
||||||
|
* var wgs84Sphere= new ol.Sphere(6378137);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {number} radius Radius.
|
* @param {number} radius Radius.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.Sphere = function(radius) {
|
ol.Sphere = function(radius) {
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,5 @@ goog.require('ol.Sphere');
|
|||||||
* A sphere with radius equal to the semi-major axis of the WGS84 ellipsoid.
|
* A sphere with radius equal to the semi-major axis of the WGS84 ellipsoid.
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.Sphere}
|
* @type {ol.Sphere}
|
||||||
* @api
|
|
||||||
*/
|
*/
|
||||||
ol.sphere.WGS84 = new ol.Sphere(6378137);
|
ol.sphere.WGS84 = new ol.Sphere(6378137);
|
||||||
|
|||||||
Reference in New Issue
Block a user