extend getMeasure by argument extraPoint

This commit is contained in:
Philip Beelmann 2023-04-25 11:11:00 +00:00
parent ee6724cddb
commit 3f12b69c25

View file

@ -1012,8 +1012,17 @@ L.U.Polygon = L.Polygon.extend({
return options.concat(L.U.FeatureMixin.getInteractionOptions()); return options.concat(L.U.FeatureMixin.getInteractionOptions());
}, },
getMeasure: function () { getMeasure: function (extraPoint) {
var area = L.GeoUtil.geodesicArea(this._defaultShape()); var polygon;
if (extraPoint){
var tmpLatLngs = this.editor._drawnLatLngs.slice();
tmpLatLngs.push(extraPoint);
polygon = tmpLatLngs;
} else {
polygon = this._defaultShape();
}
var area = L.GeoUtil.geodesicArea(polygon);
return L.GeoUtil.readableArea(area, this.map.measureTools.getMeasureUnit()); return L.GeoUtil.readableArea(area, this.map.measureTools.getMeasureUnit());
}, },