diff options
author | Aditi <aditi.iitr@gmail.com> | 2013-06-21 23:09:22 +0530 |
---|---|---|
committer | Aditi <aditi.iitr@gmail.com> | 2013-06-21 23:09:22 +0530 |
commit | 2719d546a57c2332e36cc056ac80ec5d79672c1a (patch) | |
tree | 1f62ab8f761026d4faa5442032df133fc90d47f2 /extlib/leaflet/src/layer/vector/Circle.js | |
parent | 1a6f065419290b3f4234ce4a89bb2c46b13e8a12 (diff) | |
parent | 92b22e7deac547835f69168f97012b52e87b6de4 (diff) | |
download | mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.lz mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.tar.xz mediagoblin-2719d546a57c2332e36cc056ac80ec5d79672c1a.zip |
Merge remote-tracking branch 'cweb/master'
Diffstat (limited to 'extlib/leaflet/src/layer/vector/Circle.js')
-rw-r--r-- | extlib/leaflet/src/layer/vector/Circle.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/extlib/leaflet/src/layer/vector/Circle.js b/extlib/leaflet/src/layer/vector/Circle.js new file mode 100644 index 00000000..c737c191 --- /dev/null +++ b/extlib/leaflet/src/layer/vector/Circle.js @@ -0,0 +1,51 @@ +/*
+ * L.Circle is a circle overlay (with a certain radius in meters).
+ */
+
+L.Circle = L.Path.extend({
+ initialize: function(latlng, radius, options) {
+ L.Path.prototype.initialize.call(this, options);
+
+ this._latlng = latlng;
+ this._mRadius = radius;
+ },
+
+ options: {
+ fill: true
+ },
+
+ setLatLng: function(latlng) {
+ this._latlng = latlng;
+ this._redraw();
+ return this;
+ },
+
+ setRadius: function(radius) {
+ this._mRadius = radius;
+ this._redraw();
+ return this;
+ },
+
+ projectLatlngs: function() {
+ var equatorLength = 40075017,
+ scale = this._map.options.scale(this._map._zoom);
+
+ this._point = this._map.latLngToLayerPoint(this._latlng);
+ this._radius = (this._mRadius / equatorLength) * scale;
+ },
+
+ getPathString: function() {
+ var p = this._point,
+ r = this._radius;
+
+ if (L.Path.SVG) {
+ return "M" + p.x + "," + (p.y - r) +
+ "A" + r + "," + r + ",0,1,1," +
+ (p.x - 0.1) + "," + (p.y - r) + " z";
+ } else {
+ p._round();
+ r = Math.round(r);
+ return "AL " + p.x + "," + p.y + " " + r + "," + r + " 0," + (65535 * 360);
+ }
+ }
+});
\ No newline at end of file |