@artstesh/maps 1.0.10 → 1.1.0
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 +386 -98
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +386 -98
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/helpers/polygon-style.helper.js +19 -2
- package/dist/esm2015/map/map-plate/controls/index.js +3 -0
- package/dist/esm2015/map/map-plate/controls/map-control-zoom/map-control-zoom.component.js +54 -0
- package/dist/esm2015/map/map-plate/controls/map-control-zoom/zoom-control.factory.js +13 -0
- package/dist/esm2015/map/map-plate/controls/map-control-zoom/zoom-control.settings.js +47 -0
- package/dist/esm2015/map/map-plate/map-plate.component.js +4 -1
- package/dist/esm2015/map/map.module.js +8 -3
- package/dist/esm2015/map/messages/commands/cancel-feature-modification.command.js +8 -0
- package/dist/esm2015/map/messages/commands/modify-feature.command.js +15 -0
- package/dist/esm2015/map/messages/executors/filter-features-in-area.executor.js +13 -0
- package/dist/esm2015/map/messages/executors/generate-draw.executor.js +14 -0
- package/dist/esm2015/map/messages/executors/generate-zoom-control.executor.js +12 -0
- package/dist/esm2015/map/messages/index.js +3 -1
- package/dist/esm2015/map/models/drawing-type.enum.js +2 -1
- package/dist/esm2015/map/public-api.js +2 -1
- package/dist/esm2015/map/services/drawing/drawing-generation.service.js +16 -21
- package/dist/esm2015/map/services/drawing/drawing.service.js +9 -13
- package/dist/esm2015/map/services/drawing/feature-modification.service.js +104 -0
- package/dist/esm2015/map/services/feature.service.js +4 -17
- package/dist/esm2015/map/services/map-management.service.js +5 -13
- package/dist/esm2015/map/services/message-registrator.service.js +22 -11
- package/dist/esm2015/src/map/helpers/polygon-style.helper.js +19 -2
- package/dist/esm2015/src/map/map-plate/controls/index.js +3 -0
- package/dist/esm2015/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.js +54 -0
- package/dist/esm2015/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.js +13 -0
- package/dist/esm2015/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.js +47 -0
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +4 -1
- package/dist/esm2015/src/map/map.module.js +8 -3
- package/dist/esm2015/src/map/messages/commands/cancel-feature-modification.command.js +8 -0
- package/dist/esm2015/src/map/messages/commands/modify-feature.command.js +15 -0
- package/dist/esm2015/src/map/messages/executors/filter-features-in-area.executor.js +13 -0
- package/dist/esm2015/src/map/messages/executors/generate-draw.executor.js +14 -0
- package/dist/esm2015/src/map/messages/executors/generate-zoom-control.executor.js +12 -0
- package/dist/esm2015/src/map/messages/index.js +3 -1
- package/dist/esm2015/src/map/models/drawing-type.enum.js +2 -1
- package/dist/esm2015/src/map/public-api.js +2 -1
- package/dist/esm2015/src/map/services/drawing/drawing-generation.service.js +16 -21
- package/dist/esm2015/src/map/services/drawing/drawing.service.js +9 -13
- package/dist/esm2015/src/map/services/drawing/feature-modification.service.js +104 -0
- package/dist/esm2015/src/map/services/feature.service.js +4 -17
- package/dist/esm2015/src/map/services/map-management.service.js +5 -13
- package/dist/esm2015/src/map/services/message-registrator.service.js +22 -11
- package/dist/fesm2015/maps-components-src-map.js +321 -83
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +321 -83
- package/dist/fesm2015/maps-components.js.map +1 -1
- package/dist/map/helpers/polygon-style.helper.d.ts +1 -0
- package/dist/map/map-plate/controls/index.d.ts +2 -0
- package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
- package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
- package/dist/map/map.module.d.ts +3 -2
- package/dist/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
- package/dist/map/messages/commands/modify-feature.command.d.ts +11 -0
- package/dist/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
- package/dist/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
- package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
- package/dist/map/messages/index.d.ts +2 -0
- package/dist/map/models/drawing-type.enum.d.ts +2 -1
- package/dist/map/public-api.d.ts +1 -0
- package/dist/map/services/drawing/drawing-generation.service.d.ts +5 -9
- package/dist/map/services/drawing/feature-modification.service.d.ts +22 -0
- package/dist/map/services/feature.service.d.ts +6 -9
- package/dist/map/services/message-registrator.service.d.ts +3 -3
- package/dist/package.json +1 -1
- package/dist/src/map/helpers/polygon-style.helper.d.ts +1 -0
- package/dist/src/map/map-plate/controls/index.d.ts +2 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +19 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -0
- package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +14 -0
- package/dist/src/map/map.module.d.ts +3 -2
- package/dist/src/map/messages/commands/cancel-feature-modification.command.d.ts +5 -0
- package/dist/src/map/messages/commands/modify-feature.command.d.ts +11 -0
- package/dist/src/map/messages/{queries/filter-features-in-area.query.d.ts → executors/filter-features-in-area.executor.d.ts} +2 -2
- package/dist/src/map/messages/{queries/generate-draw.query.d.ts → executors/generate-draw.executor.d.ts} +2 -2
- package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -0
- package/dist/src/map/messages/index.d.ts +2 -0
- package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
- package/dist/src/map/public-api.d.ts +1 -0
- package/dist/src/map/services/drawing/drawing-generation.service.d.ts +5 -9
- package/dist/src/map/services/drawing/feature-modification.service.d.ts +22 -0
- package/dist/src/map/services/feature.service.d.ts +6 -9
- package/dist/src/map/services/message-registrator.service.d.ts +3 -3
- package/package.json +2 -2
- package/dist/esm2015/map/messages/queries/filter-features-in-area.query.js +0 -13
- package/dist/esm2015/map/messages/queries/generate-draw.query.js +0 -14
- package/dist/esm2015/src/map/messages/queries/filter-features-in-area.query.js +0 -13
- package/dist/esm2015/src/map/messages/queries/generate-draw.query.js +0 -14
|
@@ -2,23 +2,24 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgModule } from '@angular/core';
|
|
3
3
|
import * as i6 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { Feature } from 'ol';
|
|
5
|
+
import { Feature, Collection } from 'ol';
|
|
6
6
|
import { Point, LineString } from 'ol/geom';
|
|
7
7
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
8
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
9
9
|
import { get, useGeographic, transform } from 'ol/proj';
|
|
10
|
-
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
11
|
-
import {
|
|
12
|
-
import { tap, first, filter, auditTime } from 'rxjs/operators';
|
|
13
|
-
import { Vector, XYZ } from 'ol/source';
|
|
14
|
-
import { Draw } from 'ol/interaction';
|
|
10
|
+
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
11
|
+
import { Draw, Modify, Translate } from 'ol/interaction';
|
|
15
12
|
import { createRegularPolygon } from 'ol/interaction/Draw';
|
|
13
|
+
import { Zoom } from 'ol/control';
|
|
14
|
+
import { first, filter, auditTime } from 'rxjs/operators';
|
|
15
|
+
import { Vector, XYZ } from 'ol/source';
|
|
16
16
|
import TileLayer from 'ol/layer/Tile';
|
|
17
17
|
import OSM from 'ol/source/OSM';
|
|
18
18
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
19
19
|
import { bbox } from 'ol/loadingstrategy';
|
|
20
20
|
import Polygon, { fromExtent } from 'ol/geom/Polygon';
|
|
21
21
|
import Cluster from 'ol/source/Cluster';
|
|
22
|
+
import { combineLatest } from 'rxjs';
|
|
22
23
|
import Map from 'ol/Map';
|
|
23
24
|
import View from 'ol/View';
|
|
24
25
|
import Overlay from 'ol/Overlay';
|
|
@@ -180,6 +181,7 @@ var DrawingType;
|
|
|
180
181
|
(function (DrawingType) {
|
|
181
182
|
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
182
183
|
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
184
|
+
DrawingType[DrawingType["Square"] = 3] = "Square";
|
|
183
185
|
})(DrawingType || (DrawingType = {}));
|
|
184
186
|
|
|
185
187
|
var FeatureOutputFormat;
|
|
@@ -324,6 +326,26 @@ class DrawSelectionAreaCommand extends PostboyCallbackMessage {
|
|
|
324
326
|
}
|
|
325
327
|
DrawSelectionAreaCommand.ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
|
|
326
328
|
|
|
329
|
+
class ModifyFeatureCommand extends PostboyCallbackMessage {
|
|
330
|
+
constructor(model, style, format = FeatureOutputFormat.GeoJson) {
|
|
331
|
+
super();
|
|
332
|
+
this.model = model;
|
|
333
|
+
this.style = style;
|
|
334
|
+
this.format = format;
|
|
335
|
+
}
|
|
336
|
+
get id() {
|
|
337
|
+
return ModifyFeatureCommand.ID;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
ModifyFeatureCommand.ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
|
|
341
|
+
|
|
342
|
+
class CancelFeatureModificationCommand extends PostboyGenericMessage {
|
|
343
|
+
get id() {
|
|
344
|
+
return CancelFeatureModificationCommand.ID;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
CancelFeatureModificationCommand.ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
|
|
348
|
+
|
|
327
349
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
328
350
|
constructor(layer) {
|
|
329
351
|
super();
|
|
@@ -413,42 +435,101 @@ class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
|
413
435
|
}
|
|
414
436
|
DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
415
437
|
|
|
416
|
-
class
|
|
417
|
-
|
|
438
|
+
class DrawingGenerationService {
|
|
439
|
+
static getDraw(ev) {
|
|
440
|
+
return new Draw({
|
|
441
|
+
source: ev.layer.getSource(),
|
|
442
|
+
type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
|
|
443
|
+
style: ev.style,
|
|
444
|
+
geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
static geometryFunc(type) {
|
|
448
|
+
switch (type) {
|
|
449
|
+
case DrawingType.Circle:
|
|
450
|
+
return createRegularPolygon(32);
|
|
451
|
+
case DrawingType.Square:
|
|
452
|
+
return createRegularPolygon(4);
|
|
453
|
+
}
|
|
454
|
+
return undefined;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
class FeatureService {
|
|
459
|
+
constructor() { }
|
|
460
|
+
static filterFeaturesInArea(query) {
|
|
461
|
+
return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
|
|
462
|
+
}
|
|
463
|
+
static booleanIntersects(g1, g2) {
|
|
464
|
+
if (g2.getType() === 'Point')
|
|
465
|
+
return g1.intersectsCoordinate(g2.getCoordinates());
|
|
466
|
+
if (g2.getType() === 'Circle')
|
|
467
|
+
return g1.intersectsCoordinate(g2.getCenter());
|
|
468
|
+
if (g2.getType() === 'Polygon')
|
|
469
|
+
return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
|
|
475
|
+
constructor(area, ignore = new Set()) {
|
|
418
476
|
super();
|
|
419
|
-
this.
|
|
420
|
-
this.
|
|
421
|
-
this.type = type;
|
|
477
|
+
this.area = area;
|
|
478
|
+
this.ignore = ignore;
|
|
422
479
|
}
|
|
423
480
|
get id() {
|
|
424
|
-
return
|
|
481
|
+
return GetFeaturesInAreaQuery.ID;
|
|
425
482
|
}
|
|
426
483
|
}
|
|
427
|
-
|
|
484
|
+
GetFeaturesInAreaQuery.ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
|
|
428
485
|
|
|
429
|
-
class
|
|
486
|
+
class FilterFeaturesInAreaExecutor extends PostboyExecutor {
|
|
430
487
|
constructor(area, features) {
|
|
431
488
|
super();
|
|
432
489
|
this.area = area;
|
|
433
490
|
this.features = features;
|
|
434
491
|
}
|
|
435
492
|
get id() {
|
|
436
|
-
return
|
|
493
|
+
return FilterFeaturesInAreaExecutor.ID;
|
|
437
494
|
}
|
|
438
495
|
}
|
|
439
|
-
|
|
496
|
+
FilterFeaturesInAreaExecutor.ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
|
|
440
497
|
|
|
441
|
-
class
|
|
442
|
-
constructor(
|
|
498
|
+
class GenerateDrawExecutor extends PostboyExecutor {
|
|
499
|
+
constructor(layer, style, type) {
|
|
443
500
|
super();
|
|
444
|
-
this.
|
|
445
|
-
this.
|
|
501
|
+
this.layer = layer;
|
|
502
|
+
this.style = style;
|
|
503
|
+
this.type = type;
|
|
446
504
|
}
|
|
447
505
|
get id() {
|
|
448
|
-
return
|
|
506
|
+
return GenerateDrawExecutor.ID;
|
|
449
507
|
}
|
|
450
508
|
}
|
|
451
|
-
|
|
509
|
+
GenerateDrawExecutor.ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
510
|
+
|
|
511
|
+
class GenerateZoomControlExecutor extends PostboyExecutor {
|
|
512
|
+
constructor(settings) {
|
|
513
|
+
super();
|
|
514
|
+
this.settings = settings;
|
|
515
|
+
}
|
|
516
|
+
get id() {
|
|
517
|
+
return GenerateZoomControlExecutor.ID;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
GenerateZoomControlExecutor.ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
|
|
521
|
+
|
|
522
|
+
class ZoomControlFactory {
|
|
523
|
+
static build(settings) {
|
|
524
|
+
return new Zoom({
|
|
525
|
+
zoomInTipLabel: settings.zoomInLabel,
|
|
526
|
+
zoomOutTipLabel: settings.zoomOutLabel,
|
|
527
|
+
zoomInClassName: settings.zoomInClass,
|
|
528
|
+
zoomOutClassName: settings.zoomOutClass,
|
|
529
|
+
className: settings.controlClass,
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
452
533
|
|
|
453
534
|
class MapPostboyService extends PostboyService {
|
|
454
535
|
constructor() {
|
|
@@ -530,8 +611,6 @@ class MapManagementService {
|
|
|
530
611
|
observeFeaturesInArea() {
|
|
531
612
|
this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
|
|
532
613
|
let result = new Dictionary();
|
|
533
|
-
const queue = [];
|
|
534
|
-
const queries = [];
|
|
535
614
|
this.layers.forEach((l) => {
|
|
536
615
|
var _a, _b;
|
|
537
616
|
let layerName = l.get('name');
|
|
@@ -540,14 +619,10 @@ class MapManagementService {
|
|
|
540
619
|
let source = l.getSource();
|
|
541
620
|
if (!!source['getSource'])
|
|
542
621
|
source = (_a = source) === null || _a === void 0 ? void 0 : _a.getSource();
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
result.put(l.get('name'), r.map((e) => (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo)))));
|
|
546
|
-
})));
|
|
547
|
-
queries.push(query);
|
|
622
|
+
let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, (_b = source === null || source === void 0 ? void 0 : source.getFeatures()) !== null && _b !== void 0 ? _b : []));
|
|
623
|
+
result.put(layerName, features.map((e) => (Object.assign({ id: e.getId() }, e.get(MapConstants.FeatureInfo)))));
|
|
548
624
|
});
|
|
549
|
-
|
|
550
|
-
queries.forEach((q) => this.postboy.fire(q));
|
|
625
|
+
qr.finish(result);
|
|
551
626
|
});
|
|
552
627
|
}
|
|
553
628
|
}
|
|
@@ -690,22 +765,18 @@ class DrawingService {
|
|
|
690
765
|
observeDrawing() {
|
|
691
766
|
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
692
767
|
this.draw((l) => {
|
|
768
|
+
var _a;
|
|
693
769
|
if (!l || !this.map) {
|
|
694
770
|
this.clearInteraction(l);
|
|
695
771
|
return;
|
|
696
772
|
}
|
|
697
|
-
const
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
this.drawInteraction.on('drawend', (evt) => {
|
|
704
|
-
cancelSub.unsubscribe();
|
|
705
|
-
this.onEnd(evt, ev, l);
|
|
706
|
-
});
|
|
773
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
774
|
+
this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
|
|
775
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addInteraction(this.drawInteraction);
|
|
776
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
777
|
+
cancelSub.unsubscribe();
|
|
778
|
+
this.onEnd(evt, ev, l);
|
|
707
779
|
});
|
|
708
|
-
this.postboy.fire(drawQuery);
|
|
709
780
|
});
|
|
710
781
|
});
|
|
711
782
|
}
|
|
@@ -749,56 +820,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
749
820
|
type: Injectable
|
|
750
821
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
751
822
|
|
|
752
|
-
class
|
|
823
|
+
class FeatureModificationService {
|
|
753
824
|
constructor(postboy) {
|
|
754
825
|
this.postboy = postboy;
|
|
755
826
|
}
|
|
756
827
|
up() {
|
|
757
|
-
this.
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
828
|
+
this.observeModification();
|
|
829
|
+
this.observeMapRender();
|
|
830
|
+
}
|
|
831
|
+
observeModification() {
|
|
832
|
+
this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
|
|
833
|
+
this.defineLayer((l) => {
|
|
834
|
+
if (!l || !this.map) {
|
|
835
|
+
this.clearInteraction(l);
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
this.observeCancelation(ev, l);
|
|
839
|
+
this.initFeature(l, ev.model.feature);
|
|
840
|
+
this.addModify(ev);
|
|
841
|
+
this.addDragging(ev);
|
|
842
|
+
});
|
|
764
843
|
});
|
|
765
844
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
type: Injectable
|
|
771
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
772
|
-
|
|
773
|
-
class FeatureService {
|
|
774
|
-
constructor(postboy) {
|
|
775
|
-
this.postboy = postboy;
|
|
845
|
+
initFeature(layer, feature) {
|
|
846
|
+
var _a, _b;
|
|
847
|
+
(_a = layer.getSource()) === null || _a === void 0 ? void 0 : _a.clear();
|
|
848
|
+
(_b = layer.getSource()) === null || _b === void 0 ? void 0 : _b.addFeature(feature);
|
|
776
849
|
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
850
|
+
addModify(command) {
|
|
851
|
+
var _a;
|
|
852
|
+
this.modify = new Modify({
|
|
853
|
+
features: new Collection([command.model.feature]),
|
|
854
|
+
style: command.style,
|
|
855
|
+
});
|
|
856
|
+
this.modify.on('modifyend', () => {
|
|
857
|
+
this.onModified(command);
|
|
858
|
+
command.model.feature.changed();
|
|
780
859
|
});
|
|
860
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addInteraction(this.modify);
|
|
781
861
|
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
862
|
+
addDragging(command) {
|
|
863
|
+
var _a;
|
|
864
|
+
this.translate = new Translate({
|
|
865
|
+
features: new Collection([command.model.feature]),
|
|
866
|
+
condition: (ev) => {
|
|
867
|
+
var _a;
|
|
868
|
+
const clone = command.model.feature.clone();
|
|
869
|
+
(_a = clone.getGeometry()) === null || _a === void 0 ? void 0 : _a.scale(0.999);
|
|
870
|
+
return clone.getGeometry().intersectsCoordinate(ev.coordinate);
|
|
871
|
+
},
|
|
872
|
+
});
|
|
873
|
+
this.translate.on('translateend', () => this.onModified(command));
|
|
874
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addInteraction(this.translate);
|
|
875
|
+
}
|
|
876
|
+
onModified(command) {
|
|
877
|
+
command.next(command.format === FeatureOutputFormat.GeoJson
|
|
878
|
+
? new GeoJSON().writeFeature(command.model.feature)
|
|
879
|
+
: new WKT().writeFeature(command.model.feature));
|
|
880
|
+
}
|
|
881
|
+
observeMapRender() {
|
|
882
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
883
|
+
this.map = m.map;
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
defineLayer(action) {
|
|
887
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
888
|
+
query.result.subscribe((l) => action(l));
|
|
889
|
+
this.postboy.fire(query);
|
|
890
|
+
}
|
|
891
|
+
observeCancelation(ev, layer) {
|
|
892
|
+
return this.postboy
|
|
893
|
+
.subscribe(CancelFeatureModificationCommand.ID)
|
|
894
|
+
.pipe(first())
|
|
895
|
+
.subscribe(() => {
|
|
896
|
+
ev.finish(null);
|
|
897
|
+
this.clearInteraction(layer);
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
clearInteraction(layer) {
|
|
901
|
+
var _a, _b;
|
|
902
|
+
if (this.modify)
|
|
903
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.removeInteraction(this.modify);
|
|
904
|
+
if (this.translate)
|
|
905
|
+
(_b = this.map) === null || _b === void 0 ? void 0 : _b.removeInteraction(this.translate);
|
|
790
906
|
}
|
|
791
907
|
}
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type:
|
|
908
|
+
FeatureModificationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
909
|
+
FeatureModificationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FeatureModificationService });
|
|
910
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: FeatureModificationService, decorators: [{
|
|
795
911
|
type: Injectable
|
|
796
912
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
797
913
|
|
|
798
914
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
799
|
-
constructor(service, management, state, mapFeature, interaction, drawing,
|
|
915
|
+
constructor(service, management, state, mapFeature, interaction, drawing, featureModification) {
|
|
800
916
|
super(service);
|
|
801
|
-
this.registerServices([management, state, interaction, mapFeature, drawing,
|
|
917
|
+
this.registerServices([management, state, interaction, mapFeature, drawing, featureModification]);
|
|
802
918
|
}
|
|
803
919
|
_up() {
|
|
804
920
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -815,17 +931,23 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
815
931
|
this.registerSubject(StartDrawingCommand.ID);
|
|
816
932
|
this.registerSubject(GetLayerQuery.ID);
|
|
817
933
|
this.registerSubject(DrawingFinishedEvent.ID);
|
|
818
|
-
this.registerSubject(GenerateDrawQuery.ID);
|
|
819
|
-
this.registerSubject(FilterFeaturesInAreaQuery.ID);
|
|
820
934
|
this.registerSubject(GetFeaturesInAreaQuery.ID);
|
|
821
935
|
this.registerSubject(DrawSelectionAreaCommand.ID);
|
|
936
|
+
this.registerSubject(CancelFeatureModificationCommand.ID);
|
|
937
|
+
this.registerSubject(ModifyFeatureCommand.ID);
|
|
938
|
+
this.setExecutors();
|
|
939
|
+
}
|
|
940
|
+
setExecutors() {
|
|
941
|
+
this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
|
|
942
|
+
this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
|
|
943
|
+
this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
|
|
822
944
|
}
|
|
823
945
|
}
|
|
824
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token:
|
|
946
|
+
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
825
947
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService });
|
|
826
948
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
827
949
|
type: Injectable
|
|
828
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type:
|
|
950
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }]; } });
|
|
829
951
|
|
|
830
952
|
class TileLayerSettings {
|
|
831
953
|
constructor() {
|
|
@@ -1404,6 +1526,7 @@ MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", vers
|
|
|
1404
1526
|
DrawingService,
|
|
1405
1527
|
DrawingGenerationService,
|
|
1406
1528
|
FeatureService,
|
|
1529
|
+
FeatureModificationService,
|
|
1407
1530
|
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\r\n<lib-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></lib-feature-layer>\r\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }, { type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: ["settings"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1408
1531
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1409
1532
|
type: Component,
|
|
@@ -1421,6 +1544,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1421
1544
|
DrawingService,
|
|
1422
1545
|
DrawingGenerationService,
|
|
1423
1546
|
FeatureService,
|
|
1547
|
+
FeatureModificationService,
|
|
1424
1548
|
],
|
|
1425
1549
|
}]
|
|
1426
1550
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
@@ -1610,6 +1734,99 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1610
1734
|
type: Input
|
|
1611
1735
|
}] } });
|
|
1612
1736
|
|
|
1737
|
+
class ZoomControlSettings {
|
|
1738
|
+
constructor() {
|
|
1739
|
+
this.controlClass = 'ol-zoom';
|
|
1740
|
+
this.zoomInClass = 'ol-zoom-in';
|
|
1741
|
+
this.zoomOutClass = 'ol-zoom-out';
|
|
1742
|
+
this.zoomInLabel = 'Zoom In';
|
|
1743
|
+
this.zoomOutLabel = 'Zoom Out';
|
|
1744
|
+
}
|
|
1745
|
+
static copy(model) {
|
|
1746
|
+
const result = new ZoomControlSettings();
|
|
1747
|
+
result.controlClass = model.controlClass;
|
|
1748
|
+
result.zoomInClass = model.zoomInClass;
|
|
1749
|
+
result.zoomOutClass = model.zoomOutClass;
|
|
1750
|
+
result.zoomInLabel = model.zoomInLabel;
|
|
1751
|
+
result.zoomOutLabel = model.zoomOutLabel;
|
|
1752
|
+
return result;
|
|
1753
|
+
}
|
|
1754
|
+
isSame(model) {
|
|
1755
|
+
if (this.zoomInClass !== model.zoomInClass)
|
|
1756
|
+
return false;
|
|
1757
|
+
if (this.zoomOutClass !== model.zoomOutClass)
|
|
1758
|
+
return false;
|
|
1759
|
+
if (this.zoomInLabel !== model.zoomInLabel)
|
|
1760
|
+
return false;
|
|
1761
|
+
if (this.controlClass !== model.controlClass)
|
|
1762
|
+
return false;
|
|
1763
|
+
if (this.zoomOutLabel !== model.zoomOutLabel)
|
|
1764
|
+
return false;
|
|
1765
|
+
return true;
|
|
1766
|
+
}
|
|
1767
|
+
setZoomInLabel(zoomInLabel) {
|
|
1768
|
+
return ZoomControlSettings.copy(Object.assign(Object.assign({}, this), { zoomInLabel }));
|
|
1769
|
+
}
|
|
1770
|
+
setZoomOutClass(zoomOutClass) {
|
|
1771
|
+
return ZoomControlSettings.copy(Object.assign(Object.assign({}, this), { zoomOutClass }));
|
|
1772
|
+
}
|
|
1773
|
+
setZoomInClass(zoomInClass) {
|
|
1774
|
+
return ZoomControlSettings.copy(Object.assign(Object.assign({}, this), { zoomInClass }));
|
|
1775
|
+
}
|
|
1776
|
+
setZoomOutLabel(zoomOutLabel) {
|
|
1777
|
+
return ZoomControlSettings.copy(Object.assign(Object.assign({}, this), { zoomOutLabel }));
|
|
1778
|
+
}
|
|
1779
|
+
setControlClass(controlClass) {
|
|
1780
|
+
return ZoomControlSettings.copy(Object.assign(Object.assign({}, this), { controlClass }));
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
class MapControlZoomComponent extends DestructibleComponent {
|
|
1785
|
+
constructor(postboy) {
|
|
1786
|
+
super();
|
|
1787
|
+
this.postboy = postboy;
|
|
1788
|
+
this._settings = new ZoomControlSettings();
|
|
1789
|
+
this.onDestroy = () => {
|
|
1790
|
+
this.eliminate();
|
|
1791
|
+
};
|
|
1792
|
+
this.eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
|
|
1793
|
+
}
|
|
1794
|
+
set settings(value) {
|
|
1795
|
+
if (!value || this._settings.isSame(value))
|
|
1796
|
+
return;
|
|
1797
|
+
this._settings = value;
|
|
1798
|
+
this.setControl();
|
|
1799
|
+
}
|
|
1800
|
+
ngOnInit() {
|
|
1801
|
+
this.postboy
|
|
1802
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1803
|
+
.pipe(filter((m) => !!m), first())
|
|
1804
|
+
.subscribe((m) => {
|
|
1805
|
+
this.map = m.map;
|
|
1806
|
+
this.setControl();
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
setControl() {
|
|
1810
|
+
if (!this.map)
|
|
1811
|
+
return;
|
|
1812
|
+
this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
|
|
1813
|
+
this.map.addControl(this.control);
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
MapControlZoomComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1817
|
+
MapControlZoomComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapControlZoomComponent, selector: "lib-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1818
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapControlZoomComponent, decorators: [{
|
|
1819
|
+
type: Component,
|
|
1820
|
+
args: [{
|
|
1821
|
+
selector: 'lib-map-control-zoom',
|
|
1822
|
+
template: '',
|
|
1823
|
+
styleUrls: [],
|
|
1824
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1825
|
+
}]
|
|
1826
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { settings: [{
|
|
1827
|
+
type: Input
|
|
1828
|
+
}] } });
|
|
1829
|
+
|
|
1613
1830
|
class MapModule {
|
|
1614
1831
|
}
|
|
1615
1832
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1621,13 +1838,15 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.
|
|
|
1621
1838
|
MarkersComponent,
|
|
1622
1839
|
TooltipComponent,
|
|
1623
1840
|
PolygonsComponent,
|
|
1624
|
-
ClusterLayerComponent
|
|
1841
|
+
ClusterLayerComponent,
|
|
1842
|
+
MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
1625
1843
|
FeatureLayerComponent,
|
|
1626
1844
|
MarkersComponent,
|
|
1627
1845
|
TileLayerComponent,
|
|
1628
1846
|
TooltipComponent,
|
|
1629
1847
|
PolygonsComponent,
|
|
1630
|
-
ClusterLayerComponent
|
|
1848
|
+
ClusterLayerComponent,
|
|
1849
|
+
MapControlZoomComponent] });
|
|
1631
1850
|
MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, imports: [[CommonModule]] });
|
|
1632
1851
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, decorators: [{
|
|
1633
1852
|
type: NgModule,
|
|
@@ -1643,6 +1862,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1643
1862
|
TooltipComponent,
|
|
1644
1863
|
PolygonsComponent,
|
|
1645
1864
|
ClusterLayerComponent,
|
|
1865
|
+
MapControlZoomComponent,
|
|
1646
1866
|
],
|
|
1647
1867
|
exports: [
|
|
1648
1868
|
MapPlateComponent,
|
|
@@ -1652,6 +1872,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1652
1872
|
TooltipComponent,
|
|
1653
1873
|
PolygonsComponent,
|
|
1654
1874
|
ClusterLayerComponent,
|
|
1875
|
+
MapControlZoomComponent,
|
|
1655
1876
|
],
|
|
1656
1877
|
}]
|
|
1657
1878
|
}] });
|
|
@@ -1695,6 +1916,23 @@ class PolygonStyleHelper {
|
|
|
1695
1916
|
}),
|
|
1696
1917
|
});
|
|
1697
1918
|
}
|
|
1919
|
+
static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
|
|
1920
|
+
return new Style({
|
|
1921
|
+
image: new Circle({
|
|
1922
|
+
fill: new Fill({
|
|
1923
|
+
color: stroke,
|
|
1924
|
+
}),
|
|
1925
|
+
radius: pinRadius,
|
|
1926
|
+
}),
|
|
1927
|
+
fill: new Fill({
|
|
1928
|
+
color: fill,
|
|
1929
|
+
}),
|
|
1930
|
+
stroke: new Stroke({
|
|
1931
|
+
color: stroke,
|
|
1932
|
+
width: strokeWidth,
|
|
1933
|
+
}),
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1698
1936
|
}
|
|
1699
1937
|
|
|
1700
1938
|
class TextStyleHelper {
|
|
@@ -1773,5 +2011,5 @@ class StringifyFeatureHelper {
|
|
|
1773
2011
|
* Generated bundle index. Do not edit.
|
|
1774
2012
|
*/
|
|
1775
2013
|
|
|
1776
|
-
export { CancelDrawingCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
2014
|
+
export { CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, Dictionary, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
1777
2015
|
//# sourceMappingURL=maps-components.js.map
|