@artstesh/maps 4.0.7 → 4.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/esm2020/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2020/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2020/map/map-plate/map-plate.component.mjs +22 -3
- package/dist/esm2020/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2020/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/start-drawing.command.mjs +15 -0
- package/dist/esm2020/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2020/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2020/map/messages/events/map-move-end.event.mjs +13 -0
- package/dist/esm2020/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2020/map/messages/index.mjs +4 -2
- package/dist/esm2020/map/messages/queries/get-layer.query.mjs +12 -0
- package/dist/esm2020/map/models/drawing-type.enum.mjs +5 -0
- package/dist/esm2020/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2020/map/models/index.mjs +3 -1
- package/dist/esm2020/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/map/services/drawing/drawing.service.mjs +79 -0
- package/dist/esm2020/map/services/map-management.service.mjs +6 -1
- package/dist/esm2020/map/services/map-postboy.service.mjs +8 -5
- package/dist/esm2020/map/services/map-state.service.mjs +10 -2
- package/dist/esm2020/map/services/message-registrator.service.mjs +16 -5
- package/dist/esm2020/src/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +22 -3
- package/dist/esm2020/src/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2020/src/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/start-drawing.command.mjs +15 -0
- package/dist/esm2020/src/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2020/src/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2020/src/map/messages/events/map-move-end.event.mjs +13 -0
- package/dist/esm2020/src/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2020/src/map/messages/index.mjs +4 -2
- package/dist/esm2020/src/map/messages/queries/get-layer.query.mjs +12 -0
- package/dist/esm2020/src/map/models/drawing-type.enum.mjs +5 -0
- package/dist/esm2020/src/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2020/src/map/models/index.mjs +3 -1
- package/dist/esm2020/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/src/map/services/drawing/drawing.service.mjs +79 -0
- package/dist/esm2020/src/map/services/map-management.service.mjs +6 -1
- package/dist/esm2020/src/map/services/map-postboy.service.mjs +8 -5
- package/dist/esm2020/src/map/services/map-state.service.mjs +10 -2
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +16 -5
- package/dist/fesm2015/maps-components-src-map.mjs +505 -333
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +505 -333
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +504 -335
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +504 -335
- package/dist/fesm2020/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/esm2020/map/messages/generic-message.mjs +0 -15
- package/dist/esm2020/src/map/messages/generic-message.mjs +0 -15
- 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
|
|
|
@@ -127,7 +128,8 @@ IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
|
127
128
|
|
|
128
129
|
class MapConstants {
|
|
129
130
|
}
|
|
130
|
-
MapConstants.FeatureInfo = 'f-info';
|
|
131
|
+
MapConstants.FeatureInfo = 'f-info';
|
|
132
|
+
MapConstants.DrawingLayerId = '93a981756ec7';
|
|
131
133
|
|
|
132
134
|
class MarkerModel {
|
|
133
135
|
constructor(lat, lng, id, info) {
|
|
@@ -171,21 +173,18 @@ class PolygonModel {
|
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
this.result$.complete();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
176
|
+
var DrawingType;
|
|
177
|
+
(function (DrawingType) {
|
|
178
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
179
|
+
})(DrawingType || (DrawingType = {}));
|
|
180
|
+
|
|
181
|
+
var FeatureOutputFormat;
|
|
182
|
+
(function (FeatureOutputFormat) {
|
|
183
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
184
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
185
|
+
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
187
186
|
|
|
188
|
-
class MapRenderedEvent extends
|
|
187
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
189
188
|
constructor(map) {
|
|
190
189
|
super();
|
|
191
190
|
this.map = map;
|
|
@@ -196,7 +195,7 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
196
195
|
}
|
|
197
196
|
MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
198
197
|
|
|
199
|
-
class MapClickEvent extends
|
|
198
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
200
199
|
constructor(coordinates, entities, features) {
|
|
201
200
|
super();
|
|
202
201
|
this.coordinates = coordinates;
|
|
@@ -209,7 +208,19 @@ class MapClickEvent extends GenericMessage {
|
|
|
209
208
|
}
|
|
210
209
|
MapClickEvent.ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
211
210
|
|
|
212
|
-
class
|
|
211
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
212
|
+
constructor(zoom, extent) {
|
|
213
|
+
super();
|
|
214
|
+
this.zoom = zoom;
|
|
215
|
+
this.extent = extent;
|
|
216
|
+
}
|
|
217
|
+
get id() {
|
|
218
|
+
return MapMoveEndEvent.ID;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
MapMoveEndEvent.ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
222
|
+
|
|
223
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
213
224
|
constructor(tooltipId) {
|
|
214
225
|
super();
|
|
215
226
|
this.tooltipId = tooltipId;
|
|
@@ -220,7 +231,27 @@ class CloseTooltipCommand extends GenericMessage {
|
|
|
220
231
|
}
|
|
221
232
|
CloseTooltipCommand.ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
222
233
|
|
|
223
|
-
class
|
|
234
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
235
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
236
|
+
super();
|
|
237
|
+
this.type = type;
|
|
238
|
+
this.style = style;
|
|
239
|
+
this.format = format;
|
|
240
|
+
}
|
|
241
|
+
get id() {
|
|
242
|
+
return StartDrawingCommand.ID;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
StartDrawingCommand.ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
246
|
+
|
|
247
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
248
|
+
get id() {
|
|
249
|
+
return CancelDrawingCommand.ID;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
CancelDrawingCommand.ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
253
|
+
|
|
254
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
224
255
|
constructor(layer) {
|
|
225
256
|
super();
|
|
226
257
|
this.layer = layer;
|
|
@@ -231,7 +262,7 @@ class AddLayerCommand extends GenericMessage {
|
|
|
231
262
|
}
|
|
232
263
|
AddLayerCommand.ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
233
264
|
|
|
234
|
-
class PlaceLayerFeaturesCommand extends
|
|
265
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
235
266
|
constructor(layer, features) {
|
|
236
267
|
super();
|
|
237
268
|
this.layer = layer;
|
|
@@ -243,7 +274,7 @@ class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
|
243
274
|
}
|
|
244
275
|
PlaceLayerFeaturesCommand.ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
245
276
|
|
|
246
|
-
class RemoveLayerCommand extends
|
|
277
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
247
278
|
constructor(layer) {
|
|
248
279
|
super();
|
|
249
280
|
this.layer = layer;
|
|
@@ -254,7 +285,7 @@ class RemoveLayerCommand extends GenericMessage {
|
|
|
254
285
|
}
|
|
255
286
|
RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
256
287
|
|
|
257
|
-
class AddTileCommand extends
|
|
288
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
258
289
|
constructor(layer) {
|
|
259
290
|
super();
|
|
260
291
|
this.layer = layer;
|
|
@@ -265,7 +296,7 @@ class AddTileCommand extends GenericMessage {
|
|
|
265
296
|
}
|
|
266
297
|
AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
267
298
|
|
|
268
|
-
class RemoveTileCommand extends
|
|
299
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
269
300
|
constructor(layer) {
|
|
270
301
|
super();
|
|
271
302
|
this.layer = layer;
|
|
@@ -276,7 +307,7 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
276
307
|
}
|
|
277
308
|
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
278
309
|
|
|
279
|
-
class FitToFeaturesCommand extends
|
|
310
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
280
311
|
constructor(features, zoomAfter = 0) {
|
|
281
312
|
super();
|
|
282
313
|
this.features = features;
|
|
@@ -288,17 +319,38 @@ class FitToFeaturesCommand extends GenericMessage {
|
|
|
288
319
|
}
|
|
289
320
|
FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
290
321
|
|
|
322
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
323
|
+
constructor(name) {
|
|
324
|
+
super();
|
|
325
|
+
this.name = name;
|
|
326
|
+
}
|
|
327
|
+
get id() {
|
|
328
|
+
return GetLayerQuery.ID;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
GetLayerQuery.ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
332
|
+
|
|
333
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
334
|
+
constructor() {
|
|
335
|
+
super();
|
|
336
|
+
}
|
|
337
|
+
get id() {
|
|
338
|
+
return DrawingFinishedEvent.ID;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
342
|
+
|
|
291
343
|
class MapPostboyService extends PostboyService {
|
|
292
344
|
constructor() {
|
|
293
|
-
super(
|
|
294
|
-
this.
|
|
345
|
+
super();
|
|
346
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
295
347
|
}
|
|
296
348
|
}
|
|
297
|
-
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps:
|
|
349
|
+
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
298
350
|
MapPostboyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService });
|
|
299
351
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
300
352
|
type: Injectable
|
|
301
|
-
}] });
|
|
353
|
+
}], ctorParameters: function () { return []; } });
|
|
302
354
|
|
|
303
355
|
class MapManagementService {
|
|
304
356
|
constructor(postboy) {
|
|
@@ -312,6 +364,7 @@ class MapManagementService {
|
|
|
312
364
|
this.observePlaceFeatures();
|
|
313
365
|
this.observeAddTile();
|
|
314
366
|
this.observeRemoveTile();
|
|
367
|
+
this.observeLayerQuery();
|
|
315
368
|
}
|
|
316
369
|
observeRemoveTile() {
|
|
317
370
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -320,6 +373,9 @@ class MapManagementService {
|
|
|
320
373
|
this.map.removeLayer(c.layer);
|
|
321
374
|
});
|
|
322
375
|
}
|
|
376
|
+
observeLayerQuery() {
|
|
377
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers[ev.name] ?? null));
|
|
378
|
+
}
|
|
323
379
|
observeAddTile() {
|
|
324
380
|
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
325
381
|
if (!this.map)
|
|
@@ -371,7 +427,14 @@ class MapStateService {
|
|
|
371
427
|
this.postboy = postboy;
|
|
372
428
|
}
|
|
373
429
|
up() {
|
|
374
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((
|
|
430
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((ev) => {
|
|
431
|
+
this.map = ev.map;
|
|
432
|
+
this.map?.on('moveend', () => {
|
|
433
|
+
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
434
|
+
const extent = this.map?.getView().calculateExtent() || [];
|
|
435
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
436
|
+
});
|
|
437
|
+
});
|
|
375
438
|
}
|
|
376
439
|
}
|
|
377
440
|
MapStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -460,10 +523,75 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
460
523
|
type: Injectable
|
|
461
524
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
462
525
|
|
|
526
|
+
class DrawingService {
|
|
527
|
+
constructor(postboy) {
|
|
528
|
+
this.postboy = postboy;
|
|
529
|
+
}
|
|
530
|
+
up() {
|
|
531
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
532
|
+
this.draw((l) => {
|
|
533
|
+
if (!l || !this.map) {
|
|
534
|
+
this.clearInteraction(l);
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
538
|
+
this.drawInteraction = new Draw({
|
|
539
|
+
source: l.getSource(),
|
|
540
|
+
type: DrawingType[ev.type],
|
|
541
|
+
style: ev.style,
|
|
542
|
+
});
|
|
543
|
+
this.map.addInteraction(this.drawInteraction);
|
|
544
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
545
|
+
cancelSub.unsubscribe();
|
|
546
|
+
this.onEnd(evt, ev, l);
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
this.observeMapRender();
|
|
551
|
+
}
|
|
552
|
+
onEnd(evt, command, layer) {
|
|
553
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
554
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
555
|
+
: new WKT().writeFeature(evt.feature));
|
|
556
|
+
this.clearInteraction(layer);
|
|
557
|
+
}
|
|
558
|
+
observeMapRender() {
|
|
559
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
560
|
+
this.map = m.map;
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
draw(action) {
|
|
564
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
565
|
+
query.result.subscribe((l) => action(l));
|
|
566
|
+
this.postboy.fire(query);
|
|
567
|
+
}
|
|
568
|
+
observeCancelation(ev, layer) {
|
|
569
|
+
return this.postboy
|
|
570
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
571
|
+
.pipe(first())
|
|
572
|
+
.subscribe(() => {
|
|
573
|
+
ev.finish(null);
|
|
574
|
+
this.clearInteraction(layer);
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
clearInteraction(layer) {
|
|
578
|
+
if (!!this.drawInteraction) {
|
|
579
|
+
this.map?.removeInteraction(this.drawInteraction);
|
|
580
|
+
layer?.setSource(new Vector({}));
|
|
581
|
+
}
|
|
582
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
DrawingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
586
|
+
DrawingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService });
|
|
587
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService, decorators: [{
|
|
588
|
+
type: Injectable
|
|
589
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
590
|
+
|
|
463
591
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
464
|
-
constructor(service, management, state, feature, interaction) {
|
|
592
|
+
constructor(service, management, state, feature, interaction, drawing) {
|
|
465
593
|
super(service);
|
|
466
|
-
this.registerServices([management, state, interaction, feature]);
|
|
594
|
+
this.registerServices([management, state, interaction, feature, drawing]);
|
|
467
595
|
}
|
|
468
596
|
_up() {
|
|
469
597
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -475,135 +603,18 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
475
603
|
this.registerSubject(MapClickEvent.ID);
|
|
476
604
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
477
605
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
606
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
607
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
608
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
609
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
610
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
478
611
|
}
|
|
479
612
|
}
|
|
480
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
613
|
+
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
481
614
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
|
|
482
615
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
483
616
|
type: Injectable
|
|
484
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
|
|
485
|
-
|
|
486
|
-
class MapPlateFactory {
|
|
487
|
-
build(settings) {
|
|
488
|
-
return new Map({
|
|
489
|
-
controls: [],
|
|
490
|
-
view: new View({
|
|
491
|
-
center: settings?.center || [0, 0],
|
|
492
|
-
zoom: settings?.zoom || 4,
|
|
493
|
-
minZoom: settings?.minZoom || 0,
|
|
494
|
-
maxZoom: settings?.maxZoom || 19,
|
|
495
|
-
}),
|
|
496
|
-
layers: [],
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
501
|
-
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
503
|
-
type: Injectable,
|
|
504
|
-
args: [{
|
|
505
|
-
providedIn: 'root',
|
|
506
|
-
}]
|
|
507
|
-
}] });
|
|
508
|
-
|
|
509
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
510
|
-
constructor() {
|
|
511
|
-
super();
|
|
512
|
-
this._url = '';
|
|
513
|
-
}
|
|
514
|
-
set url(value) {
|
|
515
|
-
if (!value || this._url === value)
|
|
516
|
-
return;
|
|
517
|
-
this._url = value;
|
|
518
|
-
this.initLayer();
|
|
519
|
-
}
|
|
520
|
-
set map(value) {
|
|
521
|
-
if (!value || this._map === value)
|
|
522
|
-
return;
|
|
523
|
-
this._map = value;
|
|
524
|
-
this.initLayer();
|
|
525
|
-
}
|
|
526
|
-
ngOnInit() { }
|
|
527
|
-
ngOnDestroy() {
|
|
528
|
-
if (this.layer) {
|
|
529
|
-
this._map?.removeLayer(this.layer);
|
|
530
|
-
}
|
|
531
|
-
// @ts-ignore
|
|
532
|
-
this.layer?.setMap(null);
|
|
533
|
-
}
|
|
534
|
-
initLayer() {
|
|
535
|
-
if (!this._url || !this._map)
|
|
536
|
-
return;
|
|
537
|
-
if (this.layer)
|
|
538
|
-
this._map.removeLayer(this.layer);
|
|
539
|
-
this.layer = new TileLayer({
|
|
540
|
-
source: new OSM({
|
|
541
|
-
url: this._url,
|
|
542
|
-
}),
|
|
543
|
-
});
|
|
544
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
545
|
-
this._map.addLayer(this.layer);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
-
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
551
|
-
type: Component,
|
|
552
|
-
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
553
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
554
|
-
type: Input
|
|
555
|
-
}], map: [{
|
|
556
|
-
type: Input
|
|
557
|
-
}] } });
|
|
558
|
-
|
|
559
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
560
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
561
|
-
super();
|
|
562
|
-
this.elementRef = elementRef;
|
|
563
|
-
this.postboy = postboy;
|
|
564
|
-
this.mapFactory = mapFactory;
|
|
565
|
-
this.registrator = registrator;
|
|
566
|
-
this.detector = detector;
|
|
567
|
-
this.osmUrl = '';
|
|
568
|
-
this._settings = new MapSettings();
|
|
569
|
-
this.onDestroy = () => {
|
|
570
|
-
this.registrator.down();
|
|
571
|
-
};
|
|
572
|
-
registrator.up();
|
|
573
|
-
}
|
|
574
|
-
set settings(value) {
|
|
575
|
-
if (!value || this._settings.isSame(value))
|
|
576
|
-
return;
|
|
577
|
-
this._settings = value;
|
|
578
|
-
this.setOsm();
|
|
579
|
-
}
|
|
580
|
-
ngOnInit() {
|
|
581
|
-
useGeographic();
|
|
582
|
-
this.map = this.mapFactory.build(this._settings);
|
|
583
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
584
|
-
this.detector.detectChanges();
|
|
585
|
-
this.map.once('postrender', () => {
|
|
586
|
-
this.map.updateSize();
|
|
587
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
588
|
-
});
|
|
589
|
-
this.setOsm();
|
|
590
|
-
}
|
|
591
|
-
setOsm() {
|
|
592
|
-
if (!this.map)
|
|
593
|
-
return;
|
|
594
|
-
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}`;
|
|
595
|
-
this.detector.detectChanges();
|
|
596
|
-
this.map.updateSize();
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
600
|
-
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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 });
|
|
601
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
602
|
-
type: Component,
|
|
603
|
-
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"] }]
|
|
604
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
605
|
-
type: Input
|
|
606
|
-
}] } });
|
|
617
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }]; } });
|
|
607
618
|
|
|
608
619
|
class TileLayerSettings {
|
|
609
620
|
constructor() {
|
|
@@ -736,6 +747,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
736
747
|
type: Input
|
|
737
748
|
}] } });
|
|
738
749
|
|
|
750
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
751
|
+
constructor() {
|
|
752
|
+
super();
|
|
753
|
+
this._url = '';
|
|
754
|
+
}
|
|
755
|
+
set url(value) {
|
|
756
|
+
if (!value || this._url === value)
|
|
757
|
+
return;
|
|
758
|
+
this._url = value;
|
|
759
|
+
this.initLayer();
|
|
760
|
+
}
|
|
761
|
+
set map(value) {
|
|
762
|
+
if (!value || this._map === value)
|
|
763
|
+
return;
|
|
764
|
+
this._map = value;
|
|
765
|
+
this.initLayer();
|
|
766
|
+
}
|
|
767
|
+
ngOnInit() { }
|
|
768
|
+
ngOnDestroy() {
|
|
769
|
+
if (this.layer) {
|
|
770
|
+
this._map?.removeLayer(this.layer);
|
|
771
|
+
}
|
|
772
|
+
// @ts-ignore
|
|
773
|
+
this.layer?.setMap(null);
|
|
774
|
+
}
|
|
775
|
+
initLayer() {
|
|
776
|
+
if (!this._url || !this._map)
|
|
777
|
+
return;
|
|
778
|
+
if (this.layer)
|
|
779
|
+
this._map.removeLayer(this.layer);
|
|
780
|
+
this.layer = new TileLayer({
|
|
781
|
+
source: new OSM({
|
|
782
|
+
url: this._url,
|
|
783
|
+
}),
|
|
784
|
+
});
|
|
785
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
786
|
+
this._map.addLayer(this.layer);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
790
|
+
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
792
|
+
type: Component,
|
|
793
|
+
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
794
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
795
|
+
type: Input
|
|
796
|
+
}], map: [{
|
|
797
|
+
type: Input
|
|
798
|
+
}] } });
|
|
799
|
+
|
|
739
800
|
class FeatureLayerSettings {
|
|
740
801
|
constructor() {
|
|
741
802
|
this.name = IdGenerator.get();
|
|
@@ -846,178 +907,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
846
907
|
type: Input
|
|
847
908
|
}] } });
|
|
848
909
|
|
|
849
|
-
class
|
|
850
|
-
constructor(
|
|
851
|
-
|
|
852
|
-
this.
|
|
853
|
-
this.
|
|
854
|
-
this.
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
this.
|
|
858
|
-
this.putMarkers();
|
|
859
|
-
}
|
|
860
|
-
ngOnInit() {
|
|
861
|
-
this.postboy
|
|
862
|
-
.subscribe(MapRenderedEvent.ID)
|
|
863
|
-
.pipe(filter((m) => !!m), first())
|
|
864
|
-
.subscribe(() => this.putMarkers());
|
|
865
|
-
}
|
|
866
|
-
putMarkers() {
|
|
867
|
-
if (!this._markers?.length)
|
|
868
|
-
return;
|
|
869
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
873
|
-
MarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
874
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
875
|
-
type: Component,
|
|
876
|
-
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
877
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
878
|
-
type: Input
|
|
879
|
-
}], markers: [{
|
|
880
|
-
type: Input
|
|
881
|
-
}] } });
|
|
882
|
-
|
|
883
|
-
class TooltipSettings {
|
|
884
|
-
constructor(id) {
|
|
885
|
-
this.containerClass = 'custom-tooltip-class';
|
|
886
|
-
this.show = (e) => true;
|
|
887
|
-
this.id = id ?? IdGenerator.get();
|
|
888
|
-
}
|
|
889
|
-
static copy(model) {
|
|
890
|
-
const result = new TooltipSettings(model.id);
|
|
891
|
-
result.show = model.show;
|
|
892
|
-
result.containerClass = model.containerClass;
|
|
893
|
-
return result;
|
|
894
|
-
}
|
|
895
|
-
setShow(show) {
|
|
896
|
-
return TooltipSettings.copy({ ...this, show });
|
|
897
|
-
}
|
|
898
|
-
setClass(containerClass) {
|
|
899
|
-
return TooltipSettings.copy({ ...this, containerClass });
|
|
900
|
-
}
|
|
901
|
-
isSame(model) {
|
|
902
|
-
if (this.show !== model.show)
|
|
903
|
-
return false;
|
|
904
|
-
if (this.containerClass !== model.containerClass)
|
|
905
|
-
return false;
|
|
906
|
-
if (this.id !== model.id)
|
|
907
|
-
return false;
|
|
908
|
-
return true;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
class TooltipComponent extends DestructibleComponent {
|
|
913
|
-
set settings(value) {
|
|
914
|
-
if (!value || this._settings.isSame(value))
|
|
915
|
-
return;
|
|
916
|
-
this._settings = value;
|
|
917
|
-
this.detector.detectChanges();
|
|
918
|
-
}
|
|
919
|
-
constructor(postboy, detector) {
|
|
920
|
-
super();
|
|
921
|
-
this.postboy = postboy;
|
|
922
|
-
this.detector = detector;
|
|
923
|
-
this._settings = new TooltipSettings();
|
|
924
|
-
this.show = false;
|
|
925
|
-
this.removeOverlay = () => {
|
|
926
|
-
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
927
|
-
this.show = false;
|
|
928
|
-
};
|
|
929
|
-
this.options = (coordinates) => {
|
|
930
|
-
return {
|
|
931
|
-
element: this.container?.nativeElement,
|
|
932
|
-
autoPan: false,
|
|
933
|
-
autoPanAnimation: { duration: 0 },
|
|
934
|
-
position: coordinates,
|
|
935
|
-
};
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
ngOnInit() {
|
|
939
|
-
this.subs.push(this.observeMapRender());
|
|
940
|
-
this.subs.push(this.observeMapClick());
|
|
941
|
-
this.subs.push(this.observeClose());
|
|
942
|
-
}
|
|
943
|
-
observeMapClick() {
|
|
944
|
-
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
945
|
-
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
observeClose() {
|
|
949
|
-
return this.postboy
|
|
950
|
-
.subscribe(CloseTooltipCommand.ID)
|
|
951
|
-
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
952
|
-
.subscribe(() => this.removeOverlay());
|
|
953
|
-
}
|
|
954
|
-
observeMapRender() {
|
|
955
|
-
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
956
|
-
this.map = m.map;
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
|
-
addOverlay(coordinates) {
|
|
960
|
-
this.removeOverlay();
|
|
961
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
962
|
-
this.map?.addOverlay(this.overlay);
|
|
963
|
-
this.show = true;
|
|
964
|
-
this.detector.detectChanges();
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
968
|
-
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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 });
|
|
969
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
970
|
-
type: Component,
|
|
971
|
-
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"] }]
|
|
972
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
973
|
-
type: ViewChild,
|
|
974
|
-
args: ['tip']
|
|
975
|
-
}], settings: [{
|
|
976
|
-
type: Input
|
|
977
|
-
}] } });
|
|
978
|
-
|
|
979
|
-
class PolygonsComponent extends DestructibleComponent {
|
|
980
|
-
constructor(postboy) {
|
|
981
|
-
super();
|
|
982
|
-
this.postboy = postboy;
|
|
983
|
-
this.layerName = '';
|
|
984
|
-
this._polygons = [];
|
|
985
|
-
}
|
|
986
|
-
set polygons(value) {
|
|
987
|
-
this._polygons = value;
|
|
988
|
-
this.putPolygons();
|
|
989
|
-
}
|
|
990
|
-
ngOnInit() {
|
|
991
|
-
this.postboy
|
|
992
|
-
.subscribe(MapRenderedEvent.ID)
|
|
993
|
-
.pipe(filter((m) => !!m), first())
|
|
994
|
-
.subscribe(() => this.putPolygons());
|
|
995
|
-
}
|
|
996
|
-
putPolygons() {
|
|
997
|
-
if (!this._polygons?.length)
|
|
998
|
-
return;
|
|
999
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1003
|
-
PolygonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1004
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1005
|
-
type: Component,
|
|
1006
|
-
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1007
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1008
|
-
type: Input
|
|
1009
|
-
}], polygons: [{
|
|
1010
|
-
type: Input
|
|
1011
|
-
}] } });
|
|
1012
|
-
|
|
1013
|
-
class ClusterLayerSettings {
|
|
1014
|
-
constructor() {
|
|
1015
|
-
this.name = IdGenerator.get();
|
|
1016
|
-
this.zIndex = 1;
|
|
1017
|
-
this.maxZoom = 19;
|
|
1018
|
-
this.minZoom = 0;
|
|
1019
|
-
this.distance = 20;
|
|
1020
|
-
this.bbox = false;
|
|
910
|
+
class ClusterLayerSettings {
|
|
911
|
+
constructor() {
|
|
912
|
+
this.name = IdGenerator.get();
|
|
913
|
+
this.zIndex = 1;
|
|
914
|
+
this.maxZoom = 19;
|
|
915
|
+
this.minZoom = 0;
|
|
916
|
+
this.distance = 20;
|
|
917
|
+
this.bbox = false;
|
|
918
|
+
this.clusterCancel = 14;
|
|
1021
919
|
}
|
|
1022
920
|
static copy(model) {
|
|
1023
921
|
const result = new ClusterLayerSettings();
|
|
@@ -1026,6 +924,7 @@ class ClusterLayerSettings {
|
|
|
1026
924
|
result.minZoom = model.minZoom;
|
|
1027
925
|
result.zIndex = model.zIndex;
|
|
1028
926
|
result.bbox = model.bbox;
|
|
927
|
+
result.clusterCancel = model.clusterCancel;
|
|
1029
928
|
result.distance = model.distance;
|
|
1030
929
|
result.style = model.style;
|
|
1031
930
|
return result;
|
|
@@ -1045,6 +944,9 @@ class ClusterLayerSettings {
|
|
|
1045
944
|
setMinZoom(minZoom) {
|
|
1046
945
|
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1047
946
|
}
|
|
947
|
+
setClusterCancel(clusterCancel) {
|
|
948
|
+
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
949
|
+
}
|
|
1048
950
|
setBbox(bbox) {
|
|
1049
951
|
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1050
952
|
}
|
|
@@ -1062,6 +964,8 @@ class ClusterLayerSettings {
|
|
|
1062
964
|
return false;
|
|
1063
965
|
if (this.distance !== model.distance)
|
|
1064
966
|
return false;
|
|
967
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
968
|
+
return false;
|
|
1065
969
|
if (this.bbox !== model.bbox)
|
|
1066
970
|
return false;
|
|
1067
971
|
if (this.style !== model.style)
|
|
@@ -1076,6 +980,15 @@ class ClusterLayerManager {
|
|
|
1076
980
|
this.layer = layer;
|
|
1077
981
|
this.postboy = postboy;
|
|
1078
982
|
this.observeClick();
|
|
983
|
+
this.observeMapMovement();
|
|
984
|
+
}
|
|
985
|
+
observeMapMovement() {
|
|
986
|
+
combineLatest([
|
|
987
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
988
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
989
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
990
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
991
|
+
});
|
|
1079
992
|
}
|
|
1080
993
|
observeClick() {
|
|
1081
994
|
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
@@ -1084,6 +997,11 @@ class ClusterLayerManager {
|
|
|
1084
997
|
}
|
|
1085
998
|
});
|
|
1086
999
|
}
|
|
1000
|
+
checkClusterNecessity(map) {
|
|
1001
|
+
let zoom = map.getView().getZoom() ?? 0;
|
|
1002
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1003
|
+
this.layer?.getSource()?.setDistance(distance);
|
|
1004
|
+
}
|
|
1087
1005
|
}
|
|
1088
1006
|
|
|
1089
1007
|
class ClusterLayerFactory {
|
|
@@ -1176,6 +1094,257 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1176
1094
|
type: Input
|
|
1177
1095
|
}] } });
|
|
1178
1096
|
|
|
1097
|
+
class MapPlateFactory {
|
|
1098
|
+
build(settings) {
|
|
1099
|
+
return new Map({
|
|
1100
|
+
controls: [],
|
|
1101
|
+
view: new View({
|
|
1102
|
+
center: settings?.center || [0, 0],
|
|
1103
|
+
zoom: settings?.zoom || 4,
|
|
1104
|
+
minZoom: settings?.minZoom || 0,
|
|
1105
|
+
maxZoom: settings?.maxZoom || 19,
|
|
1106
|
+
}),
|
|
1107
|
+
layers: [],
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1112
|
+
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1114
|
+
type: Injectable,
|
|
1115
|
+
args: [{
|
|
1116
|
+
providedIn: 'root',
|
|
1117
|
+
}]
|
|
1118
|
+
}] });
|
|
1119
|
+
|
|
1120
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1121
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1122
|
+
super();
|
|
1123
|
+
this.elementRef = elementRef;
|
|
1124
|
+
this.postboy = postboy;
|
|
1125
|
+
this.mapFactory = mapFactory;
|
|
1126
|
+
this.registrator = registrator;
|
|
1127
|
+
this.detector = detector;
|
|
1128
|
+
this.osmUrl = '';
|
|
1129
|
+
this._settings = new MapSettings();
|
|
1130
|
+
this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1131
|
+
this.onDestroy = () => {
|
|
1132
|
+
this.registrator.down();
|
|
1133
|
+
};
|
|
1134
|
+
registrator.up();
|
|
1135
|
+
}
|
|
1136
|
+
set settings(value) {
|
|
1137
|
+
if (!value || this._settings.isSame(value))
|
|
1138
|
+
return;
|
|
1139
|
+
this._settings = value;
|
|
1140
|
+
this.setOsm();
|
|
1141
|
+
}
|
|
1142
|
+
ngOnInit() {
|
|
1143
|
+
useGeographic();
|
|
1144
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1145
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1146
|
+
this.detector.detectChanges();
|
|
1147
|
+
this.map.once('postrender', () => {
|
|
1148
|
+
this.map.updateSize();
|
|
1149
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1150
|
+
});
|
|
1151
|
+
this.setOsm();
|
|
1152
|
+
}
|
|
1153
|
+
setOsm() {
|
|
1154
|
+
if (!this.map)
|
|
1155
|
+
return;
|
|
1156
|
+
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}`;
|
|
1157
|
+
this.detector.detectChanges();
|
|
1158
|
+
this.map.updateSize();
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1162
|
+
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1163
|
+
MessageRegistratorService,
|
|
1164
|
+
MapStateService,
|
|
1165
|
+
MapManagementService,
|
|
1166
|
+
MapClickService,
|
|
1167
|
+
MapFeatureService,
|
|
1168
|
+
DrawingService,
|
|
1169
|
+
], 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 });
|
|
1170
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1171
|
+
type: Component,
|
|
1172
|
+
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1173
|
+
MessageRegistratorService,
|
|
1174
|
+
MapStateService,
|
|
1175
|
+
MapManagementService,
|
|
1176
|
+
MapClickService,
|
|
1177
|
+
MapFeatureService,
|
|
1178
|
+
DrawingService,
|
|
1179
|
+
], 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"] }]
|
|
1180
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1181
|
+
type: Input
|
|
1182
|
+
}] } });
|
|
1183
|
+
|
|
1184
|
+
class MarkersComponent extends DestructibleComponent {
|
|
1185
|
+
constructor(postboy) {
|
|
1186
|
+
super();
|
|
1187
|
+
this.postboy = postboy;
|
|
1188
|
+
this.layerName = '';
|
|
1189
|
+
this._markers = [];
|
|
1190
|
+
}
|
|
1191
|
+
set markers(value) {
|
|
1192
|
+
this._markers = value;
|
|
1193
|
+
this.putMarkers();
|
|
1194
|
+
}
|
|
1195
|
+
ngOnInit() {
|
|
1196
|
+
this.postboy
|
|
1197
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1198
|
+
.pipe(filter((m) => !!m), first())
|
|
1199
|
+
.subscribe(() => this.putMarkers());
|
|
1200
|
+
}
|
|
1201
|
+
putMarkers() {
|
|
1202
|
+
if (!this._markers?.length)
|
|
1203
|
+
return;
|
|
1204
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1208
|
+
MarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
1210
|
+
type: Component,
|
|
1211
|
+
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1212
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1213
|
+
type: Input
|
|
1214
|
+
}], markers: [{
|
|
1215
|
+
type: Input
|
|
1216
|
+
}] } });
|
|
1217
|
+
|
|
1218
|
+
class TooltipSettings {
|
|
1219
|
+
constructor(id) {
|
|
1220
|
+
this.containerClass = 'custom-tooltip-class';
|
|
1221
|
+
this.show = (e) => true;
|
|
1222
|
+
this.id = id ?? IdGenerator.get();
|
|
1223
|
+
}
|
|
1224
|
+
static copy(model) {
|
|
1225
|
+
const result = new TooltipSettings(model.id);
|
|
1226
|
+
result.show = model.show;
|
|
1227
|
+
result.containerClass = model.containerClass;
|
|
1228
|
+
return result;
|
|
1229
|
+
}
|
|
1230
|
+
setShow(show) {
|
|
1231
|
+
return TooltipSettings.copy({ ...this, show });
|
|
1232
|
+
}
|
|
1233
|
+
setClass(containerClass) {
|
|
1234
|
+
return TooltipSettings.copy({ ...this, containerClass });
|
|
1235
|
+
}
|
|
1236
|
+
isSame(model) {
|
|
1237
|
+
if (this.show !== model.show)
|
|
1238
|
+
return false;
|
|
1239
|
+
if (this.containerClass !== model.containerClass)
|
|
1240
|
+
return false;
|
|
1241
|
+
if (this.id !== model.id)
|
|
1242
|
+
return false;
|
|
1243
|
+
return true;
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
class TooltipComponent extends DestructibleComponent {
|
|
1248
|
+
set settings(value) {
|
|
1249
|
+
if (!value || this._settings.isSame(value))
|
|
1250
|
+
return;
|
|
1251
|
+
this._settings = value;
|
|
1252
|
+
this.detector.detectChanges();
|
|
1253
|
+
}
|
|
1254
|
+
constructor(postboy, detector) {
|
|
1255
|
+
super();
|
|
1256
|
+
this.postboy = postboy;
|
|
1257
|
+
this.detector = detector;
|
|
1258
|
+
this._settings = new TooltipSettings();
|
|
1259
|
+
this.show = false;
|
|
1260
|
+
this.removeOverlay = () => {
|
|
1261
|
+
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1262
|
+
this.show = false;
|
|
1263
|
+
};
|
|
1264
|
+
this.options = (coordinates) => {
|
|
1265
|
+
return {
|
|
1266
|
+
element: this.container?.nativeElement,
|
|
1267
|
+
autoPan: false,
|
|
1268
|
+
autoPanAnimation: { duration: 0 },
|
|
1269
|
+
position: coordinates,
|
|
1270
|
+
};
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
1273
|
+
ngOnInit() {
|
|
1274
|
+
this.subs.push(this.observeMapRender());
|
|
1275
|
+
this.subs.push(this.observeMapClick());
|
|
1276
|
+
this.subs.push(this.observeClose());
|
|
1277
|
+
}
|
|
1278
|
+
observeMapClick() {
|
|
1279
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1280
|
+
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
observeClose() {
|
|
1284
|
+
return this.postboy
|
|
1285
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1286
|
+
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1287
|
+
.subscribe(() => this.removeOverlay());
|
|
1288
|
+
}
|
|
1289
|
+
observeMapRender() {
|
|
1290
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1291
|
+
this.map = m.map;
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
1294
|
+
addOverlay(coordinates) {
|
|
1295
|
+
this.removeOverlay();
|
|
1296
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
1297
|
+
this.map?.addOverlay(this.overlay);
|
|
1298
|
+
this.show = true;
|
|
1299
|
+
this.detector.detectChanges();
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1303
|
+
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", 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 });
|
|
1304
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1305
|
+
type: Component,
|
|
1306
|
+
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"] }]
|
|
1307
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1308
|
+
type: ViewChild,
|
|
1309
|
+
args: ['tip']
|
|
1310
|
+
}], settings: [{
|
|
1311
|
+
type: Input
|
|
1312
|
+
}] } });
|
|
1313
|
+
|
|
1314
|
+
class PolygonsComponent extends DestructibleComponent {
|
|
1315
|
+
constructor(postboy) {
|
|
1316
|
+
super();
|
|
1317
|
+
this.postboy = postboy;
|
|
1318
|
+
this.layerName = '';
|
|
1319
|
+
this._polygons = [];
|
|
1320
|
+
}
|
|
1321
|
+
set polygons(value) {
|
|
1322
|
+
this._polygons = value;
|
|
1323
|
+
this.putPolygons();
|
|
1324
|
+
}
|
|
1325
|
+
ngOnInit() {
|
|
1326
|
+
this.postboy
|
|
1327
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1328
|
+
.pipe(filter((m) => !!m), first())
|
|
1329
|
+
.subscribe(() => this.putPolygons());
|
|
1330
|
+
}
|
|
1331
|
+
putPolygons() {
|
|
1332
|
+
if (!this._polygons)
|
|
1333
|
+
return;
|
|
1334
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1338
|
+
PolygonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1340
|
+
type: Component,
|
|
1341
|
+
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1342
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1343
|
+
type: Input
|
|
1344
|
+
}], polygons: [{
|
|
1345
|
+
type: Input
|
|
1346
|
+
}] } });
|
|
1347
|
+
|
|
1179
1348
|
class MapModule {
|
|
1180
1349
|
}
|
|
1181
1350
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1284,5 +1453,5 @@ class TextStyleHelper {
|
|
|
1284
1453
|
* Generated bundle index. Do not edit.
|
|
1285
1454
|
*/
|
|
1286
1455
|
|
|
1287
|
-
export {
|
|
1456
|
+
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 };
|
|
1288
1457
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|