@artstesh/maps 5.0.7 → 5.0.8
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/esm2022/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2022/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +22 -3
- package/dist/esm2022/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2022/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/start-drawing.command.mjs +18 -0
- package/dist/esm2022/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2022/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2022/map/messages/events/map-move-end.event.mjs +15 -0
- package/dist/esm2022/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2022/map/messages/index.mjs +4 -2
- package/dist/esm2022/map/messages/queries/get-layer.query.mjs +13 -0
- package/dist/esm2022/map/models/drawing-type.enum.mjs +5 -0
- package/dist/esm2022/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2022/map/models/index.mjs +3 -1
- package/dist/esm2022/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/map/services/drawing/drawing.service.mjs +82 -0
- package/dist/esm2022/map/services/map-management.service.mjs +6 -1
- package/dist/esm2022/map/services/map-postboy.service.mjs +10 -4
- package/dist/esm2022/map/services/map-state.service.mjs +10 -2
- package/dist/esm2022/map/services/message-registrator.service.mjs +16 -5
- package/dist/esm2022/src/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +22 -3
- package/dist/esm2022/src/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2022/src/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/start-drawing.command.mjs +18 -0
- package/dist/esm2022/src/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2022/src/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2022/src/map/messages/events/map-move-end.event.mjs +15 -0
- package/dist/esm2022/src/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2022/src/map/messages/index.mjs +4 -2
- package/dist/esm2022/src/map/messages/queries/get-layer.query.mjs +13 -0
- package/dist/esm2022/src/map/models/drawing-type.enum.mjs +5 -0
- package/dist/esm2022/src/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2022/src/map/models/index.mjs +3 -1
- package/dist/esm2022/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +82 -0
- package/dist/esm2022/src/map/services/map-management.service.mjs +6 -1
- package/dist/esm2022/src/map/services/map-postboy.service.mjs +10 -4
- package/dist/esm2022/src/map/services/map-state.service.mjs +10 -2
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +16 -5
- package/dist/fesm2022/maps-components-src-map.mjs +522 -338
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +522 -338
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +2 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +2 -0
- package/dist/map/map-plate/map-plate.component.d.ts +2 -0
- package/dist/map/messages/commands/add-layer.command.d.ts +3 -3
- package/dist/map/messages/commands/add-tile.command.d.ts +3 -3
- package/dist/map/messages/commands/cancel-drawing.command.d.ts +5 -0
- package/dist/map/messages/commands/close-tooltip.command.d.ts +3 -3
- package/dist/map/messages/commands/fit-to-features.command.d.ts +3 -3
- package/dist/map/messages/commands/place-layer-features.command.d.ts +3 -3
- package/dist/map/messages/commands/remove-layer.command.d.ts +3 -3
- package/dist/map/messages/commands/remove-tile.command.d.ts +3 -3
- package/dist/map/messages/commands/start-drawing.command.d.ts +11 -0
- package/dist/map/messages/events/drawing-finished.event.d.ts +6 -0
- package/dist/map/messages/events/map-click.event.d.ts +3 -3
- package/dist/map/messages/events/map-move-end.event.d.ts +8 -0
- package/dist/map/messages/events/map-rendered.event.d.ts +3 -3
- package/dist/map/messages/index.d.ts +3 -1
- package/dist/map/messages/queries/get-layer.query.d.ts +10 -0
- package/dist/map/models/drawing-type.enum.d.ts +3 -0
- package/dist/map/models/feature-format.enum.d.ts +4 -0
- package/dist/map/models/index.d.ts +2 -0
- package/dist/map/models/map.constants.d.ts +1 -0
- package/dist/map/services/drawing/drawing.service.d.ts +17 -0
- package/dist/map/services/map-management.service.d.ts +1 -0
- package/dist/map/services/map-postboy.service.d.ts +1 -2
- package/dist/map/services/message-registrator.service.d.ts +2 -1
- package/dist/package.json +1 -1
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +2 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +2 -0
- package/dist/src/map/map-plate/map-plate.component.d.ts +2 -0
- package/dist/src/map/messages/commands/add-layer.command.d.ts +3 -3
- package/dist/src/map/messages/commands/add-tile.command.d.ts +3 -3
- package/dist/src/map/messages/commands/cancel-drawing.command.d.ts +5 -0
- package/dist/src/map/messages/commands/close-tooltip.command.d.ts +3 -3
- package/dist/src/map/messages/commands/fit-to-features.command.d.ts +3 -3
- package/dist/src/map/messages/commands/place-layer-features.command.d.ts +3 -3
- package/dist/src/map/messages/commands/remove-layer.command.d.ts +3 -3
- package/dist/src/map/messages/commands/remove-tile.command.d.ts +3 -3
- package/dist/src/map/messages/commands/start-drawing.command.d.ts +11 -0
- package/dist/src/map/messages/events/drawing-finished.event.d.ts +6 -0
- package/dist/src/map/messages/events/map-click.event.d.ts +3 -3
- package/dist/src/map/messages/events/map-move-end.event.d.ts +8 -0
- package/dist/src/map/messages/events/map-rendered.event.d.ts +3 -3
- package/dist/src/map/messages/index.d.ts +3 -1
- package/dist/src/map/messages/queries/get-layer.query.d.ts +10 -0
- package/dist/src/map/models/drawing-type.enum.d.ts +3 -0
- package/dist/src/map/models/feature-format.enum.d.ts +4 -0
- package/dist/src/map/models/index.d.ts +2 -0
- package/dist/src/map/models/map.constants.d.ts +1 -0
- package/dist/src/map/services/drawing/drawing.service.d.ts +17 -0
- package/dist/src/map/services/map-management.service.d.ts +1 -0
- package/dist/src/map/services/map-postboy.service.d.ts +1 -2
- package/dist/src/map/services/message-registrator.service.d.ts +2 -1
- package/package.json +2 -2
- package/dist/esm2022/map/messages/generic-message.mjs +0 -12
- package/dist/esm2022/src/map/messages/generic-message.mjs +0 -12
- package/dist/map/messages/generic-message.d.ts +0 -9
- package/dist/src/map/messages/generic-message.d.ts +0 -9
|
@@ -6,20 +6,21 @@ import { Feature } from 'ol';
|
|
|
6
6
|
import { Point } from 'ol/geom';
|
|
7
7
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
8
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
9
|
+
import { get, useGeographic } from 'ol/proj';
|
|
10
|
+
import { PostboyGenericMessage, PostboyCallbackMessage, PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
11
|
+
import { first, filter, auditTime } from 'rxjs/operators';
|
|
12
|
+
import { Vector, XYZ } from 'ol/source';
|
|
13
|
+
import { Draw } from 'ol/interaction';
|
|
14
14
|
import TileLayer from 'ol/layer/Tile';
|
|
15
15
|
import OSM from 'ol/source/OSM';
|
|
16
|
-
import { filter, first } from 'rxjs/operators';
|
|
17
|
-
import { XYZ, Vector } from 'ol/source';
|
|
18
16
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
19
|
-
import Overlay from 'ol/Overlay';
|
|
20
17
|
import { bbox } from 'ol/loadingstrategy';
|
|
21
18
|
import { fromExtent } from 'ol/geom/Polygon';
|
|
22
19
|
import Cluster from 'ol/source/Cluster';
|
|
20
|
+
import { combineLatest } from 'rxjs';
|
|
21
|
+
import Map from 'ol/Map';
|
|
22
|
+
import View from 'ol/View';
|
|
23
|
+
import Overlay from 'ol/Overlay';
|
|
23
24
|
import Style from 'ol/style/Style';
|
|
24
25
|
import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
|
|
25
26
|
|
|
@@ -124,6 +125,7 @@ class IdGenerator {
|
|
|
124
125
|
|
|
125
126
|
class MapConstants {
|
|
126
127
|
static FeatureInfo = 'f-info';
|
|
128
|
+
static DrawingLayerId = '93a981756ec7';
|
|
127
129
|
}
|
|
128
130
|
|
|
129
131
|
class MarkerModel {
|
|
@@ -178,18 +180,18 @@ class PolygonModel {
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
183
|
+
var DrawingType;
|
|
184
|
+
(function (DrawingType) {
|
|
185
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
186
|
+
})(DrawingType || (DrawingType = {}));
|
|
187
|
+
|
|
188
|
+
var FeatureOutputFormat;
|
|
189
|
+
(function (FeatureOutputFormat) {
|
|
190
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
191
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
192
|
+
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
191
193
|
|
|
192
|
-
class MapRenderedEvent extends
|
|
194
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
193
195
|
map;
|
|
194
196
|
static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
195
197
|
constructor(map) {
|
|
@@ -201,7 +203,7 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
class MapClickEvent extends
|
|
206
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
205
207
|
coordinates;
|
|
206
208
|
entities;
|
|
207
209
|
features;
|
|
@@ -217,7 +219,21 @@ class MapClickEvent extends GenericMessage {
|
|
|
217
219
|
}
|
|
218
220
|
}
|
|
219
221
|
|
|
220
|
-
class
|
|
222
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
223
|
+
zoom;
|
|
224
|
+
extent;
|
|
225
|
+
static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
226
|
+
constructor(zoom, extent) {
|
|
227
|
+
super();
|
|
228
|
+
this.zoom = zoom;
|
|
229
|
+
this.extent = extent;
|
|
230
|
+
}
|
|
231
|
+
get id() {
|
|
232
|
+
return MapMoveEndEvent.ID;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
221
237
|
tooltipId;
|
|
222
238
|
static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
223
239
|
constructor(tooltipId) {
|
|
@@ -229,7 +245,30 @@ class CloseTooltipCommand extends GenericMessage {
|
|
|
229
245
|
}
|
|
230
246
|
}
|
|
231
247
|
|
|
232
|
-
class
|
|
248
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
249
|
+
type;
|
|
250
|
+
style;
|
|
251
|
+
format;
|
|
252
|
+
static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
253
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
254
|
+
super();
|
|
255
|
+
this.type = type;
|
|
256
|
+
this.style = style;
|
|
257
|
+
this.format = format;
|
|
258
|
+
}
|
|
259
|
+
get id() {
|
|
260
|
+
return StartDrawingCommand.ID;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
265
|
+
static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
266
|
+
get id() {
|
|
267
|
+
return CancelDrawingCommand.ID;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
233
272
|
layer;
|
|
234
273
|
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
235
274
|
constructor(layer) {
|
|
@@ -241,7 +280,7 @@ class AddLayerCommand extends GenericMessage {
|
|
|
241
280
|
}
|
|
242
281
|
}
|
|
243
282
|
|
|
244
|
-
class PlaceLayerFeaturesCommand extends
|
|
283
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
245
284
|
layer;
|
|
246
285
|
features;
|
|
247
286
|
static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
@@ -255,7 +294,7 @@ class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
|
255
294
|
}
|
|
256
295
|
}
|
|
257
296
|
|
|
258
|
-
class RemoveLayerCommand extends
|
|
297
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
259
298
|
layer;
|
|
260
299
|
static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
261
300
|
constructor(layer) {
|
|
@@ -267,7 +306,7 @@ class RemoveLayerCommand extends GenericMessage {
|
|
|
267
306
|
}
|
|
268
307
|
}
|
|
269
308
|
|
|
270
|
-
class AddTileCommand extends
|
|
309
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
271
310
|
layer;
|
|
272
311
|
static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
273
312
|
constructor(layer) {
|
|
@@ -279,7 +318,7 @@ class AddTileCommand extends GenericMessage {
|
|
|
279
318
|
}
|
|
280
319
|
}
|
|
281
320
|
|
|
282
|
-
class RemoveTileCommand extends
|
|
321
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
283
322
|
layer;
|
|
284
323
|
static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
285
324
|
constructor(layer) {
|
|
@@ -291,7 +330,7 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
291
330
|
}
|
|
292
331
|
}
|
|
293
332
|
|
|
294
|
-
class FitToFeaturesCommand extends
|
|
333
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
295
334
|
features;
|
|
296
335
|
zoomAfter;
|
|
297
336
|
static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
@@ -305,14 +344,39 @@ class FitToFeaturesCommand extends GenericMessage {
|
|
|
305
344
|
}
|
|
306
345
|
}
|
|
307
346
|
|
|
347
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
348
|
+
name;
|
|
349
|
+
static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
350
|
+
constructor(name) {
|
|
351
|
+
super();
|
|
352
|
+
this.name = name;
|
|
353
|
+
}
|
|
354
|
+
get id() {
|
|
355
|
+
return GetLayerQuery.ID;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
360
|
+
static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
361
|
+
constructor() {
|
|
362
|
+
super();
|
|
363
|
+
}
|
|
364
|
+
get id() {
|
|
365
|
+
return DrawingFinishedEvent.ID;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
308
369
|
class MapPostboyService extends PostboyService {
|
|
309
|
-
|
|
310
|
-
|
|
370
|
+
constructor() {
|
|
371
|
+
super();
|
|
372
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
373
|
+
}
|
|
374
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
311
375
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService });
|
|
312
376
|
}
|
|
313
377
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
314
378
|
type: Injectable
|
|
315
|
-
}] });
|
|
379
|
+
}], ctorParameters: function () { return []; } });
|
|
316
380
|
|
|
317
381
|
class MapManagementService {
|
|
318
382
|
postboy;
|
|
@@ -328,6 +392,7 @@ class MapManagementService {
|
|
|
328
392
|
this.observePlaceFeatures();
|
|
329
393
|
this.observeAddTile();
|
|
330
394
|
this.observeRemoveTile();
|
|
395
|
+
this.observeLayerQuery();
|
|
331
396
|
}
|
|
332
397
|
observeRemoveTile() {
|
|
333
398
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -336,6 +401,9 @@ class MapManagementService {
|
|
|
336
401
|
this.map.removeLayer(c.layer);
|
|
337
402
|
});
|
|
338
403
|
}
|
|
404
|
+
observeLayerQuery() {
|
|
405
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers[ev.name] ?? null));
|
|
406
|
+
}
|
|
339
407
|
observeAddTile() {
|
|
340
408
|
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
341
409
|
if (!this.map)
|
|
@@ -389,7 +457,14 @@ class MapStateService {
|
|
|
389
457
|
this.postboy = postboy;
|
|
390
458
|
}
|
|
391
459
|
up() {
|
|
392
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((
|
|
460
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((ev) => {
|
|
461
|
+
this.map = ev.map;
|
|
462
|
+
this.map?.on('moveend', () => {
|
|
463
|
+
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
464
|
+
const extent = this.map?.getView().calculateExtent() || [];
|
|
465
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
466
|
+
});
|
|
467
|
+
});
|
|
393
468
|
}
|
|
394
469
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
395
470
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService });
|
|
@@ -482,10 +557,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
482
557
|
type: Injectable
|
|
483
558
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
484
559
|
|
|
560
|
+
class DrawingService {
|
|
561
|
+
postboy;
|
|
562
|
+
drawInteraction;
|
|
563
|
+
map;
|
|
564
|
+
constructor(postboy) {
|
|
565
|
+
this.postboy = postboy;
|
|
566
|
+
}
|
|
567
|
+
up() {
|
|
568
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
569
|
+
this.draw((l) => {
|
|
570
|
+
if (!l || !this.map) {
|
|
571
|
+
this.clearInteraction(l);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
575
|
+
this.drawInteraction = new Draw({
|
|
576
|
+
source: l.getSource(),
|
|
577
|
+
type: DrawingType[ev.type],
|
|
578
|
+
style: ev.style,
|
|
579
|
+
});
|
|
580
|
+
this.map.addInteraction(this.drawInteraction);
|
|
581
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
582
|
+
cancelSub.unsubscribe();
|
|
583
|
+
this.onEnd(evt, ev, l);
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
});
|
|
587
|
+
this.observeMapRender();
|
|
588
|
+
}
|
|
589
|
+
onEnd(evt, command, layer) {
|
|
590
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
591
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
592
|
+
: new WKT().writeFeature(evt.feature));
|
|
593
|
+
this.clearInteraction(layer);
|
|
594
|
+
}
|
|
595
|
+
observeMapRender() {
|
|
596
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
597
|
+
this.map = m.map;
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
draw(action) {
|
|
601
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
602
|
+
query.result.subscribe((l) => action(l));
|
|
603
|
+
this.postboy.fire(query);
|
|
604
|
+
}
|
|
605
|
+
observeCancelation(ev, layer) {
|
|
606
|
+
return this.postboy
|
|
607
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
608
|
+
.pipe(first())
|
|
609
|
+
.subscribe(() => {
|
|
610
|
+
ev.finish(null);
|
|
611
|
+
this.clearInteraction(layer);
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
clearInteraction(layer) {
|
|
615
|
+
if (!!this.drawInteraction) {
|
|
616
|
+
this.map?.removeInteraction(this.drawInteraction);
|
|
617
|
+
layer?.setSource(new Vector({}));
|
|
618
|
+
}
|
|
619
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
620
|
+
}
|
|
621
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
622
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService });
|
|
623
|
+
}
|
|
624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, decorators: [{
|
|
625
|
+
type: Injectable
|
|
626
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
627
|
+
|
|
485
628
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
486
|
-
constructor(service, management, state, feature, interaction) {
|
|
629
|
+
constructor(service, management, state, feature, interaction, drawing) {
|
|
487
630
|
super(service);
|
|
488
|
-
this.registerServices([management, state, interaction, feature]);
|
|
631
|
+
this.registerServices([management, state, interaction, feature, drawing]);
|
|
489
632
|
}
|
|
490
633
|
_up() {
|
|
491
634
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -497,143 +640,18 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
497
640
|
this.registerSubject(MapClickEvent.ID);
|
|
498
641
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
499
642
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
643
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
644
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
645
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
646
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
647
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
500
648
|
}
|
|
501
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
649
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
502
650
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
|
|
503
651
|
}
|
|
504
652
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
505
653
|
type: Injectable
|
|
506
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
|
|
507
|
-
|
|
508
|
-
class MapPlateFactory {
|
|
509
|
-
build(settings) {
|
|
510
|
-
return new Map({
|
|
511
|
-
controls: [],
|
|
512
|
-
view: new View({
|
|
513
|
-
center: settings?.center || [0, 0],
|
|
514
|
-
zoom: settings?.zoom || 4,
|
|
515
|
-
minZoom: settings?.minZoom || 0,
|
|
516
|
-
maxZoom: settings?.maxZoom || 19,
|
|
517
|
-
}),
|
|
518
|
-
layers: [],
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
522
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
523
|
-
}
|
|
524
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
525
|
-
type: Injectable,
|
|
526
|
-
args: [{
|
|
527
|
-
providedIn: 'root',
|
|
528
|
-
}]
|
|
529
|
-
}] });
|
|
530
|
-
|
|
531
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
532
|
-
layer;
|
|
533
|
-
constructor() {
|
|
534
|
-
super();
|
|
535
|
-
}
|
|
536
|
-
_url = '';
|
|
537
|
-
set url(value) {
|
|
538
|
-
if (!value || this._url === value)
|
|
539
|
-
return;
|
|
540
|
-
this._url = value;
|
|
541
|
-
this.initLayer();
|
|
542
|
-
}
|
|
543
|
-
_map;
|
|
544
|
-
set map(value) {
|
|
545
|
-
if (!value || this._map === value)
|
|
546
|
-
return;
|
|
547
|
-
this._map = value;
|
|
548
|
-
this.initLayer();
|
|
549
|
-
}
|
|
550
|
-
ngOnInit() { }
|
|
551
|
-
ngOnDestroy() {
|
|
552
|
-
if (this.layer) {
|
|
553
|
-
this._map?.removeLayer(this.layer);
|
|
554
|
-
}
|
|
555
|
-
// @ts-ignore
|
|
556
|
-
this.layer?.setMap(null);
|
|
557
|
-
}
|
|
558
|
-
initLayer() {
|
|
559
|
-
if (!this._url || !this._map)
|
|
560
|
-
return;
|
|
561
|
-
if (this.layer)
|
|
562
|
-
this._map.removeLayer(this.layer);
|
|
563
|
-
this.layer = new TileLayer({
|
|
564
|
-
source: new OSM({
|
|
565
|
-
url: this._url,
|
|
566
|
-
}),
|
|
567
|
-
});
|
|
568
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
569
|
-
this._map.addLayer(this.layer);
|
|
570
|
-
}
|
|
571
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
572
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
573
|
-
}
|
|
574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
575
|
-
type: Component,
|
|
576
|
-
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
577
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
578
|
-
type: Input
|
|
579
|
-
}], map: [{
|
|
580
|
-
type: Input
|
|
581
|
-
}] } });
|
|
582
|
-
|
|
583
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
584
|
-
elementRef;
|
|
585
|
-
postboy;
|
|
586
|
-
mapFactory;
|
|
587
|
-
registrator;
|
|
588
|
-
detector;
|
|
589
|
-
map;
|
|
590
|
-
osmUrl = '';
|
|
591
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
592
|
-
super();
|
|
593
|
-
this.elementRef = elementRef;
|
|
594
|
-
this.postboy = postboy;
|
|
595
|
-
this.mapFactory = mapFactory;
|
|
596
|
-
this.registrator = registrator;
|
|
597
|
-
this.detector = detector;
|
|
598
|
-
registrator.up();
|
|
599
|
-
}
|
|
600
|
-
_settings = new MapSettings();
|
|
601
|
-
set settings(value) {
|
|
602
|
-
if (!value || this._settings.isSame(value))
|
|
603
|
-
return;
|
|
604
|
-
this._settings = value;
|
|
605
|
-
this.setOsm();
|
|
606
|
-
}
|
|
607
|
-
ngOnInit() {
|
|
608
|
-
useGeographic();
|
|
609
|
-
this.map = this.mapFactory.build(this._settings);
|
|
610
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
611
|
-
this.detector.detectChanges();
|
|
612
|
-
this.map.once('postrender', () => {
|
|
613
|
-
this.map.updateSize();
|
|
614
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
615
|
-
});
|
|
616
|
-
this.setOsm();
|
|
617
|
-
}
|
|
618
|
-
setOsm() {
|
|
619
|
-
if (!this.map)
|
|
620
|
-
return;
|
|
621
|
-
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
622
|
-
this.detector.detectChanges();
|
|
623
|
-
this.map.updateSize();
|
|
624
|
-
}
|
|
625
|
-
onDestroy = () => {
|
|
626
|
-
this.registrator.down();
|
|
627
|
-
};
|
|
628
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
629
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
630
|
-
}
|
|
631
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
632
|
-
type: Component,
|
|
633
|
-
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
|
|
634
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
635
|
-
type: Input
|
|
636
|
-
}] } });
|
|
654
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }]; } });
|
|
637
655
|
|
|
638
656
|
class TileLayerSettings {
|
|
639
657
|
maxZoom = 19;
|
|
@@ -767,6 +785,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
767
785
|
type: Input
|
|
768
786
|
}] } });
|
|
769
787
|
|
|
788
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
789
|
+
layer;
|
|
790
|
+
constructor() {
|
|
791
|
+
super();
|
|
792
|
+
}
|
|
793
|
+
_url = '';
|
|
794
|
+
set url(value) {
|
|
795
|
+
if (!value || this._url === value)
|
|
796
|
+
return;
|
|
797
|
+
this._url = value;
|
|
798
|
+
this.initLayer();
|
|
799
|
+
}
|
|
800
|
+
_map;
|
|
801
|
+
set map(value) {
|
|
802
|
+
if (!value || this._map === value)
|
|
803
|
+
return;
|
|
804
|
+
this._map = value;
|
|
805
|
+
this.initLayer();
|
|
806
|
+
}
|
|
807
|
+
ngOnInit() { }
|
|
808
|
+
ngOnDestroy() {
|
|
809
|
+
if (this.layer) {
|
|
810
|
+
this._map?.removeLayer(this.layer);
|
|
811
|
+
}
|
|
812
|
+
// @ts-ignore
|
|
813
|
+
this.layer?.setMap(null);
|
|
814
|
+
}
|
|
815
|
+
initLayer() {
|
|
816
|
+
if (!this._url || !this._map)
|
|
817
|
+
return;
|
|
818
|
+
if (this.layer)
|
|
819
|
+
this._map.removeLayer(this.layer);
|
|
820
|
+
this.layer = new TileLayer({
|
|
821
|
+
source: new OSM({
|
|
822
|
+
url: this._url,
|
|
823
|
+
}),
|
|
824
|
+
});
|
|
825
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
826
|
+
this._map.addLayer(this.layer);
|
|
827
|
+
}
|
|
828
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
829
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
830
|
+
}
|
|
831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
832
|
+
type: Component,
|
|
833
|
+
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
834
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
835
|
+
type: Input
|
|
836
|
+
}], map: [{
|
|
837
|
+
type: Input
|
|
838
|
+
}] } });
|
|
839
|
+
|
|
770
840
|
class FeatureLayerSettings {
|
|
771
841
|
name = IdGenerator.get();
|
|
772
842
|
zIndex = 1;
|
|
@@ -878,178 +948,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
878
948
|
type: Input
|
|
879
949
|
}] } });
|
|
880
950
|
|
|
881
|
-
class MarkersComponent extends DestructibleComponent {
|
|
882
|
-
postboy;
|
|
883
|
-
layerName = '';
|
|
884
|
-
constructor(postboy) {
|
|
885
|
-
super();
|
|
886
|
-
this.postboy = postboy;
|
|
887
|
-
}
|
|
888
|
-
_markers = [];
|
|
889
|
-
set markers(value) {
|
|
890
|
-
this._markers = value;
|
|
891
|
-
this.putMarkers();
|
|
892
|
-
}
|
|
893
|
-
ngOnInit() {
|
|
894
|
-
this.postboy
|
|
895
|
-
.subscribe(MapRenderedEvent.ID)
|
|
896
|
-
.pipe(filter((m) => !!m), first())
|
|
897
|
-
.subscribe(() => this.putMarkers());
|
|
898
|
-
}
|
|
899
|
-
putMarkers() {
|
|
900
|
-
if (!this._markers?.length)
|
|
901
|
-
return;
|
|
902
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
903
|
-
}
|
|
904
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
905
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
906
|
-
}
|
|
907
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
908
|
-
type: Component,
|
|
909
|
-
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
910
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
911
|
-
type: Input
|
|
912
|
-
}], markers: [{
|
|
913
|
-
type: Input
|
|
914
|
-
}] } });
|
|
915
|
-
|
|
916
|
-
class TooltipSettings {
|
|
917
|
-
id;
|
|
918
|
-
containerClass = 'custom-tooltip-class';
|
|
919
|
-
show = (e) => true;
|
|
920
|
-
constructor(id) {
|
|
921
|
-
this.id = id ?? IdGenerator.get();
|
|
922
|
-
}
|
|
923
|
-
static copy(model) {
|
|
924
|
-
const result = new TooltipSettings(model.id);
|
|
925
|
-
result.show = model.show;
|
|
926
|
-
result.containerClass = model.containerClass;
|
|
927
|
-
return result;
|
|
928
|
-
}
|
|
929
|
-
setShow(show) {
|
|
930
|
-
return TooltipSettings.copy({ ...this, show });
|
|
931
|
-
}
|
|
932
|
-
setClass(containerClass) {
|
|
933
|
-
return TooltipSettings.copy({ ...this, containerClass });
|
|
934
|
-
}
|
|
935
|
-
isSame(model) {
|
|
936
|
-
if (this.show !== model.show)
|
|
937
|
-
return false;
|
|
938
|
-
if (this.containerClass !== model.containerClass)
|
|
939
|
-
return false;
|
|
940
|
-
if (this.id !== model.id)
|
|
941
|
-
return false;
|
|
942
|
-
return true;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
class TooltipComponent extends DestructibleComponent {
|
|
947
|
-
postboy;
|
|
948
|
-
detector;
|
|
949
|
-
container;
|
|
950
|
-
_settings = new TooltipSettings();
|
|
951
|
-
map;
|
|
952
|
-
overlay;
|
|
953
|
-
show = false;
|
|
954
|
-
set settings(value) {
|
|
955
|
-
if (!value || this._settings.isSame(value))
|
|
956
|
-
return;
|
|
957
|
-
this._settings = value;
|
|
958
|
-
this.detector.detectChanges();
|
|
959
|
-
}
|
|
960
|
-
constructor(postboy, detector) {
|
|
961
|
-
super();
|
|
962
|
-
this.postboy = postboy;
|
|
963
|
-
this.detector = detector;
|
|
964
|
-
}
|
|
965
|
-
ngOnInit() {
|
|
966
|
-
this.subs.push(this.observeMapRender());
|
|
967
|
-
this.subs.push(this.observeMapClick());
|
|
968
|
-
this.subs.push(this.observeClose());
|
|
969
|
-
}
|
|
970
|
-
observeMapClick() {
|
|
971
|
-
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
972
|
-
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
observeClose() {
|
|
976
|
-
return this.postboy
|
|
977
|
-
.subscribe(CloseTooltipCommand.ID)
|
|
978
|
-
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
979
|
-
.subscribe(() => this.removeOverlay());
|
|
980
|
-
}
|
|
981
|
-
observeMapRender() {
|
|
982
|
-
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
983
|
-
this.map = m.map;
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
removeOverlay = () => {
|
|
987
|
-
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
988
|
-
this.show = false;
|
|
989
|
-
};
|
|
990
|
-
addOverlay(coordinates) {
|
|
991
|
-
this.removeOverlay();
|
|
992
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
993
|
-
this.map?.addOverlay(this.overlay);
|
|
994
|
-
this.show = true;
|
|
995
|
-
this.detector.detectChanges();
|
|
996
|
-
}
|
|
997
|
-
options = (coordinates) => {
|
|
998
|
-
return {
|
|
999
|
-
element: this.container?.nativeElement,
|
|
1000
|
-
autoPan: false,
|
|
1001
|
-
autoPanAnimation: { duration: 0 },
|
|
1002
|
-
position: coordinates,
|
|
1003
|
-
};
|
|
1004
|
-
};
|
|
1005
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1006
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1007
|
-
}
|
|
1008
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1009
|
-
type: Component,
|
|
1010
|
-
args: [{ selector: 'lib-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
1011
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1012
|
-
type: ViewChild,
|
|
1013
|
-
args: ['tip']
|
|
1014
|
-
}], settings: [{
|
|
1015
|
-
type: Input
|
|
1016
|
-
}] } });
|
|
1017
|
-
|
|
1018
|
-
class PolygonsComponent extends DestructibleComponent {
|
|
1019
|
-
postboy;
|
|
1020
|
-
layerName = '';
|
|
1021
|
-
constructor(postboy) {
|
|
1022
|
-
super();
|
|
1023
|
-
this.postboy = postboy;
|
|
1024
|
-
}
|
|
1025
|
-
_polygons = [];
|
|
1026
|
-
set polygons(value) {
|
|
1027
|
-
this._polygons = value;
|
|
1028
|
-
this.putPolygons();
|
|
1029
|
-
}
|
|
1030
|
-
ngOnInit() {
|
|
1031
|
-
this.postboy
|
|
1032
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1033
|
-
.pipe(filter((m) => !!m), first())
|
|
1034
|
-
.subscribe(() => this.putPolygons());
|
|
1035
|
-
}
|
|
1036
|
-
putPolygons() {
|
|
1037
|
-
if (!this._polygons?.length)
|
|
1038
|
-
return;
|
|
1039
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1040
|
-
}
|
|
1041
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1042
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1043
|
-
}
|
|
1044
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1045
|
-
type: Component,
|
|
1046
|
-
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1047
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1048
|
-
type: Input
|
|
1049
|
-
}], polygons: [{
|
|
1050
|
-
type: Input
|
|
1051
|
-
}] } });
|
|
1052
|
-
|
|
1053
951
|
class ClusterLayerSettings {
|
|
1054
952
|
name = IdGenerator.get();
|
|
1055
953
|
zIndex = 1;
|
|
@@ -1057,6 +955,7 @@ class ClusterLayerSettings {
|
|
|
1057
955
|
minZoom = 0;
|
|
1058
956
|
distance = 20;
|
|
1059
957
|
bbox = false;
|
|
958
|
+
clusterCancel = 14;
|
|
1060
959
|
style;
|
|
1061
960
|
static copy(model) {
|
|
1062
961
|
const result = new ClusterLayerSettings();
|
|
@@ -1065,6 +964,7 @@ class ClusterLayerSettings {
|
|
|
1065
964
|
result.minZoom = model.minZoom;
|
|
1066
965
|
result.zIndex = model.zIndex;
|
|
1067
966
|
result.bbox = model.bbox;
|
|
967
|
+
result.clusterCancel = model.clusterCancel;
|
|
1068
968
|
result.distance = model.distance;
|
|
1069
969
|
result.style = model.style;
|
|
1070
970
|
return result;
|
|
@@ -1084,6 +984,9 @@ class ClusterLayerSettings {
|
|
|
1084
984
|
setMinZoom(minZoom) {
|
|
1085
985
|
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1086
986
|
}
|
|
987
|
+
setClusterCancel(clusterCancel) {
|
|
988
|
+
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
989
|
+
}
|
|
1087
990
|
setBbox(bbox) {
|
|
1088
991
|
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1089
992
|
}
|
|
@@ -1101,6 +1004,8 @@ class ClusterLayerSettings {
|
|
|
1101
1004
|
return false;
|
|
1102
1005
|
if (this.distance !== model.distance)
|
|
1103
1006
|
return false;
|
|
1007
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1008
|
+
return false;
|
|
1104
1009
|
if (this.bbox !== model.bbox)
|
|
1105
1010
|
return false;
|
|
1106
1011
|
if (this.style !== model.style)
|
|
@@ -1118,6 +1023,15 @@ class ClusterLayerManager {
|
|
|
1118
1023
|
this.layer = layer;
|
|
1119
1024
|
this.postboy = postboy;
|
|
1120
1025
|
this.observeClick();
|
|
1026
|
+
this.observeMapMovement();
|
|
1027
|
+
}
|
|
1028
|
+
observeMapMovement() {
|
|
1029
|
+
combineLatest([
|
|
1030
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1031
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1032
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1033
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1034
|
+
});
|
|
1121
1035
|
}
|
|
1122
1036
|
observeClick() {
|
|
1123
1037
|
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
@@ -1126,6 +1040,11 @@ class ClusterLayerManager {
|
|
|
1126
1040
|
}
|
|
1127
1041
|
});
|
|
1128
1042
|
}
|
|
1043
|
+
checkClusterNecessity(map) {
|
|
1044
|
+
let zoom = map.getView().getZoom() ?? 0;
|
|
1045
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1046
|
+
this.layer?.getSource()?.setDistance(distance);
|
|
1047
|
+
}
|
|
1129
1048
|
}
|
|
1130
1049
|
|
|
1131
1050
|
class ClusterLayerFactory {
|
|
@@ -1220,6 +1139,271 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1220
1139
|
type: Input
|
|
1221
1140
|
}] } });
|
|
1222
1141
|
|
|
1142
|
+
class MapPlateFactory {
|
|
1143
|
+
build(settings) {
|
|
1144
|
+
return new Map({
|
|
1145
|
+
controls: [],
|
|
1146
|
+
view: new View({
|
|
1147
|
+
center: settings?.center || [0, 0],
|
|
1148
|
+
zoom: settings?.zoom || 4,
|
|
1149
|
+
minZoom: settings?.minZoom || 0,
|
|
1150
|
+
maxZoom: settings?.maxZoom || 19,
|
|
1151
|
+
}),
|
|
1152
|
+
layers: [],
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1156
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1157
|
+
}
|
|
1158
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1159
|
+
type: Injectable,
|
|
1160
|
+
args: [{
|
|
1161
|
+
providedIn: 'root',
|
|
1162
|
+
}]
|
|
1163
|
+
}] });
|
|
1164
|
+
|
|
1165
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1166
|
+
elementRef;
|
|
1167
|
+
postboy;
|
|
1168
|
+
mapFactory;
|
|
1169
|
+
registrator;
|
|
1170
|
+
detector;
|
|
1171
|
+
map;
|
|
1172
|
+
osmUrl = '';
|
|
1173
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1174
|
+
super();
|
|
1175
|
+
this.elementRef = elementRef;
|
|
1176
|
+
this.postboy = postboy;
|
|
1177
|
+
this.mapFactory = mapFactory;
|
|
1178
|
+
this.registrator = registrator;
|
|
1179
|
+
this.detector = detector;
|
|
1180
|
+
registrator.up();
|
|
1181
|
+
}
|
|
1182
|
+
_settings = new MapSettings();
|
|
1183
|
+
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1184
|
+
set settings(value) {
|
|
1185
|
+
if (!value || this._settings.isSame(value))
|
|
1186
|
+
return;
|
|
1187
|
+
this._settings = value;
|
|
1188
|
+
this.setOsm();
|
|
1189
|
+
}
|
|
1190
|
+
ngOnInit() {
|
|
1191
|
+
useGeographic();
|
|
1192
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1193
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1194
|
+
this.detector.detectChanges();
|
|
1195
|
+
this.map.once('postrender', () => {
|
|
1196
|
+
this.map.updateSize();
|
|
1197
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1198
|
+
});
|
|
1199
|
+
this.setOsm();
|
|
1200
|
+
}
|
|
1201
|
+
setOsm() {
|
|
1202
|
+
if (!this.map)
|
|
1203
|
+
return;
|
|
1204
|
+
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
1205
|
+
this.detector.detectChanges();
|
|
1206
|
+
this.map.updateSize();
|
|
1207
|
+
}
|
|
1208
|
+
onDestroy = () => {
|
|
1209
|
+
this.registrator.down();
|
|
1210
|
+
};
|
|
1211
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1212
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1213
|
+
MessageRegistratorService,
|
|
1214
|
+
MapStateService,
|
|
1215
|
+
MapManagementService,
|
|
1216
|
+
MapClickService,
|
|
1217
|
+
MapFeatureService,
|
|
1218
|
+
DrawingService,
|
|
1219
|
+
], 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"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1220
|
+
}
|
|
1221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1222
|
+
type: Component,
|
|
1223
|
+
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1224
|
+
MessageRegistratorService,
|
|
1225
|
+
MapStateService,
|
|
1226
|
+
MapManagementService,
|
|
1227
|
+
MapClickService,
|
|
1228
|
+
MapFeatureService,
|
|
1229
|
+
DrawingService,
|
|
1230
|
+
], 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"] }]
|
|
1231
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1232
|
+
type: Input
|
|
1233
|
+
}] } });
|
|
1234
|
+
|
|
1235
|
+
class MarkersComponent extends DestructibleComponent {
|
|
1236
|
+
postboy;
|
|
1237
|
+
layerName = '';
|
|
1238
|
+
constructor(postboy) {
|
|
1239
|
+
super();
|
|
1240
|
+
this.postboy = postboy;
|
|
1241
|
+
}
|
|
1242
|
+
_markers = [];
|
|
1243
|
+
set markers(value) {
|
|
1244
|
+
this._markers = value;
|
|
1245
|
+
this.putMarkers();
|
|
1246
|
+
}
|
|
1247
|
+
ngOnInit() {
|
|
1248
|
+
this.postboy
|
|
1249
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1250
|
+
.pipe(filter((m) => !!m), first())
|
|
1251
|
+
.subscribe(() => this.putMarkers());
|
|
1252
|
+
}
|
|
1253
|
+
putMarkers() {
|
|
1254
|
+
if (!this._markers?.length)
|
|
1255
|
+
return;
|
|
1256
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1257
|
+
}
|
|
1258
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1259
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1260
|
+
}
|
|
1261
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
1262
|
+
type: Component,
|
|
1263
|
+
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1264
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1265
|
+
type: Input
|
|
1266
|
+
}], markers: [{
|
|
1267
|
+
type: Input
|
|
1268
|
+
}] } });
|
|
1269
|
+
|
|
1270
|
+
class TooltipSettings {
|
|
1271
|
+
id;
|
|
1272
|
+
containerClass = 'custom-tooltip-class';
|
|
1273
|
+
show = (e) => true;
|
|
1274
|
+
constructor(id) {
|
|
1275
|
+
this.id = id ?? IdGenerator.get();
|
|
1276
|
+
}
|
|
1277
|
+
static copy(model) {
|
|
1278
|
+
const result = new TooltipSettings(model.id);
|
|
1279
|
+
result.show = model.show;
|
|
1280
|
+
result.containerClass = model.containerClass;
|
|
1281
|
+
return result;
|
|
1282
|
+
}
|
|
1283
|
+
setShow(show) {
|
|
1284
|
+
return TooltipSettings.copy({ ...this, show });
|
|
1285
|
+
}
|
|
1286
|
+
setClass(containerClass) {
|
|
1287
|
+
return TooltipSettings.copy({ ...this, containerClass });
|
|
1288
|
+
}
|
|
1289
|
+
isSame(model) {
|
|
1290
|
+
if (this.show !== model.show)
|
|
1291
|
+
return false;
|
|
1292
|
+
if (this.containerClass !== model.containerClass)
|
|
1293
|
+
return false;
|
|
1294
|
+
if (this.id !== model.id)
|
|
1295
|
+
return false;
|
|
1296
|
+
return true;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
class TooltipComponent extends DestructibleComponent {
|
|
1301
|
+
postboy;
|
|
1302
|
+
detector;
|
|
1303
|
+
container;
|
|
1304
|
+
_settings = new TooltipSettings();
|
|
1305
|
+
map;
|
|
1306
|
+
overlay;
|
|
1307
|
+
show = false;
|
|
1308
|
+
set settings(value) {
|
|
1309
|
+
if (!value || this._settings.isSame(value))
|
|
1310
|
+
return;
|
|
1311
|
+
this._settings = value;
|
|
1312
|
+
this.detector.detectChanges();
|
|
1313
|
+
}
|
|
1314
|
+
constructor(postboy, detector) {
|
|
1315
|
+
super();
|
|
1316
|
+
this.postboy = postboy;
|
|
1317
|
+
this.detector = detector;
|
|
1318
|
+
}
|
|
1319
|
+
ngOnInit() {
|
|
1320
|
+
this.subs.push(this.observeMapRender());
|
|
1321
|
+
this.subs.push(this.observeMapClick());
|
|
1322
|
+
this.subs.push(this.observeClose());
|
|
1323
|
+
}
|
|
1324
|
+
observeMapClick() {
|
|
1325
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1326
|
+
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
observeClose() {
|
|
1330
|
+
return this.postboy
|
|
1331
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1332
|
+
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1333
|
+
.subscribe(() => this.removeOverlay());
|
|
1334
|
+
}
|
|
1335
|
+
observeMapRender() {
|
|
1336
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1337
|
+
this.map = m.map;
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
removeOverlay = () => {
|
|
1341
|
+
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1342
|
+
this.show = false;
|
|
1343
|
+
};
|
|
1344
|
+
addOverlay(coordinates) {
|
|
1345
|
+
this.removeOverlay();
|
|
1346
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
1347
|
+
this.map?.addOverlay(this.overlay);
|
|
1348
|
+
this.show = true;
|
|
1349
|
+
this.detector.detectChanges();
|
|
1350
|
+
}
|
|
1351
|
+
options = (coordinates) => {
|
|
1352
|
+
return {
|
|
1353
|
+
element: this.container?.nativeElement,
|
|
1354
|
+
autoPan: false,
|
|
1355
|
+
autoPanAnimation: { duration: 0 },
|
|
1356
|
+
position: coordinates,
|
|
1357
|
+
};
|
|
1358
|
+
};
|
|
1359
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1360
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1361
|
+
}
|
|
1362
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1363
|
+
type: Component,
|
|
1364
|
+
args: [{ selector: 'lib-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
1365
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1366
|
+
type: ViewChild,
|
|
1367
|
+
args: ['tip']
|
|
1368
|
+
}], settings: [{
|
|
1369
|
+
type: Input
|
|
1370
|
+
}] } });
|
|
1371
|
+
|
|
1372
|
+
class PolygonsComponent extends DestructibleComponent {
|
|
1373
|
+
postboy;
|
|
1374
|
+
layerName = '';
|
|
1375
|
+
constructor(postboy) {
|
|
1376
|
+
super();
|
|
1377
|
+
this.postboy = postboy;
|
|
1378
|
+
}
|
|
1379
|
+
_polygons = [];
|
|
1380
|
+
set polygons(value) {
|
|
1381
|
+
this._polygons = value;
|
|
1382
|
+
this.putPolygons();
|
|
1383
|
+
}
|
|
1384
|
+
ngOnInit() {
|
|
1385
|
+
this.postboy
|
|
1386
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1387
|
+
.pipe(filter((m) => !!m), first())
|
|
1388
|
+
.subscribe(() => this.putPolygons());
|
|
1389
|
+
}
|
|
1390
|
+
putPolygons() {
|
|
1391
|
+
if (!this._polygons)
|
|
1392
|
+
return;
|
|
1393
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1394
|
+
}
|
|
1395
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1396
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1397
|
+
}
|
|
1398
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1399
|
+
type: Component,
|
|
1400
|
+
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1401
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1402
|
+
type: Input
|
|
1403
|
+
}], polygons: [{
|
|
1404
|
+
type: Input
|
|
1405
|
+
}] } });
|
|
1406
|
+
|
|
1223
1407
|
class MapModule {
|
|
1224
1408
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1225
1409
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
|
|
@@ -1328,5 +1512,5 @@ class TextStyleHelper {
|
|
|
1328
1512
|
* Generated bundle index. Do not edit.
|
|
1329
1513
|
*/
|
|
1330
1514
|
|
|
1331
|
-
export {
|
|
1515
|
+
export { CancelDrawingCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, StartDrawingCommand, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
1332
1516
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|