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