@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) {
|
|
@@ -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: "15.2.10", ngImport: i0, type: MapPostboyService, deps:
|
|
366
|
+
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
299
367
|
MapPostboyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService });
|
|
300
368
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "15.2.10", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -464,10 +545,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "15.2.10", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
610
|
+
DrawingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingService });
|
|
611
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "15.2.10", ngImport: i0, type: DrawingGenerationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
631
|
+
DrawingGenerationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DrawingGenerationService });
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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,136 +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: "15.2.10", 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: "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 });
|
|
485
660
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
|
|
486
661
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", 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: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
505
|
-
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
506
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
507
|
-
type: Injectable,
|
|
508
|
-
args: [{
|
|
509
|
-
providedIn: 'root',
|
|
510
|
-
}]
|
|
511
|
-
}] });
|
|
512
|
-
|
|
513
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
514
|
-
constructor() {
|
|
515
|
-
super();
|
|
516
|
-
this._url = '';
|
|
517
|
-
}
|
|
518
|
-
set url(value) {
|
|
519
|
-
if (!value || this._url === value)
|
|
520
|
-
return;
|
|
521
|
-
this._url = value;
|
|
522
|
-
this.initLayer();
|
|
523
|
-
}
|
|
524
|
-
set map(value) {
|
|
525
|
-
if (!value || this._map === value)
|
|
526
|
-
return;
|
|
527
|
-
this._map = value;
|
|
528
|
-
this.initLayer();
|
|
529
|
-
}
|
|
530
|
-
ngOnInit() { }
|
|
531
|
-
ngOnDestroy() {
|
|
532
|
-
var _a, _b;
|
|
533
|
-
if (this.layer) {
|
|
534
|
-
(_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
|
|
535
|
-
}
|
|
536
|
-
// @ts-ignore
|
|
537
|
-
(_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
|
|
538
|
-
}
|
|
539
|
-
initLayer() {
|
|
540
|
-
if (!this._url || !this._map)
|
|
541
|
-
return;
|
|
542
|
-
if (this.layer)
|
|
543
|
-
this._map.removeLayer(this.layer);
|
|
544
|
-
this.layer = new TileLayer({
|
|
545
|
-
source: new OSM({
|
|
546
|
-
url: this._url,
|
|
547
|
-
}),
|
|
548
|
-
});
|
|
549
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
550
|
-
this._map.addLayer(this.layer);
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
554
|
-
OsmTileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
555
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
556
|
-
type: Component,
|
|
557
|
-
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
558
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
559
|
-
type: Input
|
|
560
|
-
}], map: [{
|
|
561
|
-
type: Input
|
|
562
|
-
}] } });
|
|
563
|
-
|
|
564
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
565
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
566
|
-
super();
|
|
567
|
-
this.elementRef = elementRef;
|
|
568
|
-
this.postboy = postboy;
|
|
569
|
-
this.mapFactory = mapFactory;
|
|
570
|
-
this.registrator = registrator;
|
|
571
|
-
this.detector = detector;
|
|
572
|
-
this.osmUrl = '';
|
|
573
|
-
this._settings = new MapSettings();
|
|
574
|
-
this.onDestroy = () => {
|
|
575
|
-
this.registrator.down();
|
|
576
|
-
};
|
|
577
|
-
registrator.up();
|
|
578
|
-
}
|
|
579
|
-
set settings(value) {
|
|
580
|
-
if (!value || this._settings.isSame(value))
|
|
581
|
-
return;
|
|
582
|
-
this._settings = value;
|
|
583
|
-
this.setOsm();
|
|
584
|
-
}
|
|
585
|
-
ngOnInit() {
|
|
586
|
-
useGeographic();
|
|
587
|
-
this.map = this.mapFactory.build(this._settings);
|
|
588
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
589
|
-
this.detector.detectChanges();
|
|
590
|
-
this.map.once('postrender', () => {
|
|
591
|
-
this.map.updateSize();
|
|
592
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
593
|
-
});
|
|
594
|
-
this.setOsm();
|
|
595
|
-
}
|
|
596
|
-
setOsm() {
|
|
597
|
-
if (!this.map)
|
|
598
|
-
return;
|
|
599
|
-
this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
|
|
600
|
-
this.detector.detectChanges();
|
|
601
|
-
this.map.updateSize();
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
MapPlateComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
605
|
-
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "lib-osm-tile-layer", inputs: ["url", "map"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
606
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
607
|
-
type: Component,
|
|
608
|
-
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService, MapFeatureService], template: "<ng-content></ng-content>\n<lib-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></lib-osm-tile-layer>\n", styles: ["lib-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
|
|
609
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
610
|
-
type: Input
|
|
611
|
-
}] } });
|
|
663
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: DrawingGenerationService }]; } });
|
|
612
664
|
|
|
613
665
|
class TileLayerSettings {
|
|
614
666
|
constructor() {
|
|
@@ -741,35 +793,86 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
741
793
|
type: Input
|
|
742
794
|
}] } });
|
|
743
795
|
|
|
744
|
-
class
|
|
796
|
+
class OsmTileLayerComponent extends DestructibleComponent {
|
|
745
797
|
constructor() {
|
|
746
|
-
|
|
747
|
-
this.
|
|
748
|
-
this.maxZoom = 19;
|
|
749
|
-
this.minZoom = 0;
|
|
750
|
-
}
|
|
751
|
-
static copy(model) {
|
|
752
|
-
const result = new FeatureLayerSettings();
|
|
753
|
-
result.name = model.name;
|
|
754
|
-
result.maxZoom = model.maxZoom;
|
|
755
|
-
result.minZoom = model.minZoom;
|
|
756
|
-
result.zIndex = model.zIndex;
|
|
757
|
-
result.style = model.style;
|
|
758
|
-
return result;
|
|
759
|
-
}
|
|
760
|
-
setZIndex(zIndex) {
|
|
761
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
798
|
+
super();
|
|
799
|
+
this._url = '';
|
|
762
800
|
}
|
|
763
|
-
|
|
764
|
-
|
|
801
|
+
set url(value) {
|
|
802
|
+
if (!value || this._url === value)
|
|
803
|
+
return;
|
|
804
|
+
this._url = value;
|
|
805
|
+
this.initLayer();
|
|
765
806
|
}
|
|
766
|
-
|
|
767
|
-
|
|
807
|
+
set map(value) {
|
|
808
|
+
if (!value || this._map === value)
|
|
809
|
+
return;
|
|
810
|
+
this._map = value;
|
|
811
|
+
this.initLayer();
|
|
768
812
|
}
|
|
769
|
-
|
|
770
|
-
|
|
813
|
+
ngOnInit() { }
|
|
814
|
+
ngOnDestroy() {
|
|
815
|
+
var _a, _b;
|
|
816
|
+
if (this.layer) {
|
|
817
|
+
(_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
|
|
818
|
+
}
|
|
819
|
+
// @ts-ignore
|
|
820
|
+
(_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
|
|
771
821
|
}
|
|
772
|
-
|
|
822
|
+
initLayer() {
|
|
823
|
+
if (!this._url || !this._map)
|
|
824
|
+
return;
|
|
825
|
+
if (this.layer)
|
|
826
|
+
this._map.removeLayer(this.layer);
|
|
827
|
+
this.layer = new TileLayer({
|
|
828
|
+
source: new OSM({
|
|
829
|
+
url: this._url,
|
|
830
|
+
}),
|
|
831
|
+
});
|
|
832
|
+
this.layer.set('name', 'osm-tile-layer');
|
|
833
|
+
this._map.addLayer(this.layer);
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
837
|
+
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 });
|
|
838
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
839
|
+
type: Component,
|
|
840
|
+
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
841
|
+
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
842
|
+
type: Input
|
|
843
|
+
}], map: [{
|
|
844
|
+
type: Input
|
|
845
|
+
}] } });
|
|
846
|
+
|
|
847
|
+
class FeatureLayerSettings {
|
|
848
|
+
constructor() {
|
|
849
|
+
this.name = IdGenerator.get();
|
|
850
|
+
this.zIndex = 1;
|
|
851
|
+
this.maxZoom = 19;
|
|
852
|
+
this.minZoom = 0;
|
|
853
|
+
}
|
|
854
|
+
static copy(model) {
|
|
855
|
+
const result = new FeatureLayerSettings();
|
|
856
|
+
result.name = model.name;
|
|
857
|
+
result.maxZoom = model.maxZoom;
|
|
858
|
+
result.minZoom = model.minZoom;
|
|
859
|
+
result.zIndex = model.zIndex;
|
|
860
|
+
result.style = model.style;
|
|
861
|
+
return result;
|
|
862
|
+
}
|
|
863
|
+
setZIndex(zIndex) {
|
|
864
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
865
|
+
}
|
|
866
|
+
setName(name) {
|
|
867
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
868
|
+
}
|
|
869
|
+
setMaxZoom(maxZoom) {
|
|
870
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
871
|
+
}
|
|
872
|
+
setMinZoom(minZoom) {
|
|
873
|
+
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
874
|
+
}
|
|
875
|
+
setStyle(style) {
|
|
773
876
|
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
774
877
|
}
|
|
775
878
|
isSame(model) {
|
|
@@ -851,175 +954,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
851
954
|
type: Input
|
|
852
955
|
}] } });
|
|
853
956
|
|
|
854
|
-
class MarkersComponent extends DestructibleComponent {
|
|
855
|
-
constructor(postboy) {
|
|
856
|
-
super();
|
|
857
|
-
this.postboy = postboy;
|
|
858
|
-
this.layerName = '';
|
|
859
|
-
this._markers = [];
|
|
860
|
-
}
|
|
861
|
-
set markers(value) {
|
|
862
|
-
this._markers = value;
|
|
863
|
-
this.putMarkers();
|
|
864
|
-
}
|
|
865
|
-
ngOnInit() {
|
|
866
|
-
this.postboy
|
|
867
|
-
.subscribe(MapRenderedEvent.ID)
|
|
868
|
-
.pipe(filter((m) => !!m), first())
|
|
869
|
-
.subscribe(() => this.putMarkers());
|
|
870
|
-
}
|
|
871
|
-
putMarkers() {
|
|
872
|
-
var _a;
|
|
873
|
-
if (!((_a = this._markers) === null || _a === void 0 ? void 0 : _a.length))
|
|
874
|
-
return;
|
|
875
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
879
|
-
MarkersComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MarkersComponent, selector: "lib-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
880
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
881
|
-
type: Component,
|
|
882
|
-
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
883
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
884
|
-
type: Input
|
|
885
|
-
}], markers: [{
|
|
886
|
-
type: Input
|
|
887
|
-
}] } });
|
|
888
|
-
|
|
889
|
-
class TooltipSettings {
|
|
890
|
-
constructor(id) {
|
|
891
|
-
this.containerClass = 'custom-tooltip-class';
|
|
892
|
-
this.show = (e) => true;
|
|
893
|
-
this.id = id !== null && id !== void 0 ? id : IdGenerator.get();
|
|
894
|
-
}
|
|
895
|
-
static copy(model) {
|
|
896
|
-
const result = new TooltipSettings(model.id);
|
|
897
|
-
result.show = model.show;
|
|
898
|
-
result.containerClass = model.containerClass;
|
|
899
|
-
return result;
|
|
900
|
-
}
|
|
901
|
-
setShow(show) {
|
|
902
|
-
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { show }));
|
|
903
|
-
}
|
|
904
|
-
setClass(containerClass) {
|
|
905
|
-
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { containerClass }));
|
|
906
|
-
}
|
|
907
|
-
isSame(model) {
|
|
908
|
-
if (this.show !== model.show)
|
|
909
|
-
return false;
|
|
910
|
-
if (this.containerClass !== model.containerClass)
|
|
911
|
-
return false;
|
|
912
|
-
if (this.id !== model.id)
|
|
913
|
-
return false;
|
|
914
|
-
return true;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
|
|
918
|
-
class TooltipComponent extends DestructibleComponent {
|
|
919
|
-
set settings(value) {
|
|
920
|
-
if (!value || this._settings.isSame(value))
|
|
921
|
-
return;
|
|
922
|
-
this._settings = value;
|
|
923
|
-
this.detector.detectChanges();
|
|
924
|
-
}
|
|
925
|
-
constructor(postboy, detector) {
|
|
926
|
-
super();
|
|
927
|
-
this.postboy = postboy;
|
|
928
|
-
this.detector = detector;
|
|
929
|
-
this._settings = new TooltipSettings();
|
|
930
|
-
this.show = false;
|
|
931
|
-
this.removeOverlay = () => {
|
|
932
|
-
var _a;
|
|
933
|
-
!!this.overlay && ((_a = this.map) === null || _a === void 0 ? void 0 : _a.removeOverlay(this.overlay));
|
|
934
|
-
this.show = false;
|
|
935
|
-
};
|
|
936
|
-
this.options = (coordinates) => {
|
|
937
|
-
var _a;
|
|
938
|
-
return {
|
|
939
|
-
element: (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement,
|
|
940
|
-
autoPan: false,
|
|
941
|
-
autoPanAnimation: { duration: 0 },
|
|
942
|
-
position: coordinates,
|
|
943
|
-
};
|
|
944
|
-
};
|
|
945
|
-
}
|
|
946
|
-
ngOnInit() {
|
|
947
|
-
this.subs.push(this.observeMapRender());
|
|
948
|
-
this.subs.push(this.observeMapClick());
|
|
949
|
-
this.subs.push(this.observeClose());
|
|
950
|
-
}
|
|
951
|
-
observeMapClick() {
|
|
952
|
-
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
953
|
-
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
observeClose() {
|
|
957
|
-
return this.postboy
|
|
958
|
-
.subscribe(CloseTooltipCommand.ID)
|
|
959
|
-
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
960
|
-
.subscribe(() => this.removeOverlay());
|
|
961
|
-
}
|
|
962
|
-
observeMapRender() {
|
|
963
|
-
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
964
|
-
this.map = m.map;
|
|
965
|
-
});
|
|
966
|
-
}
|
|
967
|
-
addOverlay(coordinates) {
|
|
968
|
-
var _a;
|
|
969
|
-
this.removeOverlay();
|
|
970
|
-
this.overlay = new Overlay(this.options(coordinates));
|
|
971
|
-
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addOverlay(this.overlay);
|
|
972
|
-
this.show = true;
|
|
973
|
-
this.detector.detectChanges();
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
TooltipComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
977
|
-
TooltipComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TooltipComponent, selector: "lib-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
978
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
979
|
-
type: Component,
|
|
980
|
-
args: [{ selector: 'lib-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
|
|
981
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
982
|
-
type: ViewChild,
|
|
983
|
-
args: ['tip']
|
|
984
|
-
}], settings: [{
|
|
985
|
-
type: Input
|
|
986
|
-
}] } });
|
|
987
|
-
|
|
988
|
-
class PolygonsComponent extends DestructibleComponent {
|
|
989
|
-
constructor(postboy) {
|
|
990
|
-
super();
|
|
991
|
-
this.postboy = postboy;
|
|
992
|
-
this.layerName = '';
|
|
993
|
-
this._polygons = [];
|
|
994
|
-
}
|
|
995
|
-
set polygons(value) {
|
|
996
|
-
this._polygons = value;
|
|
997
|
-
this.putPolygons();
|
|
998
|
-
}
|
|
999
|
-
ngOnInit() {
|
|
1000
|
-
this.postboy
|
|
1001
|
-
.subscribe(MapRenderedEvent.ID)
|
|
1002
|
-
.pipe(filter((m) => !!m), first())
|
|
1003
|
-
.subscribe(() => this.putPolygons());
|
|
1004
|
-
}
|
|
1005
|
-
putPolygons() {
|
|
1006
|
-
var _a;
|
|
1007
|
-
if (!((_a = this._polygons) === null || _a === void 0 ? void 0 : _a.length))
|
|
1008
|
-
return;
|
|
1009
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1010
|
-
}
|
|
1011
|
-
}
|
|
1012
|
-
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1013
|
-
PolygonsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: PolygonsComponent, selector: "lib-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1014
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1015
|
-
type: Component,
|
|
1016
|
-
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1017
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1018
|
-
type: Input
|
|
1019
|
-
}], polygons: [{
|
|
1020
|
-
type: Input
|
|
1021
|
-
}] } });
|
|
1022
|
-
|
|
1023
957
|
class ClusterLayerSettings {
|
|
1024
958
|
constructor() {
|
|
1025
959
|
this.name = IdGenerator.get();
|
|
@@ -1028,6 +962,7 @@ class ClusterLayerSettings {
|
|
|
1028
962
|
this.minZoom = 0;
|
|
1029
963
|
this.distance = 20;
|
|
1030
964
|
this.bbox = false;
|
|
965
|
+
this.clusterCancel = 14;
|
|
1031
966
|
}
|
|
1032
967
|
static copy(model) {
|
|
1033
968
|
const result = new ClusterLayerSettings();
|
|
@@ -1036,6 +971,7 @@ class ClusterLayerSettings {
|
|
|
1036
971
|
result.minZoom = model.minZoom;
|
|
1037
972
|
result.zIndex = model.zIndex;
|
|
1038
973
|
result.bbox = model.bbox;
|
|
974
|
+
result.clusterCancel = model.clusterCancel;
|
|
1039
975
|
result.distance = model.distance;
|
|
1040
976
|
result.style = model.style;
|
|
1041
977
|
return result;
|
|
@@ -1055,6 +991,9 @@ class ClusterLayerSettings {
|
|
|
1055
991
|
setMinZoom(minZoom) {
|
|
1056
992
|
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
1057
993
|
}
|
|
994
|
+
setClusterCancel(clusterCancel) {
|
|
995
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { clusterCancel }));
|
|
996
|
+
}
|
|
1058
997
|
setBbox(bbox) {
|
|
1059
998
|
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox }));
|
|
1060
999
|
}
|
|
@@ -1072,6 +1011,8 @@ class ClusterLayerSettings {
|
|
|
1072
1011
|
return false;
|
|
1073
1012
|
if (this.distance !== model.distance)
|
|
1074
1013
|
return false;
|
|
1014
|
+
if (this.clusterCancel !== model.clusterCancel)
|
|
1015
|
+
return false;
|
|
1075
1016
|
if (this.bbox !== model.bbox)
|
|
1076
1017
|
return false;
|
|
1077
1018
|
if (this.style !== model.style)
|
|
@@ -1086,6 +1027,15 @@ class ClusterLayerManager {
|
|
|
1086
1027
|
this.layer = layer;
|
|
1087
1028
|
this.postboy = postboy;
|
|
1088
1029
|
this.observeClick();
|
|
1030
|
+
this.observeMapMovement();
|
|
1031
|
+
}
|
|
1032
|
+
observeMapMovement() {
|
|
1033
|
+
combineLatest([
|
|
1034
|
+
this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
|
|
1035
|
+
this.postboy.subscribe(MapRenderedEvent.ID),
|
|
1036
|
+
]).subscribe(([movement, renderEvent]) => {
|
|
1037
|
+
this.checkClusterNecessity(renderEvent.map);
|
|
1038
|
+
});
|
|
1089
1039
|
}
|
|
1090
1040
|
observeClick() {
|
|
1091
1041
|
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
@@ -1095,6 +1045,12 @@ class ClusterLayerManager {
|
|
|
1095
1045
|
}
|
|
1096
1046
|
});
|
|
1097
1047
|
}
|
|
1048
|
+
checkClusterNecessity(map) {
|
|
1049
|
+
var _a, _b, _c;
|
|
1050
|
+
let zoom = (_a = map.getView().getZoom()) !== null && _a !== void 0 ? _a : 0;
|
|
1051
|
+
const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
|
|
1052
|
+
(_c = (_b = this.layer) === null || _b === void 0 ? void 0 : _b.getSource()) === null || _c === void 0 ? void 0 : _c.setDistance(distance);
|
|
1053
|
+
}
|
|
1098
1054
|
}
|
|
1099
1055
|
|
|
1100
1056
|
class ClusterLayerFactory {
|
|
@@ -1189,6 +1145,263 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
1189
1145
|
type: Input
|
|
1190
1146
|
}] } });
|
|
1191
1147
|
|
|
1148
|
+
class MapPlateFactory {
|
|
1149
|
+
build(settings) {
|
|
1150
|
+
return new Map({
|
|
1151
|
+
controls: [],
|
|
1152
|
+
view: new View({
|
|
1153
|
+
center: (settings === null || settings === void 0 ? void 0 : settings.center) || [0, 0],
|
|
1154
|
+
zoom: (settings === null || settings === void 0 ? void 0 : settings.zoom) || 4,
|
|
1155
|
+
minZoom: (settings === null || settings === void 0 ? void 0 : settings.minZoom) || 0,
|
|
1156
|
+
maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
|
|
1157
|
+
}),
|
|
1158
|
+
layers: [],
|
|
1159
|
+
});
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1163
|
+
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
1164
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
1165
|
+
type: Injectable,
|
|
1166
|
+
args: [{
|
|
1167
|
+
providedIn: 'root',
|
|
1168
|
+
}]
|
|
1169
|
+
}] });
|
|
1170
|
+
|
|
1171
|
+
class MapPlateComponent extends DestructibleComponent {
|
|
1172
|
+
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
1173
|
+
super();
|
|
1174
|
+
this.elementRef = elementRef;
|
|
1175
|
+
this.postboy = postboy;
|
|
1176
|
+
this.mapFactory = mapFactory;
|
|
1177
|
+
this.registrator = registrator;
|
|
1178
|
+
this.detector = detector;
|
|
1179
|
+
this.osmUrl = '';
|
|
1180
|
+
this._settings = new MapSettings();
|
|
1181
|
+
this.drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
|
|
1182
|
+
this.onDestroy = () => {
|
|
1183
|
+
this.registrator.down();
|
|
1184
|
+
};
|
|
1185
|
+
registrator.up();
|
|
1186
|
+
}
|
|
1187
|
+
set settings(value) {
|
|
1188
|
+
if (!value || this._settings.isSame(value))
|
|
1189
|
+
return;
|
|
1190
|
+
this._settings = value;
|
|
1191
|
+
this.setOsm();
|
|
1192
|
+
}
|
|
1193
|
+
ngOnInit() {
|
|
1194
|
+
useGeographic();
|
|
1195
|
+
this.map = this.mapFactory.build(this._settings);
|
|
1196
|
+
this.map.setTarget(this.elementRef.nativeElement);
|
|
1197
|
+
this.detector.detectChanges();
|
|
1198
|
+
this.map.once('postrender', () => {
|
|
1199
|
+
this.map.updateSize();
|
|
1200
|
+
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
1201
|
+
});
|
|
1202
|
+
this.setOsm();
|
|
1203
|
+
}
|
|
1204
|
+
setOsm() {
|
|
1205
|
+
if (!this.map)
|
|
1206
|
+
return;
|
|
1207
|
+
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}`;
|
|
1208
|
+
this.detector.detectChanges();
|
|
1209
|
+
this.map.updateSize();
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
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 });
|
|
1213
|
+
MapPlateComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: MapPlateComponent, selector: "lib-map-plate", inputs: { settings: "settings" }, providers: [
|
|
1214
|
+
MessageRegistratorService,
|
|
1215
|
+
MapStateService,
|
|
1216
|
+
MapManagementService,
|
|
1217
|
+
MapClickService,
|
|
1218
|
+
MapFeatureService,
|
|
1219
|
+
DrawingService,
|
|
1220
|
+
DrawingGenerationService,
|
|
1221
|
+
], 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 });
|
|
1222
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
1223
|
+
type: Component,
|
|
1224
|
+
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1225
|
+
MessageRegistratorService,
|
|
1226
|
+
MapStateService,
|
|
1227
|
+
MapManagementService,
|
|
1228
|
+
MapClickService,
|
|
1229
|
+
MapFeatureService,
|
|
1230
|
+
DrawingService,
|
|
1231
|
+
DrawingGenerationService,
|
|
1232
|
+
], 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"] }]
|
|
1233
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
1234
|
+
type: Input
|
|
1235
|
+
}] } });
|
|
1236
|
+
|
|
1237
|
+
class MarkersComponent extends DestructibleComponent {
|
|
1238
|
+
constructor(postboy) {
|
|
1239
|
+
super();
|
|
1240
|
+
this.postboy = postboy;
|
|
1241
|
+
this.layerName = '';
|
|
1242
|
+
this._markers = [];
|
|
1243
|
+
}
|
|
1244
|
+
set markers(value) {
|
|
1245
|
+
this._markers = value;
|
|
1246
|
+
this.putMarkers();
|
|
1247
|
+
}
|
|
1248
|
+
ngOnInit() {
|
|
1249
|
+
this.postboy
|
|
1250
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1251
|
+
.pipe(filter((m) => !!m), first())
|
|
1252
|
+
.subscribe(() => this.putMarkers());
|
|
1253
|
+
}
|
|
1254
|
+
putMarkers() {
|
|
1255
|
+
var _a;
|
|
1256
|
+
if (!((_a = this._markers) === null || _a === void 0 ? void 0 : _a.length))
|
|
1257
|
+
return;
|
|
1258
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1262
|
+
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 });
|
|
1263
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
1264
|
+
type: Component,
|
|
1265
|
+
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1266
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1267
|
+
type: Input
|
|
1268
|
+
}], markers: [{
|
|
1269
|
+
type: Input
|
|
1270
|
+
}] } });
|
|
1271
|
+
|
|
1272
|
+
class TooltipSettings {
|
|
1273
|
+
constructor(id) {
|
|
1274
|
+
this.containerClass = 'custom-tooltip-class';
|
|
1275
|
+
this.show = (e) => true;
|
|
1276
|
+
this.id = id !== null && id !== void 0 ? id : IdGenerator.get();
|
|
1277
|
+
}
|
|
1278
|
+
static copy(model) {
|
|
1279
|
+
const result = new TooltipSettings(model.id);
|
|
1280
|
+
result.show = model.show;
|
|
1281
|
+
result.containerClass = model.containerClass;
|
|
1282
|
+
return result;
|
|
1283
|
+
}
|
|
1284
|
+
setShow(show) {
|
|
1285
|
+
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { show }));
|
|
1286
|
+
}
|
|
1287
|
+
setClass(containerClass) {
|
|
1288
|
+
return TooltipSettings.copy(Object.assign(Object.assign({}, this), { containerClass }));
|
|
1289
|
+
}
|
|
1290
|
+
isSame(model) {
|
|
1291
|
+
if (this.show !== model.show)
|
|
1292
|
+
return false;
|
|
1293
|
+
if (this.containerClass !== model.containerClass)
|
|
1294
|
+
return false;
|
|
1295
|
+
if (this.id !== model.id)
|
|
1296
|
+
return false;
|
|
1297
|
+
return true;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
class TooltipComponent extends DestructibleComponent {
|
|
1302
|
+
set settings(value) {
|
|
1303
|
+
if (!value || this._settings.isSame(value))
|
|
1304
|
+
return;
|
|
1305
|
+
this._settings = value;
|
|
1306
|
+
this.detector.detectChanges();
|
|
1307
|
+
}
|
|
1308
|
+
constructor(postboy, detector) {
|
|
1309
|
+
super();
|
|
1310
|
+
this.postboy = postboy;
|
|
1311
|
+
this.detector = detector;
|
|
1312
|
+
this._settings = new TooltipSettings();
|
|
1313
|
+
this.show = false;
|
|
1314
|
+
this.removeOverlay = () => {
|
|
1315
|
+
var _a;
|
|
1316
|
+
!!this.overlay && ((_a = this.map) === null || _a === void 0 ? void 0 : _a.removeOverlay(this.overlay));
|
|
1317
|
+
this.show = false;
|
|
1318
|
+
};
|
|
1319
|
+
this.options = (coordinates) => {
|
|
1320
|
+
var _a;
|
|
1321
|
+
return {
|
|
1322
|
+
element: (_a = this.container) === null || _a === void 0 ? void 0 : _a.nativeElement,
|
|
1323
|
+
autoPan: false,
|
|
1324
|
+
autoPanAnimation: { duration: 0 },
|
|
1325
|
+
position: coordinates,
|
|
1326
|
+
};
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
ngOnInit() {
|
|
1330
|
+
this.subs.push(this.observeMapRender());
|
|
1331
|
+
this.subs.push(this.observeMapClick());
|
|
1332
|
+
this.subs.push(this.observeClose());
|
|
1333
|
+
}
|
|
1334
|
+
observeMapClick() {
|
|
1335
|
+
return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
|
|
1336
|
+
this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
observeClose() {
|
|
1340
|
+
return this.postboy
|
|
1341
|
+
.subscribe(CloseTooltipCommand.ID)
|
|
1342
|
+
.pipe(filter((ev) => ev.tooltipId === this._settings.id))
|
|
1343
|
+
.subscribe(() => this.removeOverlay());
|
|
1344
|
+
}
|
|
1345
|
+
observeMapRender() {
|
|
1346
|
+
return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
1347
|
+
this.map = m.map;
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
addOverlay(coordinates) {
|
|
1351
|
+
var _a;
|
|
1352
|
+
this.removeOverlay();
|
|
1353
|
+
this.overlay = new Overlay(this.options(coordinates));
|
|
1354
|
+
(_a = this.map) === null || _a === void 0 ? void 0 : _a.addOverlay(this.overlay);
|
|
1355
|
+
this.show = true;
|
|
1356
|
+
this.detector.detectChanges();
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
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 });
|
|
1360
|
+
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 });
|
|
1361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TooltipComponent, decorators: [{
|
|
1362
|
+
type: Component,
|
|
1363
|
+
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"] }]
|
|
1364
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
|
|
1365
|
+
type: ViewChild,
|
|
1366
|
+
args: ['tip']
|
|
1367
|
+
}], settings: [{
|
|
1368
|
+
type: Input
|
|
1369
|
+
}] } });
|
|
1370
|
+
|
|
1371
|
+
class PolygonsComponent extends DestructibleComponent {
|
|
1372
|
+
constructor(postboy) {
|
|
1373
|
+
super();
|
|
1374
|
+
this.postboy = postboy;
|
|
1375
|
+
this.layerName = '';
|
|
1376
|
+
this._polygons = [];
|
|
1377
|
+
}
|
|
1378
|
+
set polygons(value) {
|
|
1379
|
+
this._polygons = value;
|
|
1380
|
+
this.putPolygons();
|
|
1381
|
+
}
|
|
1382
|
+
ngOnInit() {
|
|
1383
|
+
this.postboy
|
|
1384
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1385
|
+
.pipe(filter((m) => !!m), first())
|
|
1386
|
+
.subscribe(() => this.putPolygons());
|
|
1387
|
+
}
|
|
1388
|
+
putPolygons() {
|
|
1389
|
+
if (!this._polygons)
|
|
1390
|
+
return;
|
|
1391
|
+
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
PolygonsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1395
|
+
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 });
|
|
1396
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: PolygonsComponent, decorators: [{
|
|
1397
|
+
type: Component,
|
|
1398
|
+
args: [{ selector: 'lib-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1399
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
1400
|
+
type: Input
|
|
1401
|
+
}], polygons: [{
|
|
1402
|
+
type: Input
|
|
1403
|
+
}] } });
|
|
1404
|
+
|
|
1192
1405
|
class MapModule {
|
|
1193
1406
|
}
|
|
1194
1407
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -1289,6 +1502,57 @@ class TextStyleHelper {
|
|
|
1289
1502
|
}
|
|
1290
1503
|
}
|
|
1291
1504
|
|
|
1505
|
+
class StringifyFeatureHelper {
|
|
1506
|
+
static polygon(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1507
|
+
return format === FeatureOutputFormat.GeoJson
|
|
1508
|
+
? new GeoJSON().writeFeature(feature)
|
|
1509
|
+
: new WKT().writeFeature(feature);
|
|
1510
|
+
}
|
|
1511
|
+
static circle(feature, format = FeatureOutputFormat.GeoJson) {
|
|
1512
|
+
// const clone = feature.clone();
|
|
1513
|
+
// clone.setGeometry(fromCircle(feature.getGeometry()! as Circle));
|
|
1514
|
+
const tetemp = feature.getGeometryName();
|
|
1515
|
+
const circle = feature.getGeometry();
|
|
1516
|
+
// const temp = StringifyFeatureHelper.drawCircle(circle.getCenter(), circle.getRadius());
|
|
1517
|
+
const ttt = feature.getGeometry().getExtent();
|
|
1518
|
+
const eastPoint = [ttt[2], (ttt[1] + ttt[3]) / 2];
|
|
1519
|
+
const aaa = [
|
|
1520
|
+
...transform([ttt[0], ttt[1]], 'EPSG:4326', 'EPSG:3857'),
|
|
1521
|
+
...transform([ttt[2], ttt[3]], 'EPSG:4326', 'EPSG:3857'),
|
|
1522
|
+
];
|
|
1523
|
+
const radius = (aaa[2] - aaa[0]) / 2;
|
|
1524
|
+
const radius2 = new LineString([circle.getCenter(), eastPoint]).getLength();
|
|
1525
|
+
const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
|
|
1526
|
+
// var edgeCoordinate = [circle.getCenter()[0] + radius, circle.getCenter()[1]];
|
|
1527
|
+
// var wgs84Sphere = new Sphere(6378137);
|
|
1528
|
+
return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
|
|
1529
|
+
// const rad = circle.getRadius();
|
|
1530
|
+
// const degrees = 180 / Math.PI; // radians to degrees
|
|
1531
|
+
// const radians = Math.PI / 180; // degrees to radians
|
|
1532
|
+
// const rlat = rad * degrees * 1000;
|
|
1533
|
+
// const rlng = rad * radians;
|
|
1534
|
+
// return StringifyFeatureHelper.polygon(new Feature<Geometry>(circular(circle.getCenter(),circle.getRadius() * METERS_PER_UNIT)), format);
|
|
1535
|
+
}
|
|
1536
|
+
static drawCircle(point, radius) {
|
|
1537
|
+
const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
|
|
1538
|
+
// const tetetemp = point;
|
|
1539
|
+
const radians = Math.PI / 180; // degrees to radians
|
|
1540
|
+
const degrees = 180 / Math.PI; // radians to degrees
|
|
1541
|
+
const earthsradius = 6378137.0;
|
|
1542
|
+
const rlat = (radius / earthsradius) * degrees;
|
|
1543
|
+
const rlng = rlat / Math.cos(tetetemp[1] * radians);
|
|
1544
|
+
const extp = [];
|
|
1545
|
+
for (let i = 0; i <= 32; i++) {
|
|
1546
|
+
const theta = Math.PI * (i / 16);
|
|
1547
|
+
extp.push([
|
|
1548
|
+
tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
|
|
1549
|
+
tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
|
|
1550
|
+
]);
|
|
1551
|
+
}
|
|
1552
|
+
return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1292
1556
|
/*
|
|
1293
1557
|
* Public API Surface of maps
|
|
1294
1558
|
*/
|
|
@@ -1297,5 +1561,5 @@ class TextStyleHelper {
|
|
|
1297
1561
|
* Generated bundle index. Do not edit.
|
|
1298
1562
|
*/
|
|
1299
1563
|
|
|
1300
|
-
export {
|
|
1564
|
+
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 };
|
|
1301
1565
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|