@artstesh/maps 1.0.7 → 1.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/bundles/maps-components-src-map.umd.js +797 -484
- package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
- package/dist/bundles/maps-components.umd.js +797 -484
- package/dist/bundles/maps-components.umd.js.map +1 -1
- package/dist/esm2015/map/helpers/index.js +2 -1
- package/dist/esm2015/map/helpers/stringify-feature.helper.js +58 -0
- package/dist/esm2015/map/helpers/text-style.helper.js +1 -1
- package/dist/esm2015/map/map-plate/features/polygons/polygons.component.js +2 -3
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +1 -1
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +20 -2
- package/dist/esm2015/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +8 -1
- package/dist/esm2015/map/map-plate/layers/tile-layer/tile-layer.component.js +1 -1
- package/dist/esm2015/map/map-plate/map-plate.component.js +26 -4
- package/dist/esm2015/map/messages/commands/add-layer.command.js +3 -3
- package/dist/esm2015/map/messages/commands/add-tile.command.js +3 -3
- package/dist/esm2015/map/messages/commands/cancel-drawing.command.js +8 -0
- package/dist/esm2015/map/messages/commands/close-tooltip.command.js +3 -3
- package/dist/esm2015/map/messages/commands/fit-to-features.command.js +3 -3
- package/dist/esm2015/map/messages/commands/place-layer-features.command.js +3 -3
- package/dist/esm2015/map/messages/commands/remove-layer.command.js +3 -3
- package/dist/esm2015/map/messages/commands/remove-tile.command.js +3 -3
- package/dist/esm2015/map/messages/commands/start-drawing.command.js +15 -0
- package/dist/esm2015/map/messages/events/drawing-finished.event.js +11 -0
- package/dist/esm2015/map/messages/events/map-click.event.js +3 -3
- package/dist/esm2015/map/messages/events/map-move-end.event.js +13 -0
- package/dist/esm2015/map/messages/events/map-rendered.event.js +3 -3
- package/dist/esm2015/map/messages/index.js +4 -2
- package/dist/esm2015/map/messages/queries/generate-draw.query.js +14 -0
- package/dist/esm2015/map/messages/queries/get-layer.query.js +12 -0
- package/dist/esm2015/map/models/drawing-type.enum.js +6 -0
- package/dist/esm2015/map/models/feature-format.enum.js +6 -0
- package/dist/esm2015/map/models/index.js +3 -1
- package/dist/esm2015/map/models/map.constants.js +2 -1
- package/dist/esm2015/map/services/drawing/drawing-generation.service.js +28 -0
- package/dist/esm2015/map/services/drawing/drawing.service.js +81 -0
- package/dist/esm2015/map/services/map-management.service.js +6 -1
- package/dist/esm2015/map/services/map-postboy.service.js +8 -5
- package/dist/esm2015/map/services/map-state.service.js +12 -2
- package/dist/esm2015/map/services/message-registrator.service.js +19 -5
- package/dist/esm2015/src/map/helpers/index.js +2 -1
- package/dist/esm2015/src/map/helpers/stringify-feature.helper.js +58 -0
- package/dist/esm2015/src/map/helpers/text-style.helper.js +1 -1
- package/dist/esm2015/src/map/map-plate/features/polygons/polygons.component.js +2 -3
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.js +1 -1
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.js +20 -2
- package/dist/esm2015/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.js +8 -1
- package/dist/esm2015/src/map/map-plate/layers/tile-layer/tile-layer.component.js +1 -1
- package/dist/esm2015/src/map/map-plate/map-plate.component.js +26 -4
- package/dist/esm2015/src/map/messages/commands/add-layer.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/add-tile.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/cancel-drawing.command.js +8 -0
- package/dist/esm2015/src/map/messages/commands/close-tooltip.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/fit-to-features.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/place-layer-features.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/remove-layer.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/remove-tile.command.js +3 -3
- package/dist/esm2015/src/map/messages/commands/start-drawing.command.js +15 -0
- package/dist/esm2015/src/map/messages/events/drawing-finished.event.js +11 -0
- package/dist/esm2015/src/map/messages/events/map-click.event.js +3 -3
- package/dist/esm2015/src/map/messages/events/map-move-end.event.js +13 -0
- package/dist/esm2015/src/map/messages/events/map-rendered.event.js +3 -3
- package/dist/esm2015/src/map/messages/index.js +4 -2
- package/dist/esm2015/src/map/messages/queries/generate-draw.query.js +14 -0
- package/dist/esm2015/src/map/messages/queries/get-layer.query.js +12 -0
- package/dist/esm2015/src/map/models/drawing-type.enum.js +6 -0
- package/dist/esm2015/src/map/models/feature-format.enum.js +6 -0
- package/dist/esm2015/src/map/models/index.js +3 -1
- package/dist/esm2015/src/map/models/map.constants.js +2 -1
- package/dist/esm2015/src/map/services/drawing/drawing-generation.service.js +28 -0
- package/dist/esm2015/src/map/services/drawing/drawing.service.js +81 -0
- package/dist/esm2015/src/map/services/map-management.service.js +6 -1
- package/dist/esm2015/src/map/services/map-postboy.service.js +8 -5
- package/dist/esm2015/src/map/services/map-state.service.js +12 -2
- package/dist/esm2015/src/map/services/message-registrator.service.js +19 -5
- package/dist/fesm2015/maps-components-src-map.js +638 -374
- package/dist/fesm2015/maps-components-src-map.js.map +1 -1
- package/dist/fesm2015/maps-components.js +638 -374
- package/dist/fesm2015/maps-components.js.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/esm2015/map/messages/generic-message.js +0 -15
- package/dist/esm2015/src/map/messages/generic-message.js +0 -15
- package/dist/map/messages/generic-message.d.ts +0 -9
- package/dist/src/map/messages/generic-message.d.ts +0 -9
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Component, Injectable, ChangeDetectionStrategy, Input, ViewChild, NgModule } from '@angular/core';
|
|
3
|
-
import * as
|
|
3
|
+
import * as i6 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
|
constructor() {
|
|
@@ -127,7 +130,8 @@ IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
|
127
130
|
|
|
128
131
|
class MapConstants {
|
|
129
132
|
}
|
|
130
|
-
MapConstants.FeatureInfo = 'f-info';
|
|
133
|
+
MapConstants.FeatureInfo = 'f-info';
|
|
134
|
+
MapConstants.DrawingLayerId = '93a981756ec7';
|
|
131
135
|
|
|
132
136
|
class MarkerModel {
|
|
133
137
|
constructor(lat, lng, id, info) {
|
|
@@ -172,21 +176,19 @@ class PolygonModel {
|
|
|
172
176
|
}
|
|
173
177
|
}
|
|
174
178
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
}
|
|
179
|
+
var DrawingType;
|
|
180
|
+
(function (DrawingType) {
|
|
181
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
182
|
+
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
183
|
+
})(DrawingType || (DrawingType = {}));
|
|
184
|
+
|
|
185
|
+
var FeatureOutputFormat;
|
|
186
|
+
(function (FeatureOutputFormat) {
|
|
187
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
188
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
189
|
+
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
188
190
|
|
|
189
|
-
class MapRenderedEvent extends
|
|
191
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
190
192
|
constructor(map) {
|
|
191
193
|
super();
|
|
192
194
|
this.map = map;
|
|
@@ -197,7 +199,7 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
197
199
|
}
|
|
198
200
|
MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
199
201
|
|
|
200
|
-
class MapClickEvent extends
|
|
202
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
201
203
|
constructor(coordinates, entities, features) {
|
|
202
204
|
super();
|
|
203
205
|
this.coordinates = coordinates;
|
|
@@ -210,7 +212,19 @@ class MapClickEvent extends GenericMessage {
|
|
|
210
212
|
}
|
|
211
213
|
MapClickEvent.ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
212
214
|
|
|
213
|
-
class
|
|
215
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
216
|
+
constructor(zoom, extent) {
|
|
217
|
+
super();
|
|
218
|
+
this.zoom = zoom;
|
|
219
|
+
this.extent = extent;
|
|
220
|
+
}
|
|
221
|
+
get id() {
|
|
222
|
+
return MapMoveEndEvent.ID;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
MapMoveEndEvent.ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
226
|
+
|
|
227
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
214
228
|
constructor(tooltipId) {
|
|
215
229
|
super();
|
|
216
230
|
this.tooltipId = tooltipId;
|
|
@@ -221,7 +235,27 @@ class CloseTooltipCommand extends GenericMessage {
|
|
|
221
235
|
}
|
|
222
236
|
CloseTooltipCommand.ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
223
237
|
|
|
224
|
-
class
|
|
238
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
239
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
240
|
+
super();
|
|
241
|
+
this.type = type;
|
|
242
|
+
this.style = style;
|
|
243
|
+
this.format = format;
|
|
244
|
+
}
|
|
245
|
+
get id() {
|
|
246
|
+
return StartDrawingCommand.ID;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
StartDrawingCommand.ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
250
|
+
|
|
251
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
252
|
+
get id() {
|
|
253
|
+
return CancelDrawingCommand.ID;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
CancelDrawingCommand.ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
257
|
+
|
|
258
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
225
259
|
constructor(layer) {
|
|
226
260
|
super();
|
|
227
261
|
this.layer = layer;
|
|
@@ -232,7 +266,7 @@ class AddLayerCommand extends GenericMessage {
|
|
|
232
266
|
}
|
|
233
267
|
AddLayerCommand.ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
234
268
|
|
|
235
|
-
class PlaceLayerFeaturesCommand extends
|
|
269
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
236
270
|
constructor(layer, features) {
|
|
237
271
|
super();
|
|
238
272
|
this.layer = layer;
|
|
@@ -244,7 +278,7 @@ class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
|
244
278
|
}
|
|
245
279
|
PlaceLayerFeaturesCommand.ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
246
280
|
|
|
247
|
-
class RemoveLayerCommand extends
|
|
281
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
248
282
|
constructor(layer) {
|
|
249
283
|
super();
|
|
250
284
|
this.layer = layer;
|
|
@@ -255,7 +289,7 @@ class RemoveLayerCommand extends GenericMessage {
|
|
|
255
289
|
}
|
|
256
290
|
RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
257
291
|
|
|
258
|
-
class AddTileCommand extends
|
|
292
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
259
293
|
constructor(layer) {
|
|
260
294
|
super();
|
|
261
295
|
this.layer = layer;
|
|
@@ -266,7 +300,7 @@ class AddTileCommand extends GenericMessage {
|
|
|
266
300
|
}
|
|
267
301
|
AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
268
302
|
|
|
269
|
-
class RemoveTileCommand extends
|
|
303
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
270
304
|
constructor(layer) {
|
|
271
305
|
super();
|
|
272
306
|
this.layer = layer;
|
|
@@ -277,7 +311,7 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
277
311
|
}
|
|
278
312
|
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
279
313
|
|
|
280
|
-
class FitToFeaturesCommand extends
|
|
314
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
281
315
|
constructor(features, zoomAfter = 0) {
|
|
282
316
|
super();
|
|
283
317
|
this.features = features;
|
|
@@ -289,17 +323,51 @@ class FitToFeaturesCommand extends GenericMessage {
|
|
|
289
323
|
}
|
|
290
324
|
FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
291
325
|
|
|
326
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
327
|
+
constructor(name) {
|
|
328
|
+
super();
|
|
329
|
+
this.name = name;
|
|
330
|
+
}
|
|
331
|
+
get id() {
|
|
332
|
+
return GetLayerQuery.ID;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
GetLayerQuery.ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
336
|
+
|
|
337
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
338
|
+
constructor() {
|
|
339
|
+
super();
|
|
340
|
+
}
|
|
341
|
+
get id() {
|
|
342
|
+
return DrawingFinishedEvent.ID;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
346
|
+
|
|
347
|
+
class GenerateDrawQuery extends PostboyCallbackMessage {
|
|
348
|
+
constructor(layer, style, type) {
|
|
349
|
+
super();
|
|
350
|
+
this.layer = layer;
|
|
351
|
+
this.style = style;
|
|
352
|
+
this.type = type;
|
|
353
|
+
}
|
|
354
|
+
get id() {
|
|
355
|
+
return GenerateDrawQuery.ID;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
GenerateDrawQuery.ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
359
|
+
|
|
292
360
|
class MapPostboyService extends PostboyService {
|
|
293
361
|
constructor() {
|
|
294
|
-
super(
|
|
295
|
-
this.
|
|
362
|
+
super();
|
|
363
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
296
364
|
}
|
|
297
365
|
}
|
|
298
|
-
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPostboyService, deps:
|
|
366
|
+
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
299
367
|
MapPostboyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPostboyService });
|
|
300
368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
301
369
|
type: Injectable
|
|
302
|
-
}] });
|
|
370
|
+
}], ctorParameters: function () { return []; } });
|
|
303
371
|
|
|
304
372
|
class MapManagementService {
|
|
305
373
|
constructor(postboy) {
|
|
@@ -313,6 +381,7 @@ class MapManagementService {
|
|
|
313
381
|
this.observePlaceFeatures();
|
|
314
382
|
this.observeAddTile();
|
|
315
383
|
this.observeRemoveTile();
|
|
384
|
+
this.observeLayerQuery();
|
|
316
385
|
}
|
|
317
386
|
observeRemoveTile() {
|
|
318
387
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -321,6 +390,9 @@ class MapManagementService {
|
|
|
321
390
|
this.map.removeLayer(c.layer);
|
|
322
391
|
});
|
|
323
392
|
}
|
|
393
|
+
observeLayerQuery() {
|
|
394
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => { var _a; return ev.finish((_a = this.layers[ev.name]) !== null && _a !== void 0 ? _a : null); });
|
|
395
|
+
}
|
|
324
396
|
observeAddTile() {
|
|
325
397
|
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
326
398
|
if (!this.map)
|
|
@@ -373,7 +445,16 @@ class MapStateService {
|
|
|
373
445
|
this.postboy = postboy;
|
|
374
446
|
}
|
|
375
447
|
up() {
|
|
376
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((
|
|
448
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((ev) => {
|
|
449
|
+
var _a;
|
|
450
|
+
this.map = ev.map;
|
|
451
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.on('moveend', () => {
|
|
452
|
+
var _a, _b;
|
|
453
|
+
const zoom = Math.floor(((_a = this.map) === null || _a === void 0 ? void 0 : _a.getView().getZoom()) || -1);
|
|
454
|
+
const extent = ((_b = this.map) === null || _b === void 0 ? void 0 : _b.getView().calculateExtent()) || [];
|
|
455
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
456
|
+
});
|
|
457
|
+
});
|
|
377
458
|
}
|
|
378
459
|
}
|
|
379
460
|
MapStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -464,10 +545,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
464
545
|
type: Injectable
|
|
465
546
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
466
547
|
|
|
548
|
+
class DrawingService {
|
|
549
|
+
constructor(postboy) {
|
|
550
|
+
this.postboy = postboy;
|
|
551
|
+
}
|
|
552
|
+
up() {
|
|
553
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
554
|
+
this.draw((l) => {
|
|
555
|
+
if (!l || !this.map) {
|
|
556
|
+
this.clearInteraction(l);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
const drawQuery = new GenerateDrawQuery(l, ev.style, ev.type);
|
|
560
|
+
drawQuery.result.subscribe((draw) => {
|
|
561
|
+
var _a;
|
|
562
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
563
|
+
this.drawInteraction = draw;
|
|
564
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addInteraction(this.drawInteraction);
|
|
565
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
566
|
+
cancelSub.unsubscribe();
|
|
567
|
+
this.onEnd(evt, ev, l);
|
|
568
|
+
});
|
|
569
|
+
});
|
|
570
|
+
this.postboy.fire(drawQuery);
|
|
571
|
+
});
|
|
572
|
+
});
|
|
573
|
+
this.observeMapRender();
|
|
574
|
+
}
|
|
575
|
+
onEnd(evt, command, layer) {
|
|
576
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
577
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
578
|
+
: new WKT().writeFeature(evt.feature));
|
|
579
|
+
this.clearInteraction(layer);
|
|
580
|
+
}
|
|
581
|
+
observeMapRender() {
|
|
582
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
583
|
+
this.map = m.map;
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
draw(action) {
|
|
587
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
588
|
+
query.result.subscribe((l) => action(l));
|
|
589
|
+
this.postboy.fire(query);
|
|
590
|
+
}
|
|
591
|
+
observeCancelation(ev, layer) {
|
|
592
|
+
return this.postboy
|
|
593
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
594
|
+
.pipe(first())
|
|
595
|
+
.subscribe(() => {
|
|
596
|
+
ev.finish(null);
|
|
597
|
+
this.clearInteraction(layer);
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
clearInteraction(layer) {
|
|
601
|
+
var _a;
|
|
602
|
+
if (!!this.drawInteraction) {
|
|
603
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.removeInteraction(this.drawInteraction);
|
|
604
|
+
layer === null || layer === void 0 ? void 0 : layer.setSource(new Vector({}));
|
|
605
|
+
}
|
|
606
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
DrawingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
610
|
+
DrawingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingService });
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingService, decorators: [{
|
|
612
|
+
type: Injectable
|
|
613
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
614
|
+
|
|
615
|
+
class DrawingGenerationService {
|
|
616
|
+
constructor(postboy) {
|
|
617
|
+
this.postboy = postboy;
|
|
618
|
+
}
|
|
619
|
+
up() {
|
|
620
|
+
this.postboy.subscribe(GenerateDrawQuery.ID).subscribe((ev) => {
|
|
621
|
+
ev.finish(new Draw({
|
|
622
|
+
source: ev.layer.getSource(),
|
|
623
|
+
type: DrawingType[ev.type],
|
|
624
|
+
style: ev.style,
|
|
625
|
+
geometryFunction: ev.type !== DrawingType.Circle ? undefined : createRegularPolygon(32),
|
|
626
|
+
}));
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
DrawingGenerationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
631
|
+
DrawingGenerationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingGenerationService });
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: DrawingGenerationService, decorators: [{
|
|
633
|
+
type: Injectable
|
|
634
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
635
|
+
|
|
467
636
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
468
|
-
constructor(service, management, state, feature, interaction) {
|
|
637
|
+
constructor(service, management, state, feature, interaction, drawing, drawGenerator) {
|
|
469
638
|
super(service);
|
|
470
|
-
this.registerServices([management, state, interaction, feature]);
|
|
639
|
+
this.registerServices([management, state, interaction, feature, drawing, drawGenerator]);
|
|
471
640
|
}
|
|
472
641
|
_up() {
|
|
473
642
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -479,147 +648,19 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
479
648
|
this.registerSubject(MapClickEvent.ID);
|
|
480
649
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
481
650
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
651
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
652
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
653
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
654
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
655
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
656
|
+
this.registerSubject(GenerateDrawQuery.ID);
|
|
482
657
|
}
|
|
483
658
|
}
|
|
484
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
659
|
+
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: DrawingGenerationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
485
660
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService });
|
|
486
661
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
487
662
|
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: "12.2.17", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
505
|
-
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", 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: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
554
|
-
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", 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: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
556
|
-
type: Component,
|
|
557
|
-
args: [{
|
|
558
|
-
selector: 'lib-osm-tile-layer',
|
|
559
|
-
template: '',
|
|
560
|
-
styleUrls: [],
|
|
561
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
562
|
-
}]
|
|
563
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
564
|
-
type: Input
|
|
565
|
-
}], map: [{
|
|
566
|
-
type: Input
|
|
567
|
-
}] } });
|
|
568
|
-
|
|
569
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
570
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
571
|
-
super();
|
|
572
|
-
this.elementRef = elementRef;
|
|
573
|
-
this.postboy = postboy;
|
|
574
|
-
this.mapFactory = mapFactory;
|
|
575
|
-
this.registrator = registrator;
|
|
576
|
-
this.detector = detector;
|
|
577
|
-
this.osmUrl = '';
|
|
578
|
-
this._settings = new MapSettings();
|
|
579
|
-
this.onDestroy = () => {
|
|
580
|
-
this.registrator.down();
|
|
581
|
-
};
|
|
582
|
-
registrator.up();
|
|
583
|
-
}
|
|
584
|
-
set settings(value) {
|
|
585
|
-
if (!value || this._settings.isSame(value))
|
|
586
|
-
return;
|
|
587
|
-
this._settings = value;
|
|
588
|
-
this.setOsm();
|
|
589
|
-
}
|
|
590
|
-
ngOnInit() {
|
|
591
|
-
useGeographic();
|
|
592
|
-
this.map = this.mapFactory.build(this._settings);
|
|
593
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
594
|
-
this.detector.detectChanges();
|
|
595
|
-
this.map.once('postrender', () => {
|
|
596
|
-
this.map.updateSize();
|
|
597
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
598
|
-
});
|
|
599
|
-
this.setOsm();
|
|
600
|
-
}
|
|
601
|
-
setOsm() {
|
|
602
|
-
if (!this.map)
|
|
603
|
-
return;
|
|
604
|
-
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}`;
|
|
605
|
-
this.detector.detectChanges();
|
|
606
|
-
this.map.updateSize();
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
610
|
-
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", 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"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], directives: [{ type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
611
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
612
|
-
type: Component,
|
|
613
|
-
args: [{
|
|
614
|
-
selector: 'lib-map-plate',
|
|
615
|
-
templateUrl: './map-plate.component.html',
|
|
616
|
-
styleUrls: ['./map-plate.component.scss'],
|
|
617
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
618
|
-
providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService],
|
|
619
|
-
}]
|
|
620
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
621
|
-
type: Input
|
|
622
|
-
}] } });
|
|
663
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }]; } });
|
|
623
664
|
|
|
624
665
|
class TileLayerSettings {
|
|
625
666
|
constructor() {
|
|
@@ -757,30 +798,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
757
798
|
type: Input
|
|
758
799
|
}] } });
|
|
759
800
|
|
|
760
|
-
class
|
|
801
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
761
802
|
constructor() {
|
|
762
|
-
|
|
763
|
-
this.
|
|
764
|
-
this.maxZoom = 19;
|
|
765
|
-
this.minZoom = 0;
|
|
766
|
-
}
|
|
767
|
-
static copy(model) {
|
|
768
|
-
const result = new FeatureLayerSettings();
|
|
769
|
-
result.name = model.name;
|
|
770
|
-
result.maxZoom = model.maxZoom;
|
|
771
|
-
result.minZoom = model.minZoom;
|
|
772
|
-
result.zIndex = model.zIndex;
|
|
773
|
-
result.style = model.style;
|
|
774
|
-
return result;
|
|
803
|
+
super();
|
|
804
|
+
this._url = '';
|
|
775
805
|
}
|
|
776
|
-
|
|
777
|
-
|
|
806
|
+
set url(value) {
|
|
807
|
+
if (!value || this._url === value)
|
|
808
|
+
return;
|
|
809
|
+
this._url = value;
|
|
810
|
+
this.initLayer();
|
|
778
811
|
}
|
|
779
|
-
|
|
780
|
-
|
|
812
|
+
set map(value) {
|
|
813
|
+
if (!value || this._map === value)
|
|
814
|
+
return;
|
|
815
|
+
this._map = value;
|
|
816
|
+
this.initLayer();
|
|
781
817
|
}
|
|
782
|
-
|
|
783
|
-
|
|
818
|
+
ngOnInit() { }
|
|
819
|
+
ngOnDestroy() {
|
|
820
|
+
var _a, _b;
|
|
821
|
+
if (this.layer) {
|
|
822
|
+
(_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
|
|
823
|
+
}
|
|
824
|
+
// @ts-ignore
|
|
825
|
+
(_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
|
|
826
|
+
}
|
|
827
|
+
initLayer() {
|
|
828
|
+
if (!this._url || !this._map)
|
|
829
|
+
return;
|
|
830
|
+
if (this.layer)
|
|
831
|
+
this._map.removeLayer(this.layer);
|
|
832
|
+
this.layer = new TileLayer({
|
|
833
|
+
source: new OSM({
|
|
834
|
+
url: this._url,
|
|
835
|
+
}),
|
|
836
|
+
});
|
|
837
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
838
|
+
this._map.addLayer(this.layer);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
842
|
+
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
843
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
844
|
+
type: Component,
|
|
845
|
+
args: [{
|
|
846
|
+
selector: 'lib-osm-tile-layer',
|
|
847
|
+
template: '',
|
|
848
|
+
styleUrls: [],
|
|
849
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
850
|
+
}]
|
|
851
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
852
|
+
type: Input
|
|
853
|
+
}], map: [{
|
|
854
|
+
type: Input
|
|
855
|
+
}] } });
|
|
856
|
+
|
|
857
|
+
class FeatureLayerSettings {
|
|
858
|
+
constructor() {
|
|
859
|
+
this.name = IdGenerator.get();
|
|
860
|
+
this.zIndex = 1;
|
|
861
|
+
this.maxZoom = 19;
|
|
862
|
+
this.minZoom = 0;
|
|
863
|
+
}
|
|
864
|
+
static copy(model) {
|
|
865
|
+
const result = new FeatureLayerSettings();
|
|
866
|
+
result.name = model.name;
|
|
867
|
+
result.maxZoom = model.maxZoom;
|
|
868
|
+
result.minZoom = model.minZoom;
|
|
869
|
+
result.zIndex = model.zIndex;
|
|
870
|
+
result.style = model.style;
|
|
871
|
+
return result;
|
|
872
|
+
}
|
|
873
|
+
setZIndex(zIndex) {
|
|
874
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
875
|
+
}
|
|
876
|
+
setName(name) {
|
|
877
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
878
|
+
}
|
|
879
|
+
setMaxZoom(maxZoom) {
|
|
880
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
784
881
|
}
|
|
785
882
|
setMinZoom(minZoom) {
|
|
786
883
|
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
@@ -872,6 +969,297 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
872
969
|
type: Input
|
|
873
970
|
}] } });
|
|
874
971
|
|
|
972
|
+
class ClusterLayerSettings {
|
|
973
|
+
constructor() {
|
|
974
|
+
this.name = IdGenerator.get();
|
|
975
|
+
this.zIndex = 1;
|
|
976
|
+
this.maxZoom = 19;
|
|
977
|
+
this.minZoom = 0;
|
|
978
|
+
this.distance = 20;
|
|
979
|
+
this.bbox = false;
|
|
980
|
+
this.clusterCancel = 14;
|
|
981
|
+
}
|
|
982
|
+
static copy(model) {
|
|
983
|
+
const result = new ClusterLayerSettings();
|
|
984
|
+
result.name = model.name;
|
|
985
|
+
result.maxZoom = model.maxZoom;
|
|
986
|
+
result.minZoom = model.minZoom;
|
|
987
|
+
result.zIndex = model.zIndex;
|
|
988
|
+
result.bbox = model.bbox;
|
|
989
|
+
result.clusterCancel = model.clusterCancel;
|
|
990
|
+
result.distance = model.distance;
|
|
991
|
+
result.style = model.style;
|
|
992
|
+
return result;
|
|
993
|
+
}
|
|
994
|
+
setZIndex(zIndex) {
|
|
995
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
996
|
+
}
|
|
997
|
+
setDistance(distance) {
|
|
998
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance }));
|
|
999
|
+
}
|
|
1000
|
+
setName(name) {
|
|
1001
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
1002
|
+
}
|
|
1003
|
+
setMaxZoom(maxZoom) {
|
|
1004
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
1005
|
+
}
|
|
1006
|
+
setMinZoom(minZoom) {
|
|
1007
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
1008
|
+
}
|
|
1009
|
+
setClusterCancel(clusterCancel) {
|
|
1010
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { clusterCancel }));
|
|
1011
|
+
}
|
|
1012
|
+
setBbox(bbox) {
|
|
1013
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox }));
|
|
1014
|
+
}
|
|
1015
|
+
setStyle(style) {
|
|
1016
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
1017
|
+
}
|
|
1018
|
+
isSame(model) {
|
|
1019
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1020
|
+
return false;
|
|
1021
|
+
if (this.minZoom !== model.minZoom)
|
|
1022
|
+
return false;
|
|
1023
|
+
if (this.zIndex !== model.zIndex)
|
|
1024
|
+
return false;
|
|
1025
|
+
if (this.name !== model.name)
|
|
1026
|
+
return false;
|
|
1027
|
+
if (this.distance !== model.distance)
|
|
1028
|
+
return false;
|
|
1029
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1030
|
+
return false;
|
|
1031
|
+
if (this.bbox !== model.bbox)
|
|
1032
|
+
return false;
|
|
1033
|
+
if (this.style !== model.style)
|
|
1034
|
+
return false;
|
|
1035
|
+
return true;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
class ClusterLayerManager {
|
|
1040
|
+
constructor(settings, layer, postboy) {
|
|
1041
|
+
this.settings = settings;
|
|
1042
|
+
this.layer = layer;
|
|
1043
|
+
this.postboy = postboy;
|
|
1044
|
+
this.observeClick();
|
|
1045
|
+
this.observeMapMovement();
|
|
1046
|
+
}
|
|
1047
|
+
observeMapMovement() {
|
|
1048
|
+
combineLatest([
|
|
1049
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1050
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1051
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1052
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
observeClick() {
|
|
1056
|
+
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1057
|
+
var _a, _b;
|
|
1058
|
+
if (((_b = (_a = m.features[this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
|
|
1059
|
+
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
checkClusterNecessity(map) {
|
|
1064
|
+
var _a, _b, _c;
|
|
1065
|
+
let zoom = (_a = map.getView().getZoom()) !== null && _a !== void 0 ? _a : 0;
|
|
1066
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1067
|
+
(_c = (_b = this.layer) === null || _b === void 0 ? void 0 : _b.getSource()) === null || _c === void 0 ? void 0 : _c.setDistance(distance);
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
class ClusterLayerFactory {
|
|
1072
|
+
build(settings, postboy) {
|
|
1073
|
+
const source = new Vector({
|
|
1074
|
+
strategy: settings.bbox ? bbox : undefined,
|
|
1075
|
+
});
|
|
1076
|
+
const cluster = new Cluster({
|
|
1077
|
+
distance: settings.distance,
|
|
1078
|
+
source: source,
|
|
1079
|
+
geometryFunction: (feature) => {
|
|
1080
|
+
var _a, _b;
|
|
1081
|
+
const geom = feature.getGeometry();
|
|
1082
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
|
|
1083
|
+
return geom;
|
|
1084
|
+
}
|
|
1085
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
|
|
1086
|
+
return (_a = geom) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
|
|
1087
|
+
}
|
|
1088
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
|
|
1089
|
+
return (_b = fromExtent(geom.getExtent())) === null || _b === void 0 ? void 0 : _b.getInteriorPoint();
|
|
1090
|
+
}
|
|
1091
|
+
return undefined;
|
|
1092
|
+
},
|
|
1093
|
+
});
|
|
1094
|
+
const layer = new Vector$1({
|
|
1095
|
+
source: cluster,
|
|
1096
|
+
maxZoom: settings.maxZoom || undefined,
|
|
1097
|
+
minZoom: settings.minZoom || undefined,
|
|
1098
|
+
zIndex: settings.zIndex || 0,
|
|
1099
|
+
});
|
|
1100
|
+
layer.setStyle(this.styleFunc(settings));
|
|
1101
|
+
layer.set('name', settings.name);
|
|
1102
|
+
return new ClusterLayerManager(settings, layer, postboy);
|
|
1103
|
+
}
|
|
1104
|
+
styleFunc(settings) {
|
|
1105
|
+
return (feature) => {
|
|
1106
|
+
const features = feature.get('features');
|
|
1107
|
+
if (!settings.style)
|
|
1108
|
+
return undefined;
|
|
1109
|
+
return settings.style(features.map((f) => (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo)))));
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
ClusterLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1114
|
+
ClusterLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1116
|
+
type: Injectable,
|
|
1117
|
+
args: [{
|
|
1118
|
+
providedIn: 'root',
|
|
1119
|
+
}]
|
|
1120
|
+
}] });
|
|
1121
|
+
|
|
1122
|
+
class ClusterLayerComponent extends DestructibleComponent {
|
|
1123
|
+
constructor(postboy, factory) {
|
|
1124
|
+
super();
|
|
1125
|
+
this.postboy = postboy;
|
|
1126
|
+
this.factory = factory;
|
|
1127
|
+
this.manager = null;
|
|
1128
|
+
this._settings = new ClusterLayerSettings();
|
|
1129
|
+
this.onDestroy = () => this.removeLayer();
|
|
1130
|
+
}
|
|
1131
|
+
ngOnInit() {
|
|
1132
|
+
this.postboy
|
|
1133
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1134
|
+
.pipe(filter((m) => !!m), first())
|
|
1135
|
+
.subscribe((m) => this.initLayer());
|
|
1136
|
+
}
|
|
1137
|
+
set settings(value) {
|
|
1138
|
+
if (!value || this._settings.isSame(value))
|
|
1139
|
+
return;
|
|
1140
|
+
this._settings = value;
|
|
1141
|
+
this.initLayer();
|
|
1142
|
+
}
|
|
1143
|
+
initLayer() {
|
|
1144
|
+
this.removeLayer();
|
|
1145
|
+
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1146
|
+
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1147
|
+
}
|
|
1148
|
+
removeLayer() {
|
|
1149
|
+
var _a;
|
|
1150
|
+
if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
|
|
1151
|
+
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
ClusterLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1155
|
+
ClusterLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1157
|
+
type: Component,
|
|
1158
|
+
args: [{
|
|
1159
|
+
selector: 'lib-cluster-layer',
|
|
1160
|
+
template: '',
|
|
1161
|
+
styleUrls: [],
|
|
1162
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1163
|
+
}]
|
|
1164
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1165
|
+
type: Input
|
|
1166
|
+
}] } });
|
|
1167
|
+
|
|
1168
|
+
class MapPlateFactory {
|
|
1169
|
+
build(settings) {
|
|
1170
|
+
return new Map({
|
|
1171
|
+
controls: [],
|
|
1172
|
+
view: new View({
|
|
1173
|
+
center: (settings === null || settings === void 0 ? void 0 : settings.center) || [0, 0],
|
|
1174
|
+
zoom: (settings === null || settings === void 0 ? void 0 : settings.zoom) || 4,
|
|
1175
|
+
minZoom: (settings === null || settings === void 0 ? void 0 : settings.minZoom) || 0,
|
|
1176
|
+
maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
|
|
1177
|
+
}),
|
|
1178
|
+
layers: [],
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1183
|
+
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1184
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1185
|
+
type: Injectable,
|
|
1186
|
+
args: [{
|
|
1187
|
+
providedIn: 'root',
|
|
1188
|
+
}]
|
|
1189
|
+
}] });
|
|
1190
|
+
|
|
1191
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1192
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1193
|
+
super();
|
|
1194
|
+
this.elementRef = elementRef;
|
|
1195
|
+
this.postboy = postboy;
|
|
1196
|
+
this.mapFactory = mapFactory;
|
|
1197
|
+
this.registrator = registrator;
|
|
1198
|
+
this.detector = detector;
|
|
1199
|
+
this.osmUrl = '';
|
|
1200
|
+
this._settings = new MapSettings();
|
|
1201
|
+
this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1202
|
+
this.onDestroy = () => {
|
|
1203
|
+
this.registrator.down();
|
|
1204
|
+
};
|
|
1205
|
+
registrator.up();
|
|
1206
|
+
}
|
|
1207
|
+
set settings(value) {
|
|
1208
|
+
if (!value || this._settings.isSame(value))
|
|
1209
|
+
return;
|
|
1210
|
+
this._settings = value;
|
|
1211
|
+
this.setOsm();
|
|
1212
|
+
}
|
|
1213
|
+
ngOnInit() {
|
|
1214
|
+
useGeographic();
|
|
1215
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1216
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1217
|
+
this.detector.detectChanges();
|
|
1218
|
+
this.map.once('postrender', () => {
|
|
1219
|
+
this.map.updateSize();
|
|
1220
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1221
|
+
});
|
|
1222
|
+
this.setOsm();
|
|
1223
|
+
}
|
|
1224
|
+
setOsm() {
|
|
1225
|
+
if (!this.map)
|
|
1226
|
+
return;
|
|
1227
|
+
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}`;
|
|
1228
|
+
this.detector.detectChanges();
|
|
1229
|
+
this.map.updateSize();
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1233
|
+
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1234
|
+
MessageRegistratorService,
|
|
1235
|
+
MapStateService,
|
|
1236
|
+
MapManagementService,
|
|
1237
|
+
MapClickService,
|
|
1238
|
+
MapFeatureService,
|
|
1239
|
+
DrawingService,
|
|
1240
|
+
DrawingGenerationService,
|
|
1241
|
+
], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\r\n<lib-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></lib-feature-layer>\r\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], components: [{ type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }, { type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: ["settings"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1243
|
+
type: Component,
|
|
1244
|
+
args: [{
|
|
1245
|
+
selector: 'lib-map-plate',
|
|
1246
|
+
templateUrl: './map-plate.component.html',
|
|
1247
|
+
styleUrls: ['./map-plate.component.scss'],
|
|
1248
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1249
|
+
providers: [
|
|
1250
|
+
MessageRegistratorService,
|
|
1251
|
+
MapStateService,
|
|
1252
|
+
MapManagementService,
|
|
1253
|
+
MapClickService,
|
|
1254
|
+
MapFeatureService,
|
|
1255
|
+
DrawingService,
|
|
1256
|
+
DrawingGenerationService,
|
|
1257
|
+
],
|
|
1258
|
+
}]
|
|
1259
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1260
|
+
type: Input
|
|
1261
|
+
}] } });
|
|
1262
|
+
|
|
875
1263
|
class MarkersComponent extends DestructibleComponent {
|
|
876
1264
|
constructor(postboy) {
|
|
877
1265
|
super();
|
|
@@ -1034,8 +1422,7 @@ class PolygonsComponent extends DestructibleComponent {
|
|
|
1034
1422
|
.subscribe(() => this.putPolygons());
|
|
1035
1423
|
}
|
|
1036
1424
|
putPolygons() {
|
|
1037
|
-
|
|
1038
|
-
if (!((_a = this._polygons) === null || _a === void 0 ? void 0 : _a.length))
|
|
1425
|
+
if (!this._polygons)
|
|
1039
1426
|
return;
|
|
1040
1427
|
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1041
1428
|
}
|
|
@@ -1056,180 +1443,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImpo
|
|
|
1056
1443
|
type: Input
|
|
1057
1444
|
}] } });
|
|
1058
1445
|
|
|
1059
|
-
class ClusterLayerSettings {
|
|
1060
|
-
constructor() {
|
|
1061
|
-
this.name = IdGenerator.get();
|
|
1062
|
-
this.zIndex = 1;
|
|
1063
|
-
this.maxZoom = 19;
|
|
1064
|
-
this.minZoom = 0;
|
|
1065
|
-
this.distance = 20;
|
|
1066
|
-
this.bbox = false;
|
|
1067
|
-
}
|
|
1068
|
-
static copy(model) {
|
|
1069
|
-
const result = new ClusterLayerSettings();
|
|
1070
|
-
result.name = model.name;
|
|
1071
|
-
result.maxZoom = model.maxZoom;
|
|
1072
|
-
result.minZoom = model.minZoom;
|
|
1073
|
-
result.zIndex = model.zIndex;
|
|
1074
|
-
result.bbox = model.bbox;
|
|
1075
|
-
result.distance = model.distance;
|
|
1076
|
-
result.style = model.style;
|
|
1077
|
-
return result;
|
|
1078
|
-
}
|
|
1079
|
-
setZIndex(zIndex) {
|
|
1080
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
1081
|
-
}
|
|
1082
|
-
setDistance(distance) {
|
|
1083
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance }));
|
|
1084
|
-
}
|
|
1085
|
-
setName(name) {
|
|
1086
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
1087
|
-
}
|
|
1088
|
-
setMaxZoom(maxZoom) {
|
|
1089
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
1090
|
-
}
|
|
1091
|
-
setMinZoom(minZoom) {
|
|
1092
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
1093
|
-
}
|
|
1094
|
-
setBbox(bbox) {
|
|
1095
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox }));
|
|
1096
|
-
}
|
|
1097
|
-
setStyle(style) {
|
|
1098
|
-
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
1099
|
-
}
|
|
1100
|
-
isSame(model) {
|
|
1101
|
-
if (this.maxZoom !== model.maxZoom)
|
|
1102
|
-
return false;
|
|
1103
|
-
if (this.minZoom !== model.minZoom)
|
|
1104
|
-
return false;
|
|
1105
|
-
if (this.zIndex !== model.zIndex)
|
|
1106
|
-
return false;
|
|
1107
|
-
if (this.name !== model.name)
|
|
1108
|
-
return false;
|
|
1109
|
-
if (this.distance !== model.distance)
|
|
1110
|
-
return false;
|
|
1111
|
-
if (this.bbox !== model.bbox)
|
|
1112
|
-
return false;
|
|
1113
|
-
if (this.style !== model.style)
|
|
1114
|
-
return false;
|
|
1115
|
-
return true;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
class ClusterLayerManager {
|
|
1120
|
-
constructor(settings, layer, postboy) {
|
|
1121
|
-
this.settings = settings;
|
|
1122
|
-
this.layer = layer;
|
|
1123
|
-
this.postboy = postboy;
|
|
1124
|
-
this.observeClick();
|
|
1125
|
-
}
|
|
1126
|
-
observeClick() {
|
|
1127
|
-
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1128
|
-
var _a, _b;
|
|
1129
|
-
if (((_b = (_a = m.features[this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
|
|
1130
|
-
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1131
|
-
}
|
|
1132
|
-
});
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
class ClusterLayerFactory {
|
|
1137
|
-
build(settings, postboy) {
|
|
1138
|
-
const source = new Vector({
|
|
1139
|
-
strategy: settings.bbox ? bbox : undefined,
|
|
1140
|
-
});
|
|
1141
|
-
const cluster = new Cluster({
|
|
1142
|
-
distance: settings.distance,
|
|
1143
|
-
source: source,
|
|
1144
|
-
geometryFunction: (feature) => {
|
|
1145
|
-
var _a, _b;
|
|
1146
|
-
const geom = feature.getGeometry();
|
|
1147
|
-
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
|
|
1148
|
-
return geom;
|
|
1149
|
-
}
|
|
1150
|
-
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
|
|
1151
|
-
return (_a = geom) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
|
|
1152
|
-
}
|
|
1153
|
-
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
|
|
1154
|
-
return (_b = fromExtent(geom.getExtent())) === null || _b === void 0 ? void 0 : _b.getInteriorPoint();
|
|
1155
|
-
}
|
|
1156
|
-
return undefined;
|
|
1157
|
-
},
|
|
1158
|
-
});
|
|
1159
|
-
const layer = new Vector$1({
|
|
1160
|
-
source: cluster,
|
|
1161
|
-
maxZoom: settings.maxZoom || undefined,
|
|
1162
|
-
minZoom: settings.minZoom || undefined,
|
|
1163
|
-
zIndex: settings.zIndex || 0,
|
|
1164
|
-
});
|
|
1165
|
-
layer.setStyle(this.styleFunc(settings));
|
|
1166
|
-
layer.set('name', settings.name);
|
|
1167
|
-
return new ClusterLayerManager(settings, layer, postboy);
|
|
1168
|
-
}
|
|
1169
|
-
styleFunc(settings) {
|
|
1170
|
-
return (feature) => {
|
|
1171
|
-
const features = feature.get('features');
|
|
1172
|
-
if (!settings.style)
|
|
1173
|
-
return undefined;
|
|
1174
|
-
return settings.style(features.map((f) => (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo)))));
|
|
1175
|
-
};
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
|
-
ClusterLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1179
|
-
ClusterLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1180
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1181
|
-
type: Injectable,
|
|
1182
|
-
args: [{
|
|
1183
|
-
providedIn: 'root',
|
|
1184
|
-
}]
|
|
1185
|
-
}] });
|
|
1186
|
-
|
|
1187
|
-
class ClusterLayerComponent extends DestructibleComponent {
|
|
1188
|
-
constructor(postboy, factory) {
|
|
1189
|
-
super();
|
|
1190
|
-
this.postboy = postboy;
|
|
1191
|
-
this.factory = factory;
|
|
1192
|
-
this.manager = null;
|
|
1193
|
-
this._settings = new ClusterLayerSettings();
|
|
1194
|
-
this.onDestroy = () => this.removeLayer();
|
|
1195
|
-
}
|
|
1196
|
-
ngOnInit() {
|
|
1197
|
-
this.postboy
|
|
1198
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1199
|
-
.pipe(filter((m) => !!m), first())
|
|
1200
|
-
.subscribe((m) => this.initLayer());
|
|
1201
|
-
}
|
|
1202
|
-
set settings(value) {
|
|
1203
|
-
if (!value || this._settings.isSame(value))
|
|
1204
|
-
return;
|
|
1205
|
-
this._settings = value;
|
|
1206
|
-
this.initLayer();
|
|
1207
|
-
}
|
|
1208
|
-
initLayer() {
|
|
1209
|
-
this.removeLayer();
|
|
1210
|
-
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1211
|
-
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1212
|
-
}
|
|
1213
|
-
removeLayer() {
|
|
1214
|
-
var _a;
|
|
1215
|
-
if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
|
|
1216
|
-
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
ClusterLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1220
|
-
ClusterLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1221
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1222
|
-
type: Component,
|
|
1223
|
-
args: [{
|
|
1224
|
-
selector: 'lib-cluster-layer',
|
|
1225
|
-
template: '',
|
|
1226
|
-
styleUrls: [],
|
|
1227
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1228
|
-
}]
|
|
1229
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1230
|
-
type: Input
|
|
1231
|
-
}] } });
|
|
1232
|
-
|
|
1233
1446
|
class MapModule {
|
|
1234
1447
|
}
|
|
1235
1448
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1330,6 +1543,57 @@ class TextStyleHelper {
|
|
|
1330
1543
|
}
|
|
1331
1544
|
}
|
|
1332
1545
|
|
|
1546
|
+
class StringifyFeatureHelper {
|
|
1547
|
+
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1548
|
+
return format === FeatureOutputFormat.GeoJson
|
|
1549
|
+
? new GeoJSON().writeFeature(feature)
|
|
1550
|
+
: new WKT().writeFeature(feature);
|
|
1551
|
+
}
|
|
1552
|
+
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1553
|
+
// const clone = feature.clone();
|
|
1554
|
+
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
1555
|
+
const tetemp = feature.getGeometryName();
|
|
1556
|
+
const circle = feature.getGeometry();
|
|
1557
|
+
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
1558
|
+
const ttt = feature.getGeometry().getExtent();
|
|
1559
|
+
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
1560
|
+
const aaa = [
|
|
1561
|
+
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
1562
|
+
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
1563
|
+
];
|
|
1564
|
+
const radius = (aaa[2] - aaa[0]) / 2;
|
|
1565
|
+
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
1566
|
+
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
1567
|
+
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
1568
|
+
// var wgs84Sphere = new Sphere(6378137);
|
|
1569
|
+
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
1570
|
+
// const rad = circle.getRadius();
|
|
1571
|
+
// const degrees = 180 / Math.PI; // radians to degrees
|
|
1572
|
+
// const radians = Math.PI / 180; // degrees to radians
|
|
1573
|
+
// const rlat = rad * degrees * 1000;
|
|
1574
|
+
// const rlng = rad * radians;
|
|
1575
|
+
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
1576
|
+
}
|
|
1577
|
+
static drawCircle(point, radius) {
|
|
1578
|
+
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
1579
|
+
// const tetetemp = point;
|
|
1580
|
+
const radians = Math.PI / 180; // degrees to radians
|
|
1581
|
+
const degrees = 180 / Math.PI; // radians to degrees
|
|
1582
|
+
const earthsradius = 6378137.0;
|
|
1583
|
+
const rlat = (radius / earthsradius) * degrees;
|
|
1584
|
+
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
1585
|
+
const extp = [];
|
|
1586
|
+
for (let i = 0; i <= 32; i++) {
|
|
1587
|
+
const theta = Math.PI * (i / 16);
|
|
1588
|
+
extp.push([
|
|
1589
|
+
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
1590
|
+
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
1591
|
+
]);
|
|
1592
|
+
}
|
|
1593
|
+
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1333
1597
|
/*
|
|
1334
1598
|
* Public API Surface of maps
|
|
1335
1599
|
*/
|
|
@@ -1342,5 +1606,5 @@ class TextStyleHelper {
|
|
|
1342
1606
|
* Generated bundle index. Do not edit.
|
|
1343
1607
|
*/
|
|
1344
1608
|
|
|
1345
|
-
export {
|
|
1609
|
+
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 };
|
|
1346
1610
|
//# sourceMappingURL=maps-components.js.map
|