Skip to content

Commit

Permalink
simplify GeodesicPoly* classes a lot
Browse files Browse the repository at this point in the history
do not store intermediate points (recalculate on every projection)
  • Loading branch information
johndoe committed Feb 24, 2020
1 parent deb6da8 commit f8dae2d
Showing 1 changed file with 4 additions and 27 deletions.
31 changes: 4 additions & 27 deletions src/L.Geodesic.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,35 +94,12 @@

_geodesicConvertLines: geodesicConvertLines,

_geodesicConvert: function () {
this._latlngs = this._geodesicConvertLines(this._latlngsinit);
this._convertLatLngs(this._latlngs); // update bounds
},

options: polyOptions,

initialize: function (latlngs, options) {
L.Polyline.prototype.initialize.call(this, latlngs, options);
this._geodesicConvert();
},

getLatLngs: function () {
return this._latlngsinit;
},

_setLatLngs: function (latlngs) {
this._bounds = L.latLngBounds();
this._latlngsinit = this._convertLatLngs(latlngs);
},

_defaultShape: function () {
var latlngs = this._latlngsinit;
return L.LineUtil.isFlat(latlngs) ? latlngs : latlngs[0];
},

redraw: function () {
this._geodesicConvert();
return L.Path.prototype.redraw.call(this);
_projectLatlngs: function (latlngs, result, projectedBounds) {
latlngs = this._defaultShape();
var geo_latlngs = this._geodesicConvertLines(latlngs);
L.Polyline.prototype._projectLatlngs.call(this, geo_latlngs, result, projectedBounds);
}
};

Expand Down

0 comments on commit f8dae2d

Please sign in to comment.