@artstesh/maps 5.0.7 → 5.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm2022/map/helpers/index.mjs +2 -1
- package/dist/esm2022/map/helpers/stringify-feature.helper.mjs +58 -0
- package/dist/esm2022/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2022/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +25 -3
- package/dist/esm2022/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2022/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2022/map/messages/commands/start-drawing.command.mjs +18 -0
- package/dist/esm2022/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2022/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2022/map/messages/events/map-move-end.event.mjs +15 -0
- package/dist/esm2022/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2022/map/messages/index.mjs +4 -2
- package/dist/esm2022/map/messages/queries/generate-draw.query.mjs +17 -0
- package/dist/esm2022/map/messages/queries/get-layer.query.mjs +13 -0
- package/dist/esm2022/map/models/drawing-type.enum.mjs +6 -0
- package/dist/esm2022/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2022/map/models/index.mjs +3 -1
- package/dist/esm2022/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/map/services/drawing/drawing-generation.service.mjs +29 -0
- package/dist/esm2022/map/services/drawing/drawing.service.mjs +82 -0
- package/dist/esm2022/map/services/map-management.service.mjs +6 -1
- package/dist/esm2022/map/services/map-postboy.service.mjs +10 -4
- package/dist/esm2022/map/services/map-state.service.mjs +10 -2
- package/dist/esm2022/map/services/message-registrator.service.mjs +19 -5
- package/dist/esm2022/src/map/helpers/index.mjs +2 -1
- package/dist/esm2022/src/map/helpers/stringify-feature.helper.mjs +58 -0
- package/dist/esm2022/src/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +25 -3
- package/dist/esm2022/src/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2022/src/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2022/src/map/messages/commands/start-drawing.command.mjs +18 -0
- package/dist/esm2022/src/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2022/src/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2022/src/map/messages/events/map-move-end.event.mjs +15 -0
- package/dist/esm2022/src/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2022/src/map/messages/index.mjs +4 -2
- package/dist/esm2022/src/map/messages/queries/generate-draw.query.mjs +17 -0
- package/dist/esm2022/src/map/messages/queries/get-layer.query.mjs +13 -0
- package/dist/esm2022/src/map/models/drawing-type.enum.mjs +6 -0
- package/dist/esm2022/src/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2022/src/map/models/index.mjs +3 -1
- package/dist/esm2022/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2022/src/map/services/drawing/drawing-generation.service.mjs +29 -0
- package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +82 -0
- package/dist/esm2022/src/map/services/map-management.service.mjs +6 -1
- package/dist/esm2022/src/map/services/map-postboy.service.mjs +10 -4
- package/dist/esm2022/src/map/services/map-state.service.mjs +10 -2
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +19 -5
- package/dist/fesm2022/maps-components-src-map.mjs +642 -363
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2022/maps-components.mjs +642 -363
- package/dist/fesm2022/maps-components.mjs.map +1 -1
- package/dist/map/helpers/index.d.ts +1 -0
- package/dist/map/helpers/stringify-feature.helper.d.ts +8 -0
- 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/generate-draw.query.d.ts +14 -0
- package/dist/map/messages/queries/get-layer.query.d.ts +10 -0
- package/dist/map/models/drawing-type.enum.d.ts +4 -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-generation.service.d.ts +10 -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 +3 -1
- package/dist/package.json +1 -1
- package/dist/src/map/helpers/index.d.ts +1 -0
- package/dist/src/map/helpers/stringify-feature.helper.d.ts +8 -0
- 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/generate-draw.query.d.ts +14 -0
- package/dist/src/map/messages/queries/get-layer.query.d.ts +10 -0
- package/dist/src/map/models/drawing-type.enum.d.ts +4 -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-generation.service.d.ts +10 -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 +3 -1
- package/package.json +2 -2
- package/dist/esm2022/map/messages/generic-message.mjs +0 -12
- package/dist/esm2022/src/map/messages/generic-message.mjs +0 -12
- package/dist/map/messages/generic-message.d.ts +0 -9
- package/dist/src/map/messages/generic-message.d.ts +0 -9
|
@@ -3,25 +3,28 @@ import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgMod
|
|
|
3
3
|
import * as i4 from '@angular/common';
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { Feature } from 'ol';
|
|
6
|
-
import { Point } from 'ol/geom';
|
|
6
|
+
import { Point, LineString } from 'ol/geom';
|
|
7
7
|
import { GeoJSON, WKT } from 'ol/format';
|
|
8
8
|
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
9
|
-
import { useGeographic,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
9
|
+
import { get, useGeographic, transform } 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
|
+
import { createRegularPolygon } from 'ol/interaction/Draw';
|
|
14
15
|
import TileLayer from 'ol/layer/Tile';
|
|
15
16
|
import OSM from 'ol/source/OSM';
|
|
16
|
-
import { filter, first } from 'rxjs/operators';
|
|
17
|
-
import { XYZ, Vector } from 'ol/source';
|
|
18
17
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
19
|
-
import Overlay from 'ol/Overlay';
|
|
20
18
|
import { bbox } from 'ol/loadingstrategy';
|
|
21
|
-
import { fromExtent } from 'ol/geom/Polygon';
|
|
19
|
+
import Polygon, { fromExtent } from 'ol/geom/Polygon';
|
|
22
20
|
import Cluster from 'ol/source/Cluster';
|
|
21
|
+
import { combineLatest } from 'rxjs';
|
|
22
|
+
import Map from 'ol/Map';
|
|
23
|
+
import View from 'ol/View';
|
|
24
|
+
import Overlay from 'ol/Overlay';
|
|
23
25
|
import Style from 'ol/style/Style';
|
|
24
26
|
import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
|
|
27
|
+
import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
|
|
25
28
|
|
|
26
29
|
class DestructibleComponent {
|
|
27
30
|
subs = [];
|
|
@@ -124,6 +127,7 @@ class IdGenerator {
|
|
|
124
127
|
|
|
125
128
|
class MapConstants {
|
|
126
129
|
static FeatureInfo = 'f-info';
|
|
130
|
+
static DrawingLayerId = '93a981756ec7';
|
|
127
131
|
}
|
|
128
132
|
|
|
129
133
|
class MarkerModel {
|
|
@@ -178,18 +182,19 @@ class PolygonModel {
|
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
185
|
+
var DrawingType;
|
|
186
|
+
(function (DrawingType) {
|
|
187
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
188
|
+
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
189
|
+
})(DrawingType || (DrawingType = {}));
|
|
190
|
+
|
|
191
|
+
var FeatureOutputFormat;
|
|
192
|
+
(function (FeatureOutputFormat) {
|
|
193
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
194
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
195
|
+
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
191
196
|
|
|
192
|
-
class MapRenderedEvent extends
|
|
197
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
193
198
|
map;
|
|
194
199
|
static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
195
200
|
constructor(map) {
|
|
@@ -201,7 +206,7 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
201
206
|
}
|
|
202
207
|
}
|
|
203
208
|
|
|
204
|
-
class MapClickEvent extends
|
|
209
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
205
210
|
coordinates;
|
|
206
211
|
entities;
|
|
207
212
|
features;
|
|
@@ -217,7 +222,21 @@ class MapClickEvent extends GenericMessage {
|
|
|
217
222
|
}
|
|
218
223
|
}
|
|
219
224
|
|
|
220
|
-
class
|
|
225
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
226
|
+
zoom;
|
|
227
|
+
extent;
|
|
228
|
+
static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
229
|
+
constructor(zoom, extent) {
|
|
230
|
+
super();
|
|
231
|
+
this.zoom = zoom;
|
|
232
|
+
this.extent = extent;
|
|
233
|
+
}
|
|
234
|
+
get id() {
|
|
235
|
+
return MapMoveEndEvent.ID;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
221
240
|
tooltipId;
|
|
222
241
|
static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
223
242
|
constructor(tooltipId) {
|
|
@@ -229,7 +248,30 @@ class CloseTooltipCommand extends GenericMessage {
|
|
|
229
248
|
}
|
|
230
249
|
}
|
|
231
250
|
|
|
232
|
-
class
|
|
251
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
252
|
+
type;
|
|
253
|
+
style;
|
|
254
|
+
format;
|
|
255
|
+
static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
256
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
257
|
+
super();
|
|
258
|
+
this.type = type;
|
|
259
|
+
this.style = style;
|
|
260
|
+
this.format = format;
|
|
261
|
+
}
|
|
262
|
+
get id() {
|
|
263
|
+
return StartDrawingCommand.ID;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
268
|
+
static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
269
|
+
get id() {
|
|
270
|
+
return CancelDrawingCommand.ID;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
233
275
|
layer;
|
|
234
276
|
static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
235
277
|
constructor(layer) {
|
|
@@ -241,7 +283,7 @@ class AddLayerCommand extends GenericMessage {
|
|
|
241
283
|
}
|
|
242
284
|
}
|
|
243
285
|
|
|
244
|
-
class PlaceLayerFeaturesCommand extends
|
|
286
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
245
287
|
layer;
|
|
246
288
|
features;
|
|
247
289
|
static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
@@ -255,7 +297,7 @@ class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
|
255
297
|
}
|
|
256
298
|
}
|
|
257
299
|
|
|
258
|
-
class RemoveLayerCommand extends
|
|
300
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
259
301
|
layer;
|
|
260
302
|
static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
261
303
|
constructor(layer) {
|
|
@@ -267,7 +309,7 @@ class RemoveLayerCommand extends GenericMessage {
|
|
|
267
309
|
}
|
|
268
310
|
}
|
|
269
311
|
|
|
270
|
-
class AddTileCommand extends
|
|
312
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
271
313
|
layer;
|
|
272
314
|
static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
273
315
|
constructor(layer) {
|
|
@@ -279,7 +321,7 @@ class AddTileCommand extends GenericMessage {
|
|
|
279
321
|
}
|
|
280
322
|
}
|
|
281
323
|
|
|
282
|
-
class RemoveTileCommand extends
|
|
324
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
283
325
|
layer;
|
|
284
326
|
static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
285
327
|
constructor(layer) {
|
|
@@ -291,7 +333,7 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
291
333
|
}
|
|
292
334
|
}
|
|
293
335
|
|
|
294
|
-
class FitToFeaturesCommand extends
|
|
336
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
295
337
|
features;
|
|
296
338
|
zoomAfter;
|
|
297
339
|
static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
@@ -305,14 +347,55 @@ class FitToFeaturesCommand extends GenericMessage {
|
|
|
305
347
|
}
|
|
306
348
|
}
|
|
307
349
|
|
|
350
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
351
|
+
name;
|
|
352
|
+
static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
353
|
+
constructor(name) {
|
|
354
|
+
super();
|
|
355
|
+
this.name = name;
|
|
356
|
+
}
|
|
357
|
+
get id() {
|
|
358
|
+
return GetLayerQuery.ID;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
363
|
+
static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
364
|
+
constructor() {
|
|
365
|
+
super();
|
|
366
|
+
}
|
|
367
|
+
get id() {
|
|
368
|
+
return DrawingFinishedEvent.ID;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
class GenerateDrawQuery extends PostboyCallbackMessage {
|
|
373
|
+
layer;
|
|
374
|
+
style;
|
|
375
|
+
type;
|
|
376
|
+
static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
377
|
+
constructor(layer, style, type) {
|
|
378
|
+
super();
|
|
379
|
+
this.layer = layer;
|
|
380
|
+
this.style = style;
|
|
381
|
+
this.type = type;
|
|
382
|
+
}
|
|
383
|
+
get id() {
|
|
384
|
+
return GenerateDrawQuery.ID;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
308
388
|
class MapPostboyService extends PostboyService {
|
|
309
|
-
|
|
310
|
-
|
|
389
|
+
constructor() {
|
|
390
|
+
super();
|
|
391
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
392
|
+
}
|
|
393
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
311
394
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService });
|
|
312
395
|
}
|
|
313
396
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
314
397
|
type: Injectable
|
|
315
|
-
}] });
|
|
398
|
+
}], ctorParameters: function () { return []; } });
|
|
316
399
|
|
|
317
400
|
class MapManagementService {
|
|
318
401
|
postboy;
|
|
@@ -328,6 +411,7 @@ class MapManagementService {
|
|
|
328
411
|
this.observePlaceFeatures();
|
|
329
412
|
this.observeAddTile();
|
|
330
413
|
this.observeRemoveTile();
|
|
414
|
+
this.observeLayerQuery();
|
|
331
415
|
}
|
|
332
416
|
observeRemoveTile() {
|
|
333
417
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -336,6 +420,9 @@ class MapManagementService {
|
|
|
336
420
|
this.map.removeLayer(c.layer);
|
|
337
421
|
});
|
|
338
422
|
}
|
|
423
|
+
observeLayerQuery() {
|
|
424
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers[ev.name] ?? null));
|
|
425
|
+
}
|
|
339
426
|
observeAddTile() {
|
|
340
427
|
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
341
428
|
if (!this.map)
|
|
@@ -389,7 +476,14 @@ class MapStateService {
|
|
|
389
476
|
this.postboy = postboy;
|
|
390
477
|
}
|
|
391
478
|
up() {
|
|
392
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((
|
|
479
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((ev) => {
|
|
480
|
+
this.map = ev.map;
|
|
481
|
+
this.map?.on('moveend', () => {
|
|
482
|
+
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
483
|
+
const extent = this.map?.getView().calculateExtent() || [];
|
|
484
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
485
|
+
});
|
|
486
|
+
});
|
|
393
487
|
}
|
|
394
488
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
395
489
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService });
|
|
@@ -482,158 +576,124 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
482
576
|
type: Injectable
|
|
483
577
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
484
578
|
|
|
485
|
-
class
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
this.registerReplay(MapRenderedEvent.ID);
|
|
492
|
-
this.registerReplay(PlaceLayerFeaturesCommand.ID);
|
|
493
|
-
this.registerSubject(AddLayerCommand.ID);
|
|
494
|
-
this.registerSubject(RemoveLayerCommand.ID);
|
|
495
|
-
this.registerSubject(AddTileCommand.ID);
|
|
496
|
-
this.registerSubject(RemoveTileCommand.ID);
|
|
497
|
-
this.registerSubject(MapClickEvent.ID);
|
|
498
|
-
this.registerSubject(CloseTooltipCommand.ID);
|
|
499
|
-
this.registerSubject(FitToFeaturesCommand.ID);
|
|
579
|
+
class DrawingService {
|
|
580
|
+
postboy;
|
|
581
|
+
drawInteraction;
|
|
582
|
+
map;
|
|
583
|
+
constructor(postboy) {
|
|
584
|
+
this.postboy = postboy;
|
|
500
585
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
586
|
+
up() {
|
|
587
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
588
|
+
this.draw((l) => {
|
|
589
|
+
if (!l || !this.map) {
|
|
590
|
+
this.clearInteraction(l);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
const drawQuery = new GenerateDrawQuery(l, ev.style, ev.type);
|
|
594
|
+
drawQuery.result.subscribe((draw) => {
|
|
595
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
596
|
+
this.drawInteraction = draw;
|
|
597
|
+
this.map?.addInteraction(this.drawInteraction);
|
|
598
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
599
|
+
cancelSub.unsubscribe();
|
|
600
|
+
this.onEnd(evt, ev, l);
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
this.postboy.fire(drawQuery);
|
|
604
|
+
});
|
|
519
605
|
});
|
|
606
|
+
this.observeMapRender();
|
|
520
607
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
args: [{
|
|
527
|
-
providedIn: 'root',
|
|
528
|
-
}]
|
|
529
|
-
}] });
|
|
530
|
-
|
|
531
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
532
|
-
layer;
|
|
533
|
-
constructor() {
|
|
534
|
-
super();
|
|
535
|
-
}
|
|
536
|
-
_url = '';
|
|
537
|
-
set url(value) {
|
|
538
|
-
if (!value || this._url === value)
|
|
539
|
-
return;
|
|
540
|
-
this._url = value;
|
|
541
|
-
this.initLayer();
|
|
608
|
+
onEnd(evt, command, layer) {
|
|
609
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
610
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
611
|
+
: new WKT().writeFeature(evt.feature));
|
|
612
|
+
this.clearInteraction(layer);
|
|
542
613
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
this._map = value;
|
|
548
|
-
this.initLayer();
|
|
614
|
+
observeMapRender() {
|
|
615
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
616
|
+
this.map = m.map;
|
|
617
|
+
});
|
|
549
618
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
// @ts-ignore
|
|
556
|
-
this.layer?.setMap(null);
|
|
619
|
+
draw(action) {
|
|
620
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
621
|
+
query.result.subscribe((l) => action(l));
|
|
622
|
+
this.postboy.fire(query);
|
|
557
623
|
}
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
url: this._url,
|
|
566
|
-
}),
|
|
624
|
+
observeCancelation(ev, layer) {
|
|
625
|
+
return this.postboy
|
|
626
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
627
|
+
.pipe(first())
|
|
628
|
+
.subscribe(() => {
|
|
629
|
+
ev.finish(null);
|
|
630
|
+
this.clearInteraction(layer);
|
|
567
631
|
});
|
|
568
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
569
|
-
this._map.addLayer(this.layer);
|
|
570
632
|
}
|
|
571
|
-
|
|
572
|
-
|
|
633
|
+
clearInteraction(layer) {
|
|
634
|
+
if (!!this.drawInteraction) {
|
|
635
|
+
this.map?.removeInteraction(this.drawInteraction);
|
|
636
|
+
layer?.setSource(new Vector({}));
|
|
637
|
+
}
|
|
638
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
639
|
+
}
|
|
640
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
641
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService });
|
|
573
642
|
}
|
|
574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type:
|
|
575
|
-
type:
|
|
576
|
-
|
|
577
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
578
|
-
type: Input
|
|
579
|
-
}], map: [{
|
|
580
|
-
type: Input
|
|
581
|
-
}] } });
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, decorators: [{
|
|
644
|
+
type: Injectable
|
|
645
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
582
646
|
|
|
583
|
-
class
|
|
584
|
-
elementRef;
|
|
647
|
+
class DrawingGenerationService {
|
|
585
648
|
postboy;
|
|
586
|
-
|
|
587
|
-
registrator;
|
|
588
|
-
detector;
|
|
589
|
-
map;
|
|
590
|
-
osmUrl = '';
|
|
591
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
592
|
-
super();
|
|
593
|
-
this.elementRef = elementRef;
|
|
649
|
+
constructor(postboy) {
|
|
594
650
|
this.postboy = postboy;
|
|
595
|
-
this.mapFactory = mapFactory;
|
|
596
|
-
this.registrator = registrator;
|
|
597
|
-
this.detector = detector;
|
|
598
|
-
registrator.up();
|
|
599
|
-
}
|
|
600
|
-
_settings = new MapSettings();
|
|
601
|
-
set settings(value) {
|
|
602
|
-
if (!value || this._settings.isSame(value))
|
|
603
|
-
return;
|
|
604
|
-
this._settings = value;
|
|
605
|
-
this.setOsm();
|
|
606
651
|
}
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
652
|
+
up() {
|
|
653
|
+
this.postboy.subscribe(GenerateDrawQuery.ID).subscribe((ev) => {
|
|
654
|
+
ev.finish(new Draw({
|
|
655
|
+
source: ev.layer.getSource(),
|
|
656
|
+
type: DrawingType[ev.type],
|
|
657
|
+
style: ev.style,
|
|
658
|
+
geometryFunction: ev.type !== DrawingType.Circle ? undefined : createRegularPolygon(32),
|
|
659
|
+
}));
|
|
615
660
|
});
|
|
616
|
-
this.setOsm();
|
|
617
661
|
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
662
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
663
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService });
|
|
664
|
+
}
|
|
665
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingGenerationService, decorators: [{
|
|
666
|
+
type: Injectable
|
|
667
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
668
|
+
|
|
669
|
+
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
670
|
+
constructor(service, management, state, feature, interaction, drawing, drawGenerator) {
|
|
671
|
+
super(service);
|
|
672
|
+
this.registerServices([management, state, interaction, feature, drawing, drawGenerator]);
|
|
624
673
|
}
|
|
625
|
-
|
|
626
|
-
this.
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
674
|
+
_up() {
|
|
675
|
+
this.registerReplay(MapRenderedEvent.ID);
|
|
676
|
+
this.registerReplay(PlaceLayerFeaturesCommand.ID);
|
|
677
|
+
this.registerSubject(AddLayerCommand.ID);
|
|
678
|
+
this.registerSubject(RemoveLayerCommand.ID);
|
|
679
|
+
this.registerSubject(AddTileCommand.ID);
|
|
680
|
+
this.registerSubject(RemoveTileCommand.ID);
|
|
681
|
+
this.registerSubject(MapClickEvent.ID);
|
|
682
|
+
this.registerSubject(CloseTooltipCommand.ID);
|
|
683
|
+
this.registerSubject(FitToFeaturesCommand.ID);
|
|
684
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
685
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
686
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
687
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
688
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
689
|
+
this.registerSubject(GenerateDrawQuery.ID);
|
|
690
|
+
}
|
|
691
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: DrawingGenerationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
692
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
|
|
630
693
|
}
|
|
631
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type:
|
|
632
|
-
type:
|
|
633
|
-
|
|
634
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
635
|
-
type: Input
|
|
636
|
-
}] } });
|
|
694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
695
|
+
type: Injectable
|
|
696
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }]; } });
|
|
637
697
|
|
|
638
698
|
class TileLayerSettings {
|
|
639
699
|
maxZoom = 19;
|
|
@@ -767,31 +827,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
767
827
|
type: Input
|
|
768
828
|
}] } });
|
|
769
829
|
|
|
770
|
-
class
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
minZoom = 0;
|
|
775
|
-
style;
|
|
776
|
-
static copy(model) {
|
|
777
|
-
const result = new FeatureLayerSettings();
|
|
778
|
-
result.name = model.name;
|
|
779
|
-
result.maxZoom = model.maxZoom;
|
|
780
|
-
result.minZoom = model.minZoom;
|
|
781
|
-
result.zIndex = model.zIndex;
|
|
782
|
-
result.style = model.style;
|
|
783
|
-
return result;
|
|
784
|
-
}
|
|
785
|
-
setZIndex(zIndex) {
|
|
786
|
-
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
787
|
-
}
|
|
788
|
-
setName(name) {
|
|
789
|
-
return FeatureLayerSettings.copy({ ...this, name });
|
|
830
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
831
|
+
layer;
|
|
832
|
+
constructor() {
|
|
833
|
+
super();
|
|
790
834
|
}
|
|
791
|
-
|
|
792
|
-
|
|
835
|
+
_url = '';
|
|
836
|
+
set url(value) {
|
|
837
|
+
if (!value || this._url === value)
|
|
838
|
+
return;
|
|
839
|
+
this._url = value;
|
|
840
|
+
this.initLayer();
|
|
793
841
|
}
|
|
794
|
-
|
|
842
|
+
_map;
|
|
843
|
+
set map(value) {
|
|
844
|
+
if (!value || this._map === value)
|
|
845
|
+
return;
|
|
846
|
+
this._map = value;
|
|
847
|
+
this.initLayer();
|
|
848
|
+
}
|
|
849
|
+
ngOnInit() { }
|
|
850
|
+
ngOnDestroy() {
|
|
851
|
+
if (this.layer) {
|
|
852
|
+
this._map?.removeLayer(this.layer);
|
|
853
|
+
}
|
|
854
|
+
// @ts-ignore
|
|
855
|
+
this.layer?.setMap(null);
|
|
856
|
+
}
|
|
857
|
+
initLayer() {
|
|
858
|
+
if (!this._url || !this._map)
|
|
859
|
+
return;
|
|
860
|
+
if (this.layer)
|
|
861
|
+
this._map.removeLayer(this.layer);
|
|
862
|
+
this.layer = new TileLayer({
|
|
863
|
+
source: new OSM({
|
|
864
|
+
url: this._url,
|
|
865
|
+
}),
|
|
866
|
+
});
|
|
867
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
868
|
+
this._map.addLayer(this.layer);
|
|
869
|
+
}
|
|
870
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
871
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
872
|
+
}
|
|
873
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
874
|
+
type: Component,
|
|
875
|
+
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
876
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
877
|
+
type: Input
|
|
878
|
+
}], map: [{
|
|
879
|
+
type: Input
|
|
880
|
+
}] } });
|
|
881
|
+
|
|
882
|
+
class FeatureLayerSettings {
|
|
883
|
+
name = IdGenerator.get();
|
|
884
|
+
zIndex = 1;
|
|
885
|
+
maxZoom = 19;
|
|
886
|
+
minZoom = 0;
|
|
887
|
+
style;
|
|
888
|
+
static copy(model) {
|
|
889
|
+
const result = new FeatureLayerSettings();
|
|
890
|
+
result.name = model.name;
|
|
891
|
+
result.maxZoom = model.maxZoom;
|
|
892
|
+
result.minZoom = model.minZoom;
|
|
893
|
+
result.zIndex = model.zIndex;
|
|
894
|
+
result.style = model.style;
|
|
895
|
+
return result;
|
|
896
|
+
}
|
|
897
|
+
setZIndex(zIndex) {
|
|
898
|
+
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
899
|
+
}
|
|
900
|
+
setName(name) {
|
|
901
|
+
return FeatureLayerSettings.copy({ ...this, name });
|
|
902
|
+
}
|
|
903
|
+
setMaxZoom(maxZoom) {
|
|
904
|
+
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
905
|
+
}
|
|
906
|
+
setMinZoom(minZoom) {
|
|
795
907
|
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
796
908
|
}
|
|
797
909
|
setStyle(style) {
|
|
@@ -878,6 +990,292 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
878
990
|
type: Input
|
|
879
991
|
}] } });
|
|
880
992
|
|
|
993
|
+
class ClusterLayerSettings {
|
|
994
|
+
name = IdGenerator.get();
|
|
995
|
+
zIndex = 1;
|
|
996
|
+
maxZoom = 19;
|
|
997
|
+
minZoom = 0;
|
|
998
|
+
distance = 20;
|
|
999
|
+
bbox = false;
|
|
1000
|
+
clusterCancel = 14;
|
|
1001
|
+
style;
|
|
1002
|
+
static copy(model) {
|
|
1003
|
+
const result = new ClusterLayerSettings();
|
|
1004
|
+
result.name = model.name;
|
|
1005
|
+
result.maxZoom = model.maxZoom;
|
|
1006
|
+
result.minZoom = model.minZoom;
|
|
1007
|
+
result.zIndex = model.zIndex;
|
|
1008
|
+
result.bbox = model.bbox;
|
|
1009
|
+
result.clusterCancel = model.clusterCancel;
|
|
1010
|
+
result.distance = model.distance;
|
|
1011
|
+
result.style = model.style;
|
|
1012
|
+
return result;
|
|
1013
|
+
}
|
|
1014
|
+
setZIndex(zIndex) {
|
|
1015
|
+
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1016
|
+
}
|
|
1017
|
+
setDistance(distance) {
|
|
1018
|
+
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1019
|
+
}
|
|
1020
|
+
setName(name) {
|
|
1021
|
+
return ClusterLayerSettings.copy({ ...this, name });
|
|
1022
|
+
}
|
|
1023
|
+
setMaxZoom(maxZoom) {
|
|
1024
|
+
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1025
|
+
}
|
|
1026
|
+
setMinZoom(minZoom) {
|
|
1027
|
+
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1028
|
+
}
|
|
1029
|
+
setClusterCancel(clusterCancel) {
|
|
1030
|
+
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
1031
|
+
}
|
|
1032
|
+
setBbox(bbox) {
|
|
1033
|
+
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1034
|
+
}
|
|
1035
|
+
setStyle(style) {
|
|
1036
|
+
return ClusterLayerSettings.copy({ ...this, style });
|
|
1037
|
+
}
|
|
1038
|
+
isSame(model) {
|
|
1039
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1040
|
+
return false;
|
|
1041
|
+
if (this.minZoom !== model.minZoom)
|
|
1042
|
+
return false;
|
|
1043
|
+
if (this.zIndex !== model.zIndex)
|
|
1044
|
+
return false;
|
|
1045
|
+
if (this.name !== model.name)
|
|
1046
|
+
return false;
|
|
1047
|
+
if (this.distance !== model.distance)
|
|
1048
|
+
return false;
|
|
1049
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1050
|
+
return false;
|
|
1051
|
+
if (this.bbox !== model.bbox)
|
|
1052
|
+
return false;
|
|
1053
|
+
if (this.style !== model.style)
|
|
1054
|
+
return false;
|
|
1055
|
+
return true;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
class ClusterLayerManager {
|
|
1060
|
+
settings;
|
|
1061
|
+
layer;
|
|
1062
|
+
postboy;
|
|
1063
|
+
constructor(settings, layer, postboy) {
|
|
1064
|
+
this.settings = settings;
|
|
1065
|
+
this.layer = layer;
|
|
1066
|
+
this.postboy = postboy;
|
|
1067
|
+
this.observeClick();
|
|
1068
|
+
this.observeMapMovement();
|
|
1069
|
+
}
|
|
1070
|
+
observeMapMovement() {
|
|
1071
|
+
combineLatest([
|
|
1072
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1073
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1074
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1075
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
observeClick() {
|
|
1079
|
+
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1080
|
+
if ((m.features[this.settings.name]?.length ?? 0) > 1) {
|
|
1081
|
+
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
checkClusterNecessity(map) {
|
|
1086
|
+
let zoom = map.getView().getZoom() ?? 0;
|
|
1087
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1088
|
+
this.layer?.getSource()?.setDistance(distance);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
class ClusterLayerFactory {
|
|
1093
|
+
build(settings, postboy) {
|
|
1094
|
+
const source = new Vector({
|
|
1095
|
+
strategy: settings.bbox ? bbox : undefined,
|
|
1096
|
+
});
|
|
1097
|
+
const cluster = new Cluster({
|
|
1098
|
+
distance: settings.distance,
|
|
1099
|
+
source: source,
|
|
1100
|
+
geometryFunction: (feature) => {
|
|
1101
|
+
const geom = feature.getGeometry();
|
|
1102
|
+
if (geom?.getType() == 'Point') {
|
|
1103
|
+
return geom;
|
|
1104
|
+
}
|
|
1105
|
+
else if (geom?.getType() == 'Polygon') {
|
|
1106
|
+
return geom?.getInteriorPoint();
|
|
1107
|
+
}
|
|
1108
|
+
else if (geom?.getType() == 'MultiPolygon') {
|
|
1109
|
+
return fromExtent(geom.getExtent())?.getInteriorPoint();
|
|
1110
|
+
}
|
|
1111
|
+
return undefined;
|
|
1112
|
+
},
|
|
1113
|
+
});
|
|
1114
|
+
const layer = new Vector$1({
|
|
1115
|
+
source: cluster,
|
|
1116
|
+
maxZoom: settings.maxZoom || undefined,
|
|
1117
|
+
minZoom: settings.minZoom || undefined,
|
|
1118
|
+
zIndex: settings.zIndex || 0,
|
|
1119
|
+
});
|
|
1120
|
+
layer.setStyle(this.styleFunc(settings));
|
|
1121
|
+
layer.set('name', settings.name);
|
|
1122
|
+
return new ClusterLayerManager(settings, layer, postboy);
|
|
1123
|
+
}
|
|
1124
|
+
styleFunc(settings) {
|
|
1125
|
+
return (feature) => {
|
|
1126
|
+
const features = feature.get('features');
|
|
1127
|
+
if (!settings.style)
|
|
1128
|
+
return undefined;
|
|
1129
|
+
return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1132
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1133
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1134
|
+
}
|
|
1135
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1136
|
+
type: Injectable,
|
|
1137
|
+
args: [{
|
|
1138
|
+
providedIn: 'root',
|
|
1139
|
+
}]
|
|
1140
|
+
}] });
|
|
1141
|
+
|
|
1142
|
+
class ClusterLayerComponent extends DestructibleComponent {
|
|
1143
|
+
postboy;
|
|
1144
|
+
factory;
|
|
1145
|
+
manager = null;
|
|
1146
|
+
_settings = new ClusterLayerSettings();
|
|
1147
|
+
constructor(postboy, factory) {
|
|
1148
|
+
super();
|
|
1149
|
+
this.postboy = postboy;
|
|
1150
|
+
this.factory = factory;
|
|
1151
|
+
}
|
|
1152
|
+
ngOnInit() {
|
|
1153
|
+
this.postboy
|
|
1154
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1155
|
+
.pipe(filter((m) => !!m), first())
|
|
1156
|
+
.subscribe((m) => this.initLayer());
|
|
1157
|
+
}
|
|
1158
|
+
set settings(value) {
|
|
1159
|
+
if (!value || this._settings.isSame(value))
|
|
1160
|
+
return;
|
|
1161
|
+
this._settings = value;
|
|
1162
|
+
this.initLayer();
|
|
1163
|
+
}
|
|
1164
|
+
onDestroy = () => this.removeLayer();
|
|
1165
|
+
initLayer() {
|
|
1166
|
+
this.removeLayer();
|
|
1167
|
+
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1168
|
+
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1169
|
+
}
|
|
1170
|
+
removeLayer() {
|
|
1171
|
+
if (this.manager?.layer)
|
|
1172
|
+
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1173
|
+
}
|
|
1174
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1175
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1176
|
+
}
|
|
1177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1178
|
+
type: Component,
|
|
1179
|
+
args: [{ selector: 'lib-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1180
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1181
|
+
type: Input
|
|
1182
|
+
}] } });
|
|
1183
|
+
|
|
1184
|
+
class MapPlateFactory {
|
|
1185
|
+
build(settings) {
|
|
1186
|
+
return new Map({
|
|
1187
|
+
controls: [],
|
|
1188
|
+
view: new View({
|
|
1189
|
+
center: settings?.center || [0, 0],
|
|
1190
|
+
zoom: settings?.zoom || 4,
|
|
1191
|
+
minZoom: settings?.minZoom || 0,
|
|
1192
|
+
maxZoom: settings?.maxZoom || 19,
|
|
1193
|
+
}),
|
|
1194
|
+
layers: [],
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1198
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1199
|
+
}
|
|
1200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1201
|
+
type: Injectable,
|
|
1202
|
+
args: [{
|
|
1203
|
+
providedIn: 'root',
|
|
1204
|
+
}]
|
|
1205
|
+
}] });
|
|
1206
|
+
|
|
1207
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1208
|
+
elementRef;
|
|
1209
|
+
postboy;
|
|
1210
|
+
mapFactory;
|
|
1211
|
+
registrator;
|
|
1212
|
+
detector;
|
|
1213
|
+
map;
|
|
1214
|
+
osmUrl = '';
|
|
1215
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1216
|
+
super();
|
|
1217
|
+
this.elementRef = elementRef;
|
|
1218
|
+
this.postboy = postboy;
|
|
1219
|
+
this.mapFactory = mapFactory;
|
|
1220
|
+
this.registrator = registrator;
|
|
1221
|
+
this.detector = detector;
|
|
1222
|
+
registrator.up();
|
|
1223
|
+
}
|
|
1224
|
+
_settings = new MapSettings();
|
|
1225
|
+
drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1226
|
+
set settings(value) {
|
|
1227
|
+
if (!value || this._settings.isSame(value))
|
|
1228
|
+
return;
|
|
1229
|
+
this._settings = value;
|
|
1230
|
+
this.setOsm();
|
|
1231
|
+
}
|
|
1232
|
+
ngOnInit() {
|
|
1233
|
+
useGeographic();
|
|
1234
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1235
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1236
|
+
this.detector.detectChanges();
|
|
1237
|
+
this.map.once('postrender', () => {
|
|
1238
|
+
this.map.updateSize();
|
|
1239
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1240
|
+
});
|
|
1241
|
+
this.setOsm();
|
|
1242
|
+
}
|
|
1243
|
+
setOsm() {
|
|
1244
|
+
if (!this.map)
|
|
1245
|
+
return;
|
|
1246
|
+
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}`;
|
|
1247
|
+
this.detector.detectChanges();
|
|
1248
|
+
this.map.updateSize();
|
|
1249
|
+
}
|
|
1250
|
+
onDestroy = () => {
|
|
1251
|
+
this.registrator.down();
|
|
1252
|
+
};
|
|
1253
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1254
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1255
|
+
MessageRegistratorService,
|
|
1256
|
+
MapStateService,
|
|
1257
|
+
MapManagementService,
|
|
1258
|
+
MapClickService,
|
|
1259
|
+
MapFeatureService,
|
|
1260
|
+
DrawingService,
|
|
1261
|
+
DrawingGenerationService,
|
|
1262
|
+
], 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 });
|
|
1263
|
+
}
|
|
1264
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1265
|
+
type: Component,
|
|
1266
|
+
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1267
|
+
MessageRegistratorService,
|
|
1268
|
+
MapStateService,
|
|
1269
|
+
MapManagementService,
|
|
1270
|
+
MapClickService,
|
|
1271
|
+
MapFeatureService,
|
|
1272
|
+
DrawingService,
|
|
1273
|
+
DrawingGenerationService,
|
|
1274
|
+
], 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"] }]
|
|
1275
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1276
|
+
type: Input
|
|
1277
|
+
}] } });
|
|
1278
|
+
|
|
881
1279
|
class MarkersComponent extends DestructibleComponent {
|
|
882
1280
|
postboy;
|
|
883
1281
|
layerName = '';
|
|
@@ -1034,7 +1432,7 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
1034
1432
|
.subscribe(() => this.putPolygons());
|
|
1035
1433
|
}
|
|
1036
1434
|
putPolygons() {
|
|
1037
|
-
if (!this._polygons
|
|
1435
|
+
if (!this._polygons)
|
|
1038
1436
|
return;
|
|
1039
1437
|
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1040
1438
|
}
|
|
@@ -1050,176 +1448,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
1050
1448
|
type: Input
|
|
1051
1449
|
}] } });
|
|
1052
1450
|
|
|
1053
|
-
class ClusterLayerSettings {
|
|
1054
|
-
name = IdGenerator.get();
|
|
1055
|
-
zIndex = 1;
|
|
1056
|
-
maxZoom = 19;
|
|
1057
|
-
minZoom = 0;
|
|
1058
|
-
distance = 20;
|
|
1059
|
-
bbox = false;
|
|
1060
|
-
style;
|
|
1061
|
-
static copy(model) {
|
|
1062
|
-
const result = new ClusterLayerSettings();
|
|
1063
|
-
result.name = model.name;
|
|
1064
|
-
result.maxZoom = model.maxZoom;
|
|
1065
|
-
result.minZoom = model.minZoom;
|
|
1066
|
-
result.zIndex = model.zIndex;
|
|
1067
|
-
result.bbox = model.bbox;
|
|
1068
|
-
result.distance = model.distance;
|
|
1069
|
-
result.style = model.style;
|
|
1070
|
-
return result;
|
|
1071
|
-
}
|
|
1072
|
-
setZIndex(zIndex) {
|
|
1073
|
-
return ClusterLayerSettings.copy({ ...this, zIndex });
|
|
1074
|
-
}
|
|
1075
|
-
setDistance(distance) {
|
|
1076
|
-
return ClusterLayerSettings.copy({ ...this, distance });
|
|
1077
|
-
}
|
|
1078
|
-
setName(name) {
|
|
1079
|
-
return ClusterLayerSettings.copy({ ...this, name });
|
|
1080
|
-
}
|
|
1081
|
-
setMaxZoom(maxZoom) {
|
|
1082
|
-
return ClusterLayerSettings.copy({ ...this, maxZoom });
|
|
1083
|
-
}
|
|
1084
|
-
setMinZoom(minZoom) {
|
|
1085
|
-
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1086
|
-
}
|
|
1087
|
-
setBbox(bbox) {
|
|
1088
|
-
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1089
|
-
}
|
|
1090
|
-
setStyle(style) {
|
|
1091
|
-
return ClusterLayerSettings.copy({ ...this, style });
|
|
1092
|
-
}
|
|
1093
|
-
isSame(model) {
|
|
1094
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1095
|
-
return false;
|
|
1096
|
-
if (this.minZoom !== model.minZoom)
|
|
1097
|
-
return false;
|
|
1098
|
-
if (this.zIndex !== model.zIndex)
|
|
1099
|
-
return false;
|
|
1100
|
-
if (this.name !== model.name)
|
|
1101
|
-
return false;
|
|
1102
|
-
if (this.distance !== model.distance)
|
|
1103
|
-
return false;
|
|
1104
|
-
if (this.bbox !== model.bbox)
|
|
1105
|
-
return false;
|
|
1106
|
-
if (this.style !== model.style)
|
|
1107
|
-
return false;
|
|
1108
|
-
return true;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
|
|
1112
|
-
class ClusterLayerManager {
|
|
1113
|
-
settings;
|
|
1114
|
-
layer;
|
|
1115
|
-
postboy;
|
|
1116
|
-
constructor(settings, layer, postboy) {
|
|
1117
|
-
this.settings = settings;
|
|
1118
|
-
this.layer = layer;
|
|
1119
|
-
this.postboy = postboy;
|
|
1120
|
-
this.observeClick();
|
|
1121
|
-
}
|
|
1122
|
-
observeClick() {
|
|
1123
|
-
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1124
|
-
if ((m.features[this.settings.name]?.length ?? 0) > 1) {
|
|
1125
|
-
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
class ClusterLayerFactory {
|
|
1132
|
-
build(settings, postboy) {
|
|
1133
|
-
const source = new Vector({
|
|
1134
|
-
strategy: settings.bbox ? bbox : undefined,
|
|
1135
|
-
});
|
|
1136
|
-
const cluster = new Cluster({
|
|
1137
|
-
distance: settings.distance,
|
|
1138
|
-
source: source,
|
|
1139
|
-
geometryFunction: (feature) => {
|
|
1140
|
-
const geom = feature.getGeometry();
|
|
1141
|
-
if (geom?.getType() == 'Point') {
|
|
1142
|
-
return geom;
|
|
1143
|
-
}
|
|
1144
|
-
else if (geom?.getType() == 'Polygon') {
|
|
1145
|
-
return geom?.getInteriorPoint();
|
|
1146
|
-
}
|
|
1147
|
-
else if (geom?.getType() == 'MultiPolygon') {
|
|
1148
|
-
return fromExtent(geom.getExtent())?.getInteriorPoint();
|
|
1149
|
-
}
|
|
1150
|
-
return undefined;
|
|
1151
|
-
},
|
|
1152
|
-
});
|
|
1153
|
-
const layer = new Vector$1({
|
|
1154
|
-
source: cluster,
|
|
1155
|
-
maxZoom: settings.maxZoom || undefined,
|
|
1156
|
-
minZoom: settings.minZoom || undefined,
|
|
1157
|
-
zIndex: settings.zIndex || 0,
|
|
1158
|
-
});
|
|
1159
|
-
layer.setStyle(this.styleFunc(settings));
|
|
1160
|
-
layer.set('name', settings.name);
|
|
1161
|
-
return new ClusterLayerManager(settings, layer, postboy);
|
|
1162
|
-
}
|
|
1163
|
-
styleFunc(settings) {
|
|
1164
|
-
return (feature) => {
|
|
1165
|
-
const features = feature.get('features');
|
|
1166
|
-
if (!settings.style)
|
|
1167
|
-
return undefined;
|
|
1168
|
-
return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
|
|
1169
|
-
};
|
|
1170
|
-
}
|
|
1171
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1172
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1173
|
-
}
|
|
1174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1175
|
-
type: Injectable,
|
|
1176
|
-
args: [{
|
|
1177
|
-
providedIn: 'root',
|
|
1178
|
-
}]
|
|
1179
|
-
}] });
|
|
1180
|
-
|
|
1181
|
-
class ClusterLayerComponent extends DestructibleComponent {
|
|
1182
|
-
postboy;
|
|
1183
|
-
factory;
|
|
1184
|
-
manager = null;
|
|
1185
|
-
_settings = new ClusterLayerSettings();
|
|
1186
|
-
constructor(postboy, factory) {
|
|
1187
|
-
super();
|
|
1188
|
-
this.postboy = postboy;
|
|
1189
|
-
this.factory = factory;
|
|
1190
|
-
}
|
|
1191
|
-
ngOnInit() {
|
|
1192
|
-
this.postboy
|
|
1193
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1194
|
-
.pipe(filter((m) => !!m), first())
|
|
1195
|
-
.subscribe((m) => this.initLayer());
|
|
1196
|
-
}
|
|
1197
|
-
set settings(value) {
|
|
1198
|
-
if (!value || this._settings.isSame(value))
|
|
1199
|
-
return;
|
|
1200
|
-
this._settings = value;
|
|
1201
|
-
this.initLayer();
|
|
1202
|
-
}
|
|
1203
|
-
onDestroy = () => this.removeLayer();
|
|
1204
|
-
initLayer() {
|
|
1205
|
-
this.removeLayer();
|
|
1206
|
-
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1207
|
-
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1208
|
-
}
|
|
1209
|
-
removeLayer() {
|
|
1210
|
-
if (this.manager?.layer)
|
|
1211
|
-
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1212
|
-
}
|
|
1213
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1214
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1215
|
-
}
|
|
1216
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1217
|
-
type: Component,
|
|
1218
|
-
args: [{ selector: 'lib-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1219
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1220
|
-
type: Input
|
|
1221
|
-
}] } });
|
|
1222
|
-
|
|
1223
1451
|
class MapModule {
|
|
1224
1452
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1225
1453
|
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
|
|
@@ -1320,6 +1548,57 @@ class TextStyleHelper {
|
|
|
1320
1548
|
}
|
|
1321
1549
|
}
|
|
1322
1550
|
|
|
1551
|
+
class StringifyFeatureHelper {
|
|
1552
|
+
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1553
|
+
return format === FeatureOutputFormat.GeoJson
|
|
1554
|
+
? new GeoJSON().writeFeature(feature)
|
|
1555
|
+
: new WKT().writeFeature(feature);
|
|
1556
|
+
}
|
|
1557
|
+
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1558
|
+
// const clone = feature.clone();
|
|
1559
|
+
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
1560
|
+
const tetemp = feature.getGeometryName();
|
|
1561
|
+
const circle = feature.getGeometry();
|
|
1562
|
+
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
1563
|
+
const ttt = feature.getGeometry().getExtent();
|
|
1564
|
+
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
1565
|
+
const aaa = [
|
|
1566
|
+
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
1567
|
+
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
1568
|
+
];
|
|
1569
|
+
const radius = (aaa[2] - aaa[0]) / 2;
|
|
1570
|
+
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
1571
|
+
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
1572
|
+
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
1573
|
+
// var wgs84Sphere = new Sphere(6378137);
|
|
1574
|
+
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
1575
|
+
// const rad = circle.getRadius();
|
|
1576
|
+
// const degrees = 180 / Math.PI; // radians to degrees
|
|
1577
|
+
// const radians = Math.PI / 180; // degrees to radians
|
|
1578
|
+
// const rlat = rad * degrees * 1000;
|
|
1579
|
+
// const rlng = rad * radians;
|
|
1580
|
+
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
1581
|
+
}
|
|
1582
|
+
static drawCircle(point, radius) {
|
|
1583
|
+
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
1584
|
+
// const tetetemp = point;
|
|
1585
|
+
const radians = Math.PI / 180; // degrees to radians
|
|
1586
|
+
const degrees = 180 / Math.PI; // radians to degrees
|
|
1587
|
+
const earthsradius = 6378137.0;
|
|
1588
|
+
const rlat = (radius / earthsradius) * degrees;
|
|
1589
|
+
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
1590
|
+
const extp = [];
|
|
1591
|
+
for (let i = 0; i <= 32; i++) {
|
|
1592
|
+
const theta = Math.PI * (i / 16);
|
|
1593
|
+
extp.push([
|
|
1594
|
+
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
1595
|
+
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
1596
|
+
]);
|
|
1597
|
+
}
|
|
1598
|
+
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1323
1602
|
/*
|
|
1324
1603
|
* Public API Surface of maps
|
|
1325
1604
|
*/
|
|
@@ -1328,5 +1607,5 @@ class TextStyleHelper {
|
|
|
1328
1607
|
* Generated bundle index. Do not edit.
|
|
1329
1608
|
*/
|
|
1330
1609
|
|
|
1331
|
-
export {
|
|
1610
|
+
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, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
1332
1611
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|