@artstesh/maps 4.0.7 → 4.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/esm2020/map/helpers/index.mjs +2 -1
- package/dist/esm2020/map/helpers/stringify-feature.helper.mjs +58 -0
- package/dist/esm2020/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2020/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2020/map/map-plate/map-plate.component.mjs +25 -3
- package/dist/esm2020/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2020/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2020/map/messages/commands/start-drawing.command.mjs +15 -0
- package/dist/esm2020/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2020/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2020/map/messages/events/map-move-end.event.mjs +13 -0
- package/dist/esm2020/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2020/map/messages/index.mjs +4 -2
- package/dist/esm2020/map/messages/queries/generate-draw.query.mjs +14 -0
- package/dist/esm2020/map/messages/queries/get-layer.query.mjs +12 -0
- package/dist/esm2020/map/models/drawing-type.enum.mjs +6 -0
- package/dist/esm2020/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2020/map/models/index.mjs +3 -1
- package/dist/esm2020/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/map/services/drawing/drawing-generation.service.mjs +28 -0
- package/dist/esm2020/map/services/drawing/drawing.service.mjs +79 -0
- package/dist/esm2020/map/services/map-management.service.mjs +6 -1
- package/dist/esm2020/map/services/map-postboy.service.mjs +8 -5
- package/dist/esm2020/map/services/map-state.service.mjs +10 -2
- package/dist/esm2020/map/services/message-registrator.service.mjs +19 -5
- package/dist/esm2020/src/map/helpers/index.mjs +2 -1
- package/dist/esm2020/src/map/helpers/stringify-feature.helper.mjs +58 -0
- package/dist/esm2020/src/map/helpers/text-style.helper.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/features/polygons/polygons.component.mjs +2 -2
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +19 -2
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +8 -1
- package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +1 -1
- package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +25 -3
- package/dist/esm2020/src/map/messages/commands/add-layer.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/add-tile.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/cancel-drawing.command.mjs +8 -0
- package/dist/esm2020/src/map/messages/commands/close-tooltip.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/fit-to-features.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/place-layer-features.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/remove-layer.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/remove-tile.command.mjs +3 -3
- package/dist/esm2020/src/map/messages/commands/start-drawing.command.mjs +15 -0
- package/dist/esm2020/src/map/messages/events/drawing-finished.event.mjs +11 -0
- package/dist/esm2020/src/map/messages/events/map-click.event.mjs +3 -3
- package/dist/esm2020/src/map/messages/events/map-move-end.event.mjs +13 -0
- package/dist/esm2020/src/map/messages/events/map-rendered.event.mjs +3 -3
- package/dist/esm2020/src/map/messages/index.mjs +4 -2
- package/dist/esm2020/src/map/messages/queries/generate-draw.query.mjs +14 -0
- package/dist/esm2020/src/map/messages/queries/get-layer.query.mjs +12 -0
- package/dist/esm2020/src/map/models/drawing-type.enum.mjs +6 -0
- package/dist/esm2020/src/map/models/feature-format.enum.mjs +6 -0
- package/dist/esm2020/src/map/models/index.mjs +3 -1
- package/dist/esm2020/src/map/models/map.constants.mjs +2 -1
- package/dist/esm2020/src/map/services/drawing/drawing-generation.service.mjs +28 -0
- package/dist/esm2020/src/map/services/drawing/drawing.service.mjs +79 -0
- package/dist/esm2020/src/map/services/map-management.service.mjs +6 -1
- package/dist/esm2020/src/map/services/map-postboy.service.mjs +8 -5
- package/dist/esm2020/src/map/services/map-state.service.mjs +10 -2
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +19 -5
- package/dist/fesm2015/maps-components-src-map.mjs +623 -359
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +623 -359
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +617 -357
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +617 -357
- package/dist/fesm2020/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/esm2020/map/messages/generic-message.mjs +0 -15
- package/dist/esm2020/src/map/messages/generic-message.mjs +0 -15
- package/dist/map/messages/generic-message.d.ts +0 -9
- package/dist/src/map/messages/generic-message.d.ts +0 -9
|
@@ -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
|
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) {
|
|
@@ -171,21 +175,19 @@ class PolygonModel {
|
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
}
|
|
178
|
+
var DrawingType;
|
|
179
|
+
(function (DrawingType) {
|
|
180
|
+
DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
|
|
181
|
+
DrawingType[DrawingType["Circle"] = 2] = "Circle";
|
|
182
|
+
})(DrawingType || (DrawingType = {}));
|
|
183
|
+
|
|
184
|
+
var FeatureOutputFormat;
|
|
185
|
+
(function (FeatureOutputFormat) {
|
|
186
|
+
FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
|
|
187
|
+
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
188
|
+
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
187
189
|
|
|
188
|
-
class MapRenderedEvent extends
|
|
190
|
+
class MapRenderedEvent extends PostboyGenericMessage {
|
|
189
191
|
constructor(map) {
|
|
190
192
|
super();
|
|
191
193
|
this.map = map;
|
|
@@ -196,7 +198,7 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
196
198
|
}
|
|
197
199
|
MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
198
200
|
|
|
199
|
-
class MapClickEvent extends
|
|
201
|
+
class MapClickEvent extends PostboyGenericMessage {
|
|
200
202
|
constructor(coordinates, entities, features) {
|
|
201
203
|
super();
|
|
202
204
|
this.coordinates = coordinates;
|
|
@@ -209,7 +211,19 @@ class MapClickEvent extends GenericMessage {
|
|
|
209
211
|
}
|
|
210
212
|
MapClickEvent.ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
|
|
211
213
|
|
|
212
|
-
class
|
|
214
|
+
class MapMoveEndEvent extends PostboyGenericMessage {
|
|
215
|
+
constructor(zoom, extent) {
|
|
216
|
+
super();
|
|
217
|
+
this.zoom = zoom;
|
|
218
|
+
this.extent = extent;
|
|
219
|
+
}
|
|
220
|
+
get id() {
|
|
221
|
+
return MapMoveEndEvent.ID;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
MapMoveEndEvent.ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
|
|
225
|
+
|
|
226
|
+
class CloseTooltipCommand extends PostboyGenericMessage {
|
|
213
227
|
constructor(tooltipId) {
|
|
214
228
|
super();
|
|
215
229
|
this.tooltipId = tooltipId;
|
|
@@ -220,7 +234,27 @@ class CloseTooltipCommand extends GenericMessage {
|
|
|
220
234
|
}
|
|
221
235
|
CloseTooltipCommand.ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
|
|
222
236
|
|
|
223
|
-
class
|
|
237
|
+
class StartDrawingCommand extends PostboyCallbackMessage {
|
|
238
|
+
constructor(type, style, format = FeatureOutputFormat.GeoJson) {
|
|
239
|
+
super();
|
|
240
|
+
this.type = type;
|
|
241
|
+
this.style = style;
|
|
242
|
+
this.format = format;
|
|
243
|
+
}
|
|
244
|
+
get id() {
|
|
245
|
+
return StartDrawingCommand.ID;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
StartDrawingCommand.ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
|
|
249
|
+
|
|
250
|
+
class CancelDrawingCommand extends PostboyGenericMessage {
|
|
251
|
+
get id() {
|
|
252
|
+
return CancelDrawingCommand.ID;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
CancelDrawingCommand.ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
|
|
256
|
+
|
|
257
|
+
class AddLayerCommand extends PostboyGenericMessage {
|
|
224
258
|
constructor(layer) {
|
|
225
259
|
super();
|
|
226
260
|
this.layer = layer;
|
|
@@ -231,7 +265,7 @@ class AddLayerCommand extends GenericMessage {
|
|
|
231
265
|
}
|
|
232
266
|
AddLayerCommand.ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
233
267
|
|
|
234
|
-
class PlaceLayerFeaturesCommand extends
|
|
268
|
+
class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
|
|
235
269
|
constructor(layer, features) {
|
|
236
270
|
super();
|
|
237
271
|
this.layer = layer;
|
|
@@ -243,7 +277,7 @@ class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
|
243
277
|
}
|
|
244
278
|
PlaceLayerFeaturesCommand.ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
245
279
|
|
|
246
|
-
class RemoveLayerCommand extends
|
|
280
|
+
class RemoveLayerCommand extends PostboyGenericMessage {
|
|
247
281
|
constructor(layer) {
|
|
248
282
|
super();
|
|
249
283
|
this.layer = layer;
|
|
@@ -254,7 +288,7 @@ class RemoveLayerCommand extends GenericMessage {
|
|
|
254
288
|
}
|
|
255
289
|
RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
256
290
|
|
|
257
|
-
class AddTileCommand extends
|
|
291
|
+
class AddTileCommand extends PostboyGenericMessage {
|
|
258
292
|
constructor(layer) {
|
|
259
293
|
super();
|
|
260
294
|
this.layer = layer;
|
|
@@ -265,7 +299,7 @@ class AddTileCommand extends GenericMessage {
|
|
|
265
299
|
}
|
|
266
300
|
AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
267
301
|
|
|
268
|
-
class RemoveTileCommand extends
|
|
302
|
+
class RemoveTileCommand extends PostboyGenericMessage {
|
|
269
303
|
constructor(layer) {
|
|
270
304
|
super();
|
|
271
305
|
this.layer = layer;
|
|
@@ -276,7 +310,7 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
276
310
|
}
|
|
277
311
|
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
278
312
|
|
|
279
|
-
class FitToFeaturesCommand extends
|
|
313
|
+
class FitToFeaturesCommand extends PostboyGenericMessage {
|
|
280
314
|
constructor(features, zoomAfter = 0) {
|
|
281
315
|
super();
|
|
282
316
|
this.features = features;
|
|
@@ -288,17 +322,51 @@ class FitToFeaturesCommand extends GenericMessage {
|
|
|
288
322
|
}
|
|
289
323
|
FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
290
324
|
|
|
325
|
+
class GetLayerQuery extends PostboyCallbackMessage {
|
|
326
|
+
constructor(name) {
|
|
327
|
+
super();
|
|
328
|
+
this.name = name;
|
|
329
|
+
}
|
|
330
|
+
get id() {
|
|
331
|
+
return GetLayerQuery.ID;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
GetLayerQuery.ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
|
|
335
|
+
|
|
336
|
+
class DrawingFinishedEvent extends PostboyGenericMessage {
|
|
337
|
+
constructor() {
|
|
338
|
+
super();
|
|
339
|
+
}
|
|
340
|
+
get id() {
|
|
341
|
+
return DrawingFinishedEvent.ID;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
DrawingFinishedEvent.ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
|
|
345
|
+
|
|
346
|
+
class GenerateDrawQuery extends PostboyCallbackMessage {
|
|
347
|
+
constructor(layer, style, type) {
|
|
348
|
+
super();
|
|
349
|
+
this.layer = layer;
|
|
350
|
+
this.style = style;
|
|
351
|
+
this.type = type;
|
|
352
|
+
}
|
|
353
|
+
get id() {
|
|
354
|
+
return GenerateDrawQuery.ID;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
GenerateDrawQuery.ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
|
|
358
|
+
|
|
291
359
|
class MapPostboyService extends PostboyService {
|
|
292
360
|
constructor() {
|
|
293
|
-
super(
|
|
294
|
-
this.
|
|
361
|
+
super();
|
|
362
|
+
this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
|
|
295
363
|
}
|
|
296
364
|
}
|
|
297
|
-
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps:
|
|
365
|
+
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
298
366
|
MapPostboyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService });
|
|
299
367
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
300
368
|
type: Injectable
|
|
301
|
-
}] });
|
|
369
|
+
}], ctorParameters: function () { return []; } });
|
|
302
370
|
|
|
303
371
|
class MapManagementService {
|
|
304
372
|
constructor(postboy) {
|
|
@@ -312,6 +380,7 @@ class MapManagementService {
|
|
|
312
380
|
this.observePlaceFeatures();
|
|
313
381
|
this.observeAddTile();
|
|
314
382
|
this.observeRemoveTile();
|
|
383
|
+
this.observeLayerQuery();
|
|
315
384
|
}
|
|
316
385
|
observeRemoveTile() {
|
|
317
386
|
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
@@ -320,6 +389,9 @@ class MapManagementService {
|
|
|
320
389
|
this.map.removeLayer(c.layer);
|
|
321
390
|
});
|
|
322
391
|
}
|
|
392
|
+
observeLayerQuery() {
|
|
393
|
+
this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers[ev.name] ?? null));
|
|
394
|
+
}
|
|
323
395
|
observeAddTile() {
|
|
324
396
|
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
325
397
|
if (!this.map)
|
|
@@ -371,7 +443,14 @@ class MapStateService {
|
|
|
371
443
|
this.postboy = postboy;
|
|
372
444
|
}
|
|
373
445
|
up() {
|
|
374
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((
|
|
446
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((ev) => {
|
|
447
|
+
this.map = ev.map;
|
|
448
|
+
this.map?.on('moveend', () => {
|
|
449
|
+
const zoom = Math.floor(this.map?.getView().getZoom() || -1);
|
|
450
|
+
const extent = this.map?.getView().calculateExtent() || [];
|
|
451
|
+
this.postboy.fire(new MapMoveEndEvent(zoom, extent));
|
|
452
|
+
});
|
|
453
|
+
});
|
|
375
454
|
}
|
|
376
455
|
}
|
|
377
456
|
MapStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -460,10 +539,96 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
460
539
|
type: Injectable
|
|
461
540
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
462
541
|
|
|
542
|
+
class DrawingService {
|
|
543
|
+
constructor(postboy) {
|
|
544
|
+
this.postboy = postboy;
|
|
545
|
+
}
|
|
546
|
+
up() {
|
|
547
|
+
this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
|
|
548
|
+
this.draw((l) => {
|
|
549
|
+
if (!l || !this.map) {
|
|
550
|
+
this.clearInteraction(l);
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
const drawQuery = new GenerateDrawQuery(l, ev.style, ev.type);
|
|
554
|
+
drawQuery.result.subscribe((draw) => {
|
|
555
|
+
const cancelSub = this.observeCancelation(ev, l);
|
|
556
|
+
this.drawInteraction = draw;
|
|
557
|
+
this.map?.addInteraction(this.drawInteraction);
|
|
558
|
+
this.drawInteraction.on('drawend', (evt) => {
|
|
559
|
+
cancelSub.unsubscribe();
|
|
560
|
+
this.onEnd(evt, ev, l);
|
|
561
|
+
});
|
|
562
|
+
});
|
|
563
|
+
this.postboy.fire(drawQuery);
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
this.observeMapRender();
|
|
567
|
+
}
|
|
568
|
+
onEnd(evt, command, layer) {
|
|
569
|
+
command.finish(command.format === FeatureOutputFormat.GeoJson
|
|
570
|
+
? new GeoJSON().writeFeature(evt.feature)
|
|
571
|
+
: new WKT().writeFeature(evt.feature));
|
|
572
|
+
this.clearInteraction(layer);
|
|
573
|
+
}
|
|
574
|
+
observeMapRender() {
|
|
575
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
576
|
+
this.map = m.map;
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
draw(action) {
|
|
580
|
+
const query = new GetLayerQuery(MapConstants.DrawingLayerId);
|
|
581
|
+
query.result.subscribe((l) => action(l));
|
|
582
|
+
this.postboy.fire(query);
|
|
583
|
+
}
|
|
584
|
+
observeCancelation(ev, layer) {
|
|
585
|
+
return this.postboy
|
|
586
|
+
.subscribe(CancelDrawingCommand.ID)
|
|
587
|
+
.pipe(first())
|
|
588
|
+
.subscribe(() => {
|
|
589
|
+
ev.finish(null);
|
|
590
|
+
this.clearInteraction(layer);
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
clearInteraction(layer) {
|
|
594
|
+
if (!!this.drawInteraction) {
|
|
595
|
+
this.map?.removeInteraction(this.drawInteraction);
|
|
596
|
+
layer?.setSource(new Vector({}));
|
|
597
|
+
}
|
|
598
|
+
setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
DrawingService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
602
|
+
DrawingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService });
|
|
603
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService, decorators: [{
|
|
604
|
+
type: Injectable
|
|
605
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
606
|
+
|
|
607
|
+
class DrawingGenerationService {
|
|
608
|
+
constructor(postboy) {
|
|
609
|
+
this.postboy = postboy;
|
|
610
|
+
}
|
|
611
|
+
up() {
|
|
612
|
+
this.postboy.subscribe(GenerateDrawQuery.ID).subscribe((ev) => {
|
|
613
|
+
ev.finish(new Draw({
|
|
614
|
+
source: ev.layer.getSource(),
|
|
615
|
+
type: DrawingType[ev.type],
|
|
616
|
+
style: ev.style,
|
|
617
|
+
geometryFunction: ev.type !== DrawingType.Circle ? undefined : createRegularPolygon(32),
|
|
618
|
+
}));
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
DrawingGenerationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
623
|
+
DrawingGenerationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService });
|
|
624
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService, decorators: [{
|
|
625
|
+
type: Injectable
|
|
626
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
627
|
+
|
|
463
628
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
464
|
-
constructor(service, management, state, feature, interaction) {
|
|
629
|
+
constructor(service, management, state, feature, interaction, drawing, drawGenerator) {
|
|
465
630
|
super(service);
|
|
466
|
-
this.registerServices([management, state, interaction, feature]);
|
|
631
|
+
this.registerServices([management, state, interaction, feature, drawing, drawGenerator]);
|
|
467
632
|
}
|
|
468
633
|
_up() {
|
|
469
634
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -475,135 +640,19 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
475
640
|
this.registerSubject(MapClickEvent.ID);
|
|
476
641
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
477
642
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
643
|
+
this.registerSubject(MapMoveEndEvent.ID);
|
|
644
|
+
this.registerSubject(CancelDrawingCommand.ID);
|
|
645
|
+
this.registerSubject(StartDrawingCommand.ID);
|
|
646
|
+
this.registerSubject(GetLayerQuery.ID);
|
|
647
|
+
this.registerSubject(DrawingFinishedEvent.ID);
|
|
648
|
+
this.registerSubject(GenerateDrawQuery.ID);
|
|
478
649
|
}
|
|
479
650
|
}
|
|
480
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
651
|
+
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: DrawingGenerationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
481
652
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
|
|
482
653
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
483
654
|
type: Injectable
|
|
484
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
|
|
485
|
-
|
|
486
|
-
class MapPlateFactory {
|
|
487
|
-
build(settings) {
|
|
488
|
-
return new Map({
|
|
489
|
-
controls: [],
|
|
490
|
-
view: new View({
|
|
491
|
-
center: settings?.center || [0, 0],
|
|
492
|
-
zoom: settings?.zoom || 4,
|
|
493
|
-
minZoom: settings?.minZoom || 0,
|
|
494
|
-
maxZoom: settings?.maxZoom || 19,
|
|
495
|
-
}),
|
|
496
|
-
layers: [],
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
501
|
-
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
502
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
503
|
-
type: Injectable,
|
|
504
|
-
args: [{
|
|
505
|
-
providedIn: 'root',
|
|
506
|
-
}]
|
|
507
|
-
}] });
|
|
508
|
-
|
|
509
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
510
|
-
constructor() {
|
|
511
|
-
super();
|
|
512
|
-
this._url = '';
|
|
513
|
-
}
|
|
514
|
-
set url(value) {
|
|
515
|
-
if (!value || this._url === value)
|
|
516
|
-
return;
|
|
517
|
-
this._url = value;
|
|
518
|
-
this.initLayer();
|
|
519
|
-
}
|
|
520
|
-
set map(value) {
|
|
521
|
-
if (!value || this._map === value)
|
|
522
|
-
return;
|
|
523
|
-
this._map = value;
|
|
524
|
-
this.initLayer();
|
|
525
|
-
}
|
|
526
|
-
ngOnInit() { }
|
|
527
|
-
ngOnDestroy() {
|
|
528
|
-
if (this.layer) {
|
|
529
|
-
this._map?.removeLayer(this.layer);
|
|
530
|
-
}
|
|
531
|
-
// @ts-ignore
|
|
532
|
-
this.layer?.setMap(null);
|
|
533
|
-
}
|
|
534
|
-
initLayer() {
|
|
535
|
-
if (!this._url || !this._map)
|
|
536
|
-
return;
|
|
537
|
-
if (this.layer)
|
|
538
|
-
this._map.removeLayer(this.layer);
|
|
539
|
-
this.layer = new TileLayer({
|
|
540
|
-
source: new OSM({
|
|
541
|
-
url: this._url,
|
|
542
|
-
}),
|
|
543
|
-
});
|
|
544
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
545
|
-
this._map.addLayer(this.layer);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
-
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
550
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
551
|
-
type: Component,
|
|
552
|
-
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
553
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
554
|
-
type: Input
|
|
555
|
-
}], map: [{
|
|
556
|
-
type: Input
|
|
557
|
-
}] } });
|
|
558
|
-
|
|
559
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
560
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
561
|
-
super();
|
|
562
|
-
this.elementRef = elementRef;
|
|
563
|
-
this.postboy = postboy;
|
|
564
|
-
this.mapFactory = mapFactory;
|
|
565
|
-
this.registrator = registrator;
|
|
566
|
-
this.detector = detector;
|
|
567
|
-
this.osmUrl = '';
|
|
568
|
-
this._settings = new MapSettings();
|
|
569
|
-
this.onDestroy = () => {
|
|
570
|
-
this.registrator.down();
|
|
571
|
-
};
|
|
572
|
-
registrator.up();
|
|
573
|
-
}
|
|
574
|
-
set settings(value) {
|
|
575
|
-
if (!value || this._settings.isSame(value))
|
|
576
|
-
return;
|
|
577
|
-
this._settings = value;
|
|
578
|
-
this.setOsm();
|
|
579
|
-
}
|
|
580
|
-
ngOnInit() {
|
|
581
|
-
useGeographic();
|
|
582
|
-
this.map = this.mapFactory.build(this._settings);
|
|
583
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
584
|
-
this.detector.detectChanges();
|
|
585
|
-
this.map.once('postrender', () => {
|
|
586
|
-
this.map.updateSize();
|
|
587
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
588
|
-
});
|
|
589
|
-
this.setOsm();
|
|
590
|
-
}
|
|
591
|
-
setOsm() {
|
|
592
|
-
if (!this.map)
|
|
593
|
-
return;
|
|
594
|
-
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
595
|
-
this.detector.detectChanges();
|
|
596
|
-
this.map.updateSize();
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
600
|
-
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
601
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
602
|
-
type: Component,
|
|
603
|
-
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
|
|
604
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
605
|
-
type: Input
|
|
606
|
-
}] } });
|
|
655
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }]; } });
|
|
607
656
|
|
|
608
657
|
class TileLayerSettings {
|
|
609
658
|
constructor() {
|
|
@@ -736,39 +785,89 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
736
785
|
type: Input
|
|
737
786
|
}] } });
|
|
738
787
|
|
|
739
|
-
class
|
|
788
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
740
789
|
constructor() {
|
|
741
|
-
|
|
742
|
-
this.
|
|
743
|
-
this.maxZoom = 19;
|
|
744
|
-
this.minZoom = 0;
|
|
745
|
-
}
|
|
746
|
-
static copy(model) {
|
|
747
|
-
const result = new FeatureLayerSettings();
|
|
748
|
-
result.name = model.name;
|
|
749
|
-
result.maxZoom = model.maxZoom;
|
|
750
|
-
result.minZoom = model.minZoom;
|
|
751
|
-
result.zIndex = model.zIndex;
|
|
752
|
-
result.style = model.style;
|
|
753
|
-
return result;
|
|
754
|
-
}
|
|
755
|
-
setZIndex(zIndex) {
|
|
756
|
-
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
757
|
-
}
|
|
758
|
-
setName(name) {
|
|
759
|
-
return FeatureLayerSettings.copy({ ...this, name });
|
|
790
|
+
super();
|
|
791
|
+
this._url = '';
|
|
760
792
|
}
|
|
761
|
-
|
|
762
|
-
|
|
793
|
+
set url(value) {
|
|
794
|
+
if (!value || this._url === value)
|
|
795
|
+
return;
|
|
796
|
+
this._url = value;
|
|
797
|
+
this.initLayer();
|
|
763
798
|
}
|
|
764
|
-
|
|
765
|
-
|
|
799
|
+
set map(value) {
|
|
800
|
+
if (!value || this._map === value)
|
|
801
|
+
return;
|
|
802
|
+
this._map = value;
|
|
803
|
+
this.initLayer();
|
|
766
804
|
}
|
|
767
|
-
|
|
768
|
-
|
|
805
|
+
ngOnInit() { }
|
|
806
|
+
ngOnDestroy() {
|
|
807
|
+
if (this.layer) {
|
|
808
|
+
this._map?.removeLayer(this.layer);
|
|
809
|
+
}
|
|
810
|
+
// @ts-ignore
|
|
811
|
+
this.layer?.setMap(null);
|
|
769
812
|
}
|
|
770
|
-
|
|
771
|
-
if (this.
|
|
813
|
+
initLayer() {
|
|
814
|
+
if (!this._url || !this._map)
|
|
815
|
+
return;
|
|
816
|
+
if (this.layer)
|
|
817
|
+
this._map.removeLayer(this.layer);
|
|
818
|
+
this.layer = new TileLayer({
|
|
819
|
+
source: new OSM({
|
|
820
|
+
url: this._url,
|
|
821
|
+
}),
|
|
822
|
+
});
|
|
823
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
824
|
+
this._map.addLayer(this.layer);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
828
|
+
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
829
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
830
|
+
type: Component,
|
|
831
|
+
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
832
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
833
|
+
type: Input
|
|
834
|
+
}], map: [{
|
|
835
|
+
type: Input
|
|
836
|
+
}] } });
|
|
837
|
+
|
|
838
|
+
class FeatureLayerSettings {
|
|
839
|
+
constructor() {
|
|
840
|
+
this.name = IdGenerator.get();
|
|
841
|
+
this.zIndex = 1;
|
|
842
|
+
this.maxZoom = 19;
|
|
843
|
+
this.minZoom = 0;
|
|
844
|
+
}
|
|
845
|
+
static copy(model) {
|
|
846
|
+
const result = new FeatureLayerSettings();
|
|
847
|
+
result.name = model.name;
|
|
848
|
+
result.maxZoom = model.maxZoom;
|
|
849
|
+
result.minZoom = model.minZoom;
|
|
850
|
+
result.zIndex = model.zIndex;
|
|
851
|
+
result.style = model.style;
|
|
852
|
+
return result;
|
|
853
|
+
}
|
|
854
|
+
setZIndex(zIndex) {
|
|
855
|
+
return FeatureLayerSettings.copy({ ...this, zIndex });
|
|
856
|
+
}
|
|
857
|
+
setName(name) {
|
|
858
|
+
return FeatureLayerSettings.copy({ ...this, name });
|
|
859
|
+
}
|
|
860
|
+
setMaxZoom(maxZoom) {
|
|
861
|
+
return FeatureLayerSettings.copy({ ...this, maxZoom });
|
|
862
|
+
}
|
|
863
|
+
setMinZoom(minZoom) {
|
|
864
|
+
return FeatureLayerSettings.copy({ ...this, minZoom });
|
|
865
|
+
}
|
|
866
|
+
setStyle(style) {
|
|
867
|
+
return FeatureLayerSettings.copy({ ...this, style });
|
|
868
|
+
}
|
|
869
|
+
isSame(model) {
|
|
870
|
+
if (this.maxZoom !== model.maxZoom)
|
|
772
871
|
return false;
|
|
773
872
|
if (this.minZoom !== model.minZoom)
|
|
774
873
|
return false;
|
|
@@ -846,170 +945,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
846
945
|
type: Input
|
|
847
946
|
}] } });
|
|
848
947
|
|
|
849
|
-
class MarkersComponent extends DestructibleComponent {
|
|
850
|
-
constructor(postboy) {
|
|
851
|
-
super();
|
|
852
|
-
this.postboy = postboy;
|
|
853
|
-
this.layerName = '';
|
|
854
|
-
this._markers = [];
|
|
855
|
-
}
|
|
856
|
-
set markers(value) {
|
|
857
|
-
this._markers = value;
|
|
858
|
-
this.putMarkers();
|
|
859
|
-
}
|
|
860
|
-
ngOnInit() {
|
|
861
|
-
this.postboy
|
|
862
|
-
.subscribe(MapRenderedEvent.ID)
|
|
863
|
-
.pipe(filter((m) => !!m), first())
|
|
864
|
-
.subscribe(() => this.putMarkers());
|
|
865
|
-
}
|
|
866
|
-
putMarkers() {
|
|
867
|
-
if (!this._markers?.length)
|
|
868
|
-
return;
|
|
869
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
873
|
-
MarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
874
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
875
|
-
type: Component,
|
|
876
|
-
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
877
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
878
|
-
type: Input
|
|
879
|
-
}], markers: [{
|
|
880
|
-
type: Input
|
|
881
|
-
}] } });
|
|
882
|
-
|
|
883
|
-
class TooltipSettings {
|
|
884
|
-
constructor(id) {
|
|
885
|
-
this.containerClass = 'custom-tooltip-class';
|
|
886
|
-
this.show = (e) => true;
|
|
887
|
-
this.id = id ?? IdGenerator.get();
|
|
888
|
-
}
|
|
889
|
-
static copy(model) {
|
|
890
|
-
const result = new TooltipSettings(model.id);
|
|
891
|
-
result.show = model.show;
|
|
892
|
-
result.containerClass = model.containerClass;
|
|
893
|
-
return result;
|
|
894
|
-
}
|
|
895
|
-
setShow(show) {
|
|
896
|
-
return TooltipSettings.copy({ ...this, show });
|
|
897
|
-
}
|
|
898
|
-
setClass(containerClass) {
|
|
899
|
-
return TooltipSettings.copy({ ...this, containerClass });
|
|
900
|
-
}
|
|
901
|
-
isSame(model) {
|
|
902
|
-
if (this.show !== model.show)
|
|
903
|
-
return false;
|
|
904
|
-
if (this.containerClass !== model.containerClass)
|
|
905
|
-
return false;
|
|
906
|
-
if (this.id !== model.id)
|
|
907
|
-
return false;
|
|
908
|
-
return true;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
class TooltipComponent extends DestructibleComponent {
|
|
913
|
-
set settings(value) {
|
|
914
|
-
if (!value || this._settings.isSame(value))
|
|
915
|
-
return;
|
|
916
|
-
this._settings = value;
|
|
917
|
-
this.detector.detectChanges();
|
|
918
|
-
}
|
|
919
|
-
constructor(postboy, detector) {
|
|
920
|
-
super();
|
|
921
|
-
this.postboy = postboy;
|
|
922
|
-
this.detector = detector;
|
|
923
|
-
this._settings = new TooltipSettings();
|
|
924
|
-
this.show = false;
|
|
925
|
-
this.removeOverlay = () => {
|
|
926
|
-
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
927
|
-
this.show = false;
|
|
928
|
-
};
|
|
929
|
-
this.options = (coordinates) => {
|
|
930
|
-
return {
|
|
931
|
-
element: this.container?.nativeElement,
|
|
932
|
-
autoPan: false,
|
|
933
|
-
autoPanAnimation: { duration: 0 },
|
|
934
|
-
position: coordinates,
|
|
935
|
-
};
|
|
936
|
-
};
|
|
937
|
-
}
|
|
938
|
-
ngOnInit() {
|
|
939
|
-
this.subs.push(this.observeMapRender());
|
|
940
|
-
this.subs.push(this.observeMapClick());
|
|
941
|
-
this.subs.push(this.observeClose());
|
|
942
|
-
}
|
|
943
|
-
observeMapClick() {
|
|
944
|
-
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
945
|
-
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
observeClose() {
|
|
949
|
-
return this.postboy
|
|
950
|
-
.subscribe(CloseTooltipCommand.ID)
|
|
951
|
-
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
952
|
-
.subscribe(() => this.removeOverlay());
|
|
953
|
-
}
|
|
954
|
-
observeMapRender() {
|
|
955
|
-
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
956
|
-
this.map = m.map;
|
|
957
|
-
});
|
|
958
|
-
}
|
|
959
|
-
addOverlay(coordinates) {
|
|
960
|
-
this.removeOverlay();
|
|
961
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
962
|
-
this.map?.addOverlay(this.overlay);
|
|
963
|
-
this.show = true;
|
|
964
|
-
this.detector.detectChanges();
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
968
|
-
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
969
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
970
|
-
type: Component,
|
|
971
|
-
args: [{ selector: 'lib-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
972
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
973
|
-
type: ViewChild,
|
|
974
|
-
args: ['tip']
|
|
975
|
-
}], settings: [{
|
|
976
|
-
type: Input
|
|
977
|
-
}] } });
|
|
978
|
-
|
|
979
|
-
class PolygonsComponent extends DestructibleComponent {
|
|
980
|
-
constructor(postboy) {
|
|
981
|
-
super();
|
|
982
|
-
this.postboy = postboy;
|
|
983
|
-
this.layerName = '';
|
|
984
|
-
this._polygons = [];
|
|
985
|
-
}
|
|
986
|
-
set polygons(value) {
|
|
987
|
-
this._polygons = value;
|
|
988
|
-
this.putPolygons();
|
|
989
|
-
}
|
|
990
|
-
ngOnInit() {
|
|
991
|
-
this.postboy
|
|
992
|
-
.subscribe(MapRenderedEvent.ID)
|
|
993
|
-
.pipe(filter((m) => !!m), first())
|
|
994
|
-
.subscribe(() => this.putPolygons());
|
|
995
|
-
}
|
|
996
|
-
putPolygons() {
|
|
997
|
-
if (!this._polygons?.length)
|
|
998
|
-
return;
|
|
999
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1003
|
-
PolygonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1004
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1005
|
-
type: Component,
|
|
1006
|
-
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1007
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1008
|
-
type: Input
|
|
1009
|
-
}], polygons: [{
|
|
1010
|
-
type: Input
|
|
1011
|
-
}] } });
|
|
1012
|
-
|
|
1013
948
|
class ClusterLayerSettings {
|
|
1014
949
|
constructor() {
|
|
1015
950
|
this.name = IdGenerator.get();
|
|
@@ -1018,6 +953,7 @@ class ClusterLayerSettings {
|
|
|
1018
953
|
this.minZoom = 0;
|
|
1019
954
|
this.distance = 20;
|
|
1020
955
|
this.bbox = false;
|
|
956
|
+
this.clusterCancel = 14;
|
|
1021
957
|
}
|
|
1022
958
|
static copy(model) {
|
|
1023
959
|
const result = new ClusterLayerSettings();
|
|
@@ -1026,6 +962,7 @@ class ClusterLayerSettings {
|
|
|
1026
962
|
result.minZoom = model.minZoom;
|
|
1027
963
|
result.zIndex = model.zIndex;
|
|
1028
964
|
result.bbox = model.bbox;
|
|
965
|
+
result.clusterCancel = model.clusterCancel;
|
|
1029
966
|
result.distance = model.distance;
|
|
1030
967
|
result.style = model.style;
|
|
1031
968
|
return result;
|
|
@@ -1045,6 +982,9 @@ class ClusterLayerSettings {
|
|
|
1045
982
|
setMinZoom(minZoom) {
|
|
1046
983
|
return ClusterLayerSettings.copy({ ...this, minZoom });
|
|
1047
984
|
}
|
|
985
|
+
setClusterCancel(clusterCancel) {
|
|
986
|
+
return ClusterLayerSettings.copy({ ...this, clusterCancel });
|
|
987
|
+
}
|
|
1048
988
|
setBbox(bbox) {
|
|
1049
989
|
return ClusterLayerSettings.copy({ ...this, bbox });
|
|
1050
990
|
}
|
|
@@ -1062,6 +1002,8 @@ class ClusterLayerSettings {
|
|
|
1062
1002
|
return false;
|
|
1063
1003
|
if (this.distance !== model.distance)
|
|
1064
1004
|
return false;
|
|
1005
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1006
|
+
return false;
|
|
1065
1007
|
if (this.bbox !== model.bbox)
|
|
1066
1008
|
return false;
|
|
1067
1009
|
if (this.style !== model.style)
|
|
@@ -1076,6 +1018,15 @@ class ClusterLayerManager {
|
|
|
1076
1018
|
this.layer = layer;
|
|
1077
1019
|
this.postboy = postboy;
|
|
1078
1020
|
this.observeClick();
|
|
1021
|
+
this.observeMapMovement();
|
|
1022
|
+
}
|
|
1023
|
+
observeMapMovement() {
|
|
1024
|
+
combineLatest([
|
|
1025
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1026
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1027
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1028
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1029
|
+
});
|
|
1079
1030
|
}
|
|
1080
1031
|
observeClick() {
|
|
1081
1032
|
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
@@ -1084,6 +1035,11 @@ class ClusterLayerManager {
|
|
|
1084
1035
|
}
|
|
1085
1036
|
});
|
|
1086
1037
|
}
|
|
1038
|
+
checkClusterNecessity(map) {
|
|
1039
|
+
let zoom = map.getView().getZoom() ?? 0;
|
|
1040
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1041
|
+
this.layer?.getSource()?.setDistance(distance);
|
|
1042
|
+
}
|
|
1087
1043
|
}
|
|
1088
1044
|
|
|
1089
1045
|
class ClusterLayerFactory {
|
|
@@ -1176,6 +1132,259 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1176
1132
|
type: Input
|
|
1177
1133
|
}] } });
|
|
1178
1134
|
|
|
1135
|
+
class MapPlateFactory {
|
|
1136
|
+
build(settings) {
|
|
1137
|
+
return new Map({
|
|
1138
|
+
controls: [],
|
|
1139
|
+
view: new View({
|
|
1140
|
+
center: settings?.center || [0, 0],
|
|
1141
|
+
zoom: settings?.zoom || 4,
|
|
1142
|
+
minZoom: settings?.minZoom || 0,
|
|
1143
|
+
maxZoom: settings?.maxZoom || 19,
|
|
1144
|
+
}),
|
|
1145
|
+
layers: [],
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1150
|
+
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1151
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1152
|
+
type: Injectable,
|
|
1153
|
+
args: [{
|
|
1154
|
+
providedIn: 'root',
|
|
1155
|
+
}]
|
|
1156
|
+
}] });
|
|
1157
|
+
|
|
1158
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1159
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1160
|
+
super();
|
|
1161
|
+
this.elementRef = elementRef;
|
|
1162
|
+
this.postboy = postboy;
|
|
1163
|
+
this.mapFactory = mapFactory;
|
|
1164
|
+
this.registrator = registrator;
|
|
1165
|
+
this.detector = detector;
|
|
1166
|
+
this.osmUrl = '';
|
|
1167
|
+
this._settings = new MapSettings();
|
|
1168
|
+
this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1169
|
+
this.onDestroy = () => {
|
|
1170
|
+
this.registrator.down();
|
|
1171
|
+
};
|
|
1172
|
+
registrator.up();
|
|
1173
|
+
}
|
|
1174
|
+
set settings(value) {
|
|
1175
|
+
if (!value || this._settings.isSame(value))
|
|
1176
|
+
return;
|
|
1177
|
+
this._settings = value;
|
|
1178
|
+
this.setOsm();
|
|
1179
|
+
}
|
|
1180
|
+
ngOnInit() {
|
|
1181
|
+
useGeographic();
|
|
1182
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1183
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1184
|
+
this.detector.detectChanges();
|
|
1185
|
+
this.map.once('postrender', () => {
|
|
1186
|
+
this.map.updateSize();
|
|
1187
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1188
|
+
});
|
|
1189
|
+
this.setOsm();
|
|
1190
|
+
}
|
|
1191
|
+
setOsm() {
|
|
1192
|
+
if (!this.map)
|
|
1193
|
+
return;
|
|
1194
|
+
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}`;
|
|
1195
|
+
this.detector.detectChanges();
|
|
1196
|
+
this.map.updateSize();
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1200
|
+
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1201
|
+
MessageRegistratorService,
|
|
1202
|
+
MapStateService,
|
|
1203
|
+
MapManagementService,
|
|
1204
|
+
MapClickService,
|
|
1205
|
+
MapFeatureService,
|
|
1206
|
+
DrawingService,
|
|
1207
|
+
DrawingGenerationService,
|
|
1208
|
+
], 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 });
|
|
1209
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1210
|
+
type: Component,
|
|
1211
|
+
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1212
|
+
MessageRegistratorService,
|
|
1213
|
+
MapStateService,
|
|
1214
|
+
MapManagementService,
|
|
1215
|
+
MapClickService,
|
|
1216
|
+
MapFeatureService,
|
|
1217
|
+
DrawingService,
|
|
1218
|
+
DrawingGenerationService,
|
|
1219
|
+
], 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"] }]
|
|
1220
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1221
|
+
type: Input
|
|
1222
|
+
}] } });
|
|
1223
|
+
|
|
1224
|
+
class MarkersComponent extends DestructibleComponent {
|
|
1225
|
+
constructor(postboy) {
|
|
1226
|
+
super();
|
|
1227
|
+
this.postboy = postboy;
|
|
1228
|
+
this.layerName = '';
|
|
1229
|
+
this._markers = [];
|
|
1230
|
+
}
|
|
1231
|
+
set markers(value) {
|
|
1232
|
+
this._markers = value;
|
|
1233
|
+
this.putMarkers();
|
|
1234
|
+
}
|
|
1235
|
+
ngOnInit() {
|
|
1236
|
+
this.postboy
|
|
1237
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1238
|
+
.pipe(filter((m) => !!m), first())
|
|
1239
|
+
.subscribe(() => this.putMarkers());
|
|
1240
|
+
}
|
|
1241
|
+
putMarkers() {
|
|
1242
|
+
if (!this._markers?.length)
|
|
1243
|
+
return;
|
|
1244
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1248
|
+
MarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1249
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
1250
|
+
type: Component,
|
|
1251
|
+
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1252
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1253
|
+
type: Input
|
|
1254
|
+
}], markers: [{
|
|
1255
|
+
type: Input
|
|
1256
|
+
}] } });
|
|
1257
|
+
|
|
1258
|
+
class TooltipSettings {
|
|
1259
|
+
constructor(id) {
|
|
1260
|
+
this.containerClass = 'custom-tooltip-class';
|
|
1261
|
+
this.show = (e) => true;
|
|
1262
|
+
this.id = id ?? IdGenerator.get();
|
|
1263
|
+
}
|
|
1264
|
+
static copy(model) {
|
|
1265
|
+
const result = new TooltipSettings(model.id);
|
|
1266
|
+
result.show = model.show;
|
|
1267
|
+
result.containerClass = model.containerClass;
|
|
1268
|
+
return result;
|
|
1269
|
+
}
|
|
1270
|
+
setShow(show) {
|
|
1271
|
+
return TooltipSettings.copy({ ...this, show });
|
|
1272
|
+
}
|
|
1273
|
+
setClass(containerClass) {
|
|
1274
|
+
return TooltipSettings.copy({ ...this, containerClass });
|
|
1275
|
+
}
|
|
1276
|
+
isSame(model) {
|
|
1277
|
+
if (this.show !== model.show)
|
|
1278
|
+
return false;
|
|
1279
|
+
if (this.containerClass !== model.containerClass)
|
|
1280
|
+
return false;
|
|
1281
|
+
if (this.id !== model.id)
|
|
1282
|
+
return false;
|
|
1283
|
+
return true;
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
class TooltipComponent extends DestructibleComponent {
|
|
1288
|
+
set settings(value) {
|
|
1289
|
+
if (!value || this._settings.isSame(value))
|
|
1290
|
+
return;
|
|
1291
|
+
this._settings = value;
|
|
1292
|
+
this.detector.detectChanges();
|
|
1293
|
+
}
|
|
1294
|
+
constructor(postboy, detector) {
|
|
1295
|
+
super();
|
|
1296
|
+
this.postboy = postboy;
|
|
1297
|
+
this.detector = detector;
|
|
1298
|
+
this._settings = new TooltipSettings();
|
|
1299
|
+
this.show = false;
|
|
1300
|
+
this.removeOverlay = () => {
|
|
1301
|
+
!!this.overlay && this.map?.removeOverlay(this.overlay);
|
|
1302
|
+
this.show = false;
|
|
1303
|
+
};
|
|
1304
|
+
this.options = (coordinates) => {
|
|
1305
|
+
return {
|
|
1306
|
+
element: this.container?.nativeElement,
|
|
1307
|
+
autoPan: false,
|
|
1308
|
+
autoPanAnimation: { duration: 0 },
|
|
1309
|
+
position: coordinates,
|
|
1310
|
+
};
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
ngOnInit() {
|
|
1314
|
+
this.subs.push(this.observeMapRender());
|
|
1315
|
+
this.subs.push(this.observeMapClick());
|
|
1316
|
+
this.subs.push(this.observeClose());
|
|
1317
|
+
}
|
|
1318
|
+
observeMapClick() {
|
|
1319
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1320
|
+
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
observeClose() {
|
|
1324
|
+
return this.postboy
|
|
1325
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1326
|
+
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1327
|
+
.subscribe(() => this.removeOverlay());
|
|
1328
|
+
}
|
|
1329
|
+
observeMapRender() {
|
|
1330
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1331
|
+
this.map = m.map;
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
addOverlay(coordinates) {
|
|
1335
|
+
this.removeOverlay();
|
|
1336
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
1337
|
+
this.map?.addOverlay(this.overlay);
|
|
1338
|
+
this.show = true;
|
|
1339
|
+
this.detector.detectChanges();
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1343
|
+
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1345
|
+
type: Component,
|
|
1346
|
+
args: [{ selector: 'lib-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
1347
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1348
|
+
type: ViewChild,
|
|
1349
|
+
args: ['tip']
|
|
1350
|
+
}], settings: [{
|
|
1351
|
+
type: Input
|
|
1352
|
+
}] } });
|
|
1353
|
+
|
|
1354
|
+
class PolygonsComponent extends DestructibleComponent {
|
|
1355
|
+
constructor(postboy) {
|
|
1356
|
+
super();
|
|
1357
|
+
this.postboy = postboy;
|
|
1358
|
+
this.layerName = '';
|
|
1359
|
+
this._polygons = [];
|
|
1360
|
+
}
|
|
1361
|
+
set polygons(value) {
|
|
1362
|
+
this._polygons = value;
|
|
1363
|
+
this.putPolygons();
|
|
1364
|
+
}
|
|
1365
|
+
ngOnInit() {
|
|
1366
|
+
this.postboy
|
|
1367
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1368
|
+
.pipe(filter((m) => !!m), first())
|
|
1369
|
+
.subscribe(() => this.putPolygons());
|
|
1370
|
+
}
|
|
1371
|
+
putPolygons() {
|
|
1372
|
+
if (!this._polygons)
|
|
1373
|
+
return;
|
|
1374
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1378
|
+
PolygonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1379
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1380
|
+
type: Component,
|
|
1381
|
+
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1382
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1383
|
+
type: Input
|
|
1384
|
+
}], polygons: [{
|
|
1385
|
+
type: Input
|
|
1386
|
+
}] } });
|
|
1387
|
+
|
|
1179
1388
|
class MapModule {
|
|
1180
1389
|
}
|
|
1181
1390
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1276,6 +1485,57 @@ class TextStyleHelper {
|
|
|
1276
1485
|
}
|
|
1277
1486
|
}
|
|
1278
1487
|
|
|
1488
|
+
class StringifyFeatureHelper {
|
|
1489
|
+
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1490
|
+
return format === FeatureOutputFormat.GeoJson
|
|
1491
|
+
? new GeoJSON().writeFeature(feature)
|
|
1492
|
+
: new WKT().writeFeature(feature);
|
|
1493
|
+
}
|
|
1494
|
+
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1495
|
+
// const clone = feature.clone();
|
|
1496
|
+
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
1497
|
+
const tetemp = feature.getGeometryName();
|
|
1498
|
+
const circle = feature.getGeometry();
|
|
1499
|
+
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
1500
|
+
const ttt = feature.getGeometry().getExtent();
|
|
1501
|
+
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
1502
|
+
const aaa = [
|
|
1503
|
+
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
1504
|
+
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
1505
|
+
];
|
|
1506
|
+
const radius = (aaa[2] - aaa[0]) / 2;
|
|
1507
|
+
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
1508
|
+
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
1509
|
+
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
1510
|
+
// var wgs84Sphere = new Sphere(6378137);
|
|
1511
|
+
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
1512
|
+
// const rad = circle.getRadius();
|
|
1513
|
+
// const degrees = 180 / Math.PI; // radians to degrees
|
|
1514
|
+
// const radians = Math.PI / 180; // degrees to radians
|
|
1515
|
+
// const rlat = rad * degrees * 1000;
|
|
1516
|
+
// const rlng = rad * radians;
|
|
1517
|
+
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
1518
|
+
}
|
|
1519
|
+
static drawCircle(point, radius) {
|
|
1520
|
+
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
1521
|
+
// const tetetemp = point;
|
|
1522
|
+
const radians = Math.PI / 180; // degrees to radians
|
|
1523
|
+
const degrees = 180 / Math.PI; // radians to degrees
|
|
1524
|
+
const earthsradius = 6378137.0;
|
|
1525
|
+
const rlat = (radius / earthsradius) * degrees;
|
|
1526
|
+
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
1527
|
+
const extp = [];
|
|
1528
|
+
for (let i = 0; i <= 32; i++) {
|
|
1529
|
+
const theta = Math.PI * (i / 16);
|
|
1530
|
+
extp.push([
|
|
1531
|
+
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
1532
|
+
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
1533
|
+
]);
|
|
1534
|
+
}
|
|
1535
|
+
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1279
1539
|
/*
|
|
1280
1540
|
* Public API Surface of maps
|
|
1281
1541
|
*/
|
|
@@ -1284,5 +1544,5 @@ class TextStyleHelper {
|
|
|
1284
1544
|
* Generated bundle index. Do not edit.
|
|
1285
1545
|
*/
|
|
1286
1546
|
|
|
1287
|
-
export {
|
|
1547
|
+
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 };
|
|
1288
1548
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|