@artstesh/maps 1.1.23 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/maps-components-src-map.umd.js +77 -5
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +77 -5
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/messages/commands/modify-feature.command.js +7 -5
- package/dist/esm2015/map/messages/executors/polygon-self-intersection.executor.js +9 -0
- package/dist/esm2015/map/messages/index.js +2 -1
- package/dist/esm2015/map/public-api.js +2 -1
- package/dist/esm2015/map/services/drawing/feature-modification.service.js +3 -2
- package/dist/esm2015/map/services/feature.service.js +53 -2
- package/dist/esm2015/map/services/message-registrator.service.js +3 -2
- package/dist/esm2015/src/map/messages/commands/modify-feature.command.js +7 -5
- package/dist/esm2015/src/map/messages/executors/polygon-self-intersection.executor.js +9 -0
- package/dist/esm2015/src/map/messages/index.js +2 -1
- package/dist/esm2015/src/map/public-api.js +2 -1
- package/dist/esm2015/src/map/services/drawing/feature-modification.service.js +3 -2
- package/dist/esm2015/src/map/services/feature.service.js +53 -2
- package/dist/esm2015/src/map/services/message-registrator.service.js +3 -2
- package/dist/fesm2015/maps-components-src-map.js +71 -7
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +71 -7
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/messages/commands/modify-feature.command.d.ts +6 -4
- package/dist/map/messages/executors/polygon-self-intersection.executor.d.ts +7 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/public-api.d.ts +1 -0
- package/dist/map/services/feature.service.d.ts +5 -0
- package/dist/src/map/messages/commands/modify-feature.command.d.ts +6 -4
- package/dist/src/map/messages/executors/polygon-self-intersection.executor.d.ts +7 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/public-api.d.ts +1 -0
- package/dist/src/map/services/feature.service.d.ts +5 -0
- package/package.json +1 -1
|
@@ -905,16 +905,19 @@
|
|
|
905
905
|
/**
|
|
906
906
|
* Constructs an instance of the class.
|
|
907
907
|
*
|
|
908
|
-
* @param {PolygonModel} model - The
|
|
909
|
-
* @param {Style} style - The style
|
|
910
|
-
* @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the
|
|
908
|
+
* @param {PolygonModel} model - The model representing the polygon data.
|
|
909
|
+
* @param {Style} style - The style to be applied to the polygon.
|
|
910
|
+
* @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the feature, defaults to GeoJson.
|
|
911
|
+
* @param {boolean} [draggable=true] - Determines whether the polygon is draggable, defaults to true.
|
|
911
912
|
*/
|
|
912
|
-
function ModifyFeatureCommand(model, style, format) {
|
|
913
|
+
function ModifyFeatureCommand(model, style, format, draggable) {
|
|
913
914
|
if (format === void 0) { format = exports.FeatureOutputFormat.GeoJson; }
|
|
915
|
+
if (draggable === void 0) { draggable = true; }
|
|
914
916
|
var _this = _super.call(this) || this;
|
|
915
917
|
_this.model = model;
|
|
916
918
|
_this.style = style;
|
|
917
919
|
_this.format = format;
|
|
920
|
+
_this.draggable = draggable;
|
|
918
921
|
return _this;
|
|
919
922
|
}
|
|
920
923
|
return ModifyFeatureCommand;
|
|
@@ -1188,6 +1191,17 @@
|
|
|
1188
1191
|
}(postboy.PostboyExecutor));
|
|
1189
1192
|
GetMapPositionExecutor.ID = '52c95689-d09b-4082-ba58-9183ea96a213';
|
|
1190
1193
|
|
|
1194
|
+
var PolygonSelfIntersectionExecutor = /** @class */ (function (_super) {
|
|
1195
|
+
__extends(PolygonSelfIntersectionExecutor, _super);
|
|
1196
|
+
function PolygonSelfIntersectionExecutor(polygon) {
|
|
1197
|
+
var _this = _super.call(this) || this;
|
|
1198
|
+
_this.polygon = polygon;
|
|
1199
|
+
return _this;
|
|
1200
|
+
}
|
|
1201
|
+
return PolygonSelfIntersectionExecutor;
|
|
1202
|
+
}(postboy.PostboyGenericMessage));
|
|
1203
|
+
PolygonSelfIntersectionExecutor.ID = 'a4ef116d-fe40-4e92-9d4a-653f8b398c62';
|
|
1204
|
+
|
|
1191
1205
|
/**
|
|
1192
1206
|
* Class representing a query to get features within a specified geographical area.
|
|
1193
1207
|
* The query optionally takes a set of layer names to ignore during the operation.
|
|
@@ -1364,6 +1378,20 @@
|
|
|
1364
1378
|
return 0;
|
|
1365
1379
|
return Sphere__namespace.getArea(g, { projection: 'EPSG:4326' });
|
|
1366
1380
|
};
|
|
1381
|
+
FeatureService.polygonSelfIntersects = function (feature) {
|
|
1382
|
+
if (feature.getGeometry().getType() !== 'Polygon')
|
|
1383
|
+
return false;
|
|
1384
|
+
var intersections = 0;
|
|
1385
|
+
var segments = FeatureService.getSegmentsFromCoordinates(feature.getGeometry());
|
|
1386
|
+
for (var i = 0; i < segments.length; i++) {
|
|
1387
|
+
for (var z = i + 1; z < segments.length; z++) {
|
|
1388
|
+
if (!intersections && this.segmentIntersection(segments[i].getCoordinates(), segments[z].getCoordinates())) {
|
|
1389
|
+
intersections++;
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return intersections !== 0;
|
|
1394
|
+
};
|
|
1367
1395
|
FeatureService.booleanIntersects = function (g1, g2) {
|
|
1368
1396
|
if (g2.getType() === 'Point')
|
|
1369
1397
|
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
@@ -1373,6 +1401,43 @@
|
|
|
1373
1401
|
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
1374
1402
|
return false;
|
|
1375
1403
|
};
|
|
1404
|
+
FeatureService.getSegmentsFromCoordinates = function (geom$1) {
|
|
1405
|
+
if (!geom$1)
|
|
1406
|
+
return [];
|
|
1407
|
+
var coords = geom$1.getCoordinates();
|
|
1408
|
+
var line = new geom.LineString(coords[0]);
|
|
1409
|
+
var segments = [];
|
|
1410
|
+
line.forEachSegment(function (s1, s2) {
|
|
1411
|
+
var l = new geom.LineString([s1, s2]);
|
|
1412
|
+
l.scale(0.999); // bug of the OL, as I see
|
|
1413
|
+
segments.push(l);
|
|
1414
|
+
});
|
|
1415
|
+
return segments;
|
|
1416
|
+
};
|
|
1417
|
+
FeatureService.segmentIntersection = function (s1, s2) {
|
|
1418
|
+
var a = s1[0], b = s1[1], c = s2[0], d = s2[1];
|
|
1419
|
+
var o1 = this.orientation(a, b, c);
|
|
1420
|
+
var o2 = this.orientation(a, b, d);
|
|
1421
|
+
var o3 = this.orientation(c, d, a);
|
|
1422
|
+
var o4 = this.orientation(c, d, b);
|
|
1423
|
+
return ((o1 != o2 && o3 != o4) ||
|
|
1424
|
+
(o1 == 0 && this.onSegment(a, d, b)) ||
|
|
1425
|
+
(o2 == 0 && this.onSegment(a, d, b)) ||
|
|
1426
|
+
(o3 == 0 && this.onSegment(d, a, d)) ||
|
|
1427
|
+
(o4 == 0 && this.onSegment(d, b, d)));
|
|
1428
|
+
};
|
|
1429
|
+
FeatureService.orientation = function (p, q, r) {
|
|
1430
|
+
var val = (q[1] - p[1]) * (r[0] - q[0]) - (q[0] - p[0]) * (r[1] - q[1]);
|
|
1431
|
+
if (val == 0)
|
|
1432
|
+
return 0; // collinear
|
|
1433
|
+
return val > 0 ? 1 : 2; // clock or counterclock wise
|
|
1434
|
+
};
|
|
1435
|
+
FeatureService.onSegment = function (p, q, r) {
|
|
1436
|
+
return (q[0] <= (p[0] > r[0] ? p[0] : r[0]) &&
|
|
1437
|
+
q[0] >= (p[0] < r[0] ? p[0] : r[0]) &&
|
|
1438
|
+
q[1] <= (p[1] > r[1] ? p[1] : r[1]) &&
|
|
1439
|
+
q[1] >= (p[1] < r[1] ? p[1] : r[1]));
|
|
1440
|
+
};
|
|
1376
1441
|
return FeatureService;
|
|
1377
1442
|
}());
|
|
1378
1443
|
|
|
@@ -1821,7 +1886,8 @@
|
|
|
1821
1886
|
_this.observeCancelation(ev, l);
|
|
1822
1887
|
_this.initFeature(l, ev.model.feature);
|
|
1823
1888
|
_this.addModify(ev);
|
|
1824
|
-
|
|
1889
|
+
if (ev.draggable)
|
|
1890
|
+
_this.addDragging(ev);
|
|
1825
1891
|
});
|
|
1826
1892
|
});
|
|
1827
1893
|
};
|
|
@@ -1974,6 +2040,7 @@
|
|
|
1974
2040
|
this.recordExecutor(FilterFeaturesInAreaExecutor, function (e) { return FeatureService.filterFeaturesInArea(e); });
|
|
1975
2041
|
this.recordExecutor(FilterFeaturesInPointExecutor, function (e) { return FeatureService.filterFeaturesInPoint(e); });
|
|
1976
2042
|
this.recordExecutor(CalculateAreaExecutor, function (e) { var _a, _b; return FeatureService.calculateArea((_b = (_a = e.polygon) === null || _a === void 0 ? void 0 : _a.feature) === null || _b === void 0 ? void 0 : _b.getGeometry()); });
|
|
2043
|
+
this.recordExecutor(PolygonSelfIntersectionExecutor, function (e) { return FeatureService.polygonSelfIntersects(e.polygon.feature); });
|
|
1977
2044
|
this.recordExecutor(GenerateDrawExecutor, function (e) { return DrawingGenerationService.getDraw(e); });
|
|
1978
2045
|
this.recordExecutor(GenerateZoomControlExecutor, function (e) { return ZoomControlFactory.build(e.settings); });
|
|
1979
2046
|
this.recordExecutor(GetMapPositionExecutor, function () { return _this.state.getMapPosition(); });
|
|
@@ -3616,6 +3683,10 @@
|
|
|
3616
3683
|
* Generated bundle index. Do not edit.
|
|
3617
3684
|
*/
|
|
3618
3685
|
|
|
3686
|
+
Object.defineProperty(exports, 'Style', {
|
|
3687
|
+
enumerable: true,
|
|
3688
|
+
get: function () { return style.Style; }
|
|
3689
|
+
});
|
|
3619
3690
|
exports.AddControlCommand = AddControlCommand;
|
|
3620
3691
|
exports.CalculateAreaExecutor = CalculateAreaExecutor;
|
|
3621
3692
|
exports.CancelDrawingCommand = CancelDrawingCommand;
|
|
@@ -3653,6 +3724,7 @@
|
|
|
3653
3724
|
exports.ModifyFeatureCommand = ModifyFeatureCommand;
|
|
3654
3725
|
exports.OsmTileLayerComponent = OsmTileLayerComponent;
|
|
3655
3726
|
exports.PolygonModel = PolygonModel;
|
|
3727
|
+
exports.PolygonSelfIntersectionExecutor = PolygonSelfIntersectionExecutor;
|
|
3656
3728
|
exports.PolygonStyleHelper = PolygonStyleHelper;
|
|
3657
3729
|
exports.PolygonsComponent = PolygonsComponent;
|
|
3658
3730
|
exports.RemoveControlCommand = RemoveControlCommand;
|