@artstesh/maps 4.0.5 → 4.0.7
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 +3 -1
- package/dist/esm2020/map/helpers/marker-style.helper.mjs +5 -1
- package/dist/esm2020/map/helpers/polygon-style.helper.mjs +16 -0
- package/dist/esm2020/map/helpers/text-style.helper.mjs +14 -0
- package/dist/esm2020/map/map-plate/features/index.mjs +2 -1
- package/dist/esm2020/map/map-plate/features/polygons/polygons.component.mjs +41 -0
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -0
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +50 -0
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +18 -0
- package/dist/esm2020/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +61 -0
- package/dist/esm2020/map/map-plate/layers/index.mjs +3 -1
- package/dist/esm2020/map/map-plate/map-plate.component.mjs +4 -3
- package/dist/esm2020/map/map.module.mjs +23 -3
- package/dist/esm2020/map/messages/commands/add-layer.command.mjs +1 -1
- package/dist/esm2020/map/messages/commands/fit-to-features.command.mjs +13 -0
- package/dist/esm2020/map/messages/events/map-click.event.mjs +3 -2
- package/dist/esm2020/map/models/i-identified.mjs +2 -0
- package/dist/esm2020/map/models/index.mjs +2 -1
- package/dist/esm2020/map/models/map.constants.mjs +4 -0
- package/dist/esm2020/map/models/marker-model.mjs +3 -2
- package/dist/esm2020/map/models/polygon.model.mjs +25 -0
- package/dist/esm2020/map/services/map-click.service.mjs +7 -3
- package/dist/esm2020/map/services/map-feature.service.mjs +39 -0
- package/dist/esm2020/map/services/map-management.service.mjs +6 -3
- package/dist/esm2020/map/services/message-registrator.service.mjs +9 -6
- package/dist/esm2020/src/map/helpers/index.mjs +3 -1
- package/dist/esm2020/src/map/helpers/marker-style.helper.mjs +5 -1
- package/dist/esm2020/src/map/helpers/polygon-style.helper.mjs +16 -0
- package/dist/esm2020/src/map/helpers/text-style.helper.mjs +14 -0
- package/dist/esm2020/src/map/map-plate/features/index.mjs +2 -1
- package/dist/esm2020/src/map/map-plate/features/polygons/polygons.component.mjs +41 -0
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -0
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +50 -0
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +18 -0
- package/dist/esm2020/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +61 -0
- package/dist/esm2020/src/map/map-plate/layers/index.mjs +3 -1
- package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +4 -3
- package/dist/esm2020/src/map/map.module.mjs +23 -3
- package/dist/esm2020/src/map/messages/commands/add-layer.command.mjs +1 -1
- package/dist/esm2020/src/map/messages/commands/fit-to-features.command.mjs +13 -0
- package/dist/esm2020/src/map/messages/events/map-click.event.mjs +3 -2
- package/dist/esm2020/src/map/models/i-identified.mjs +2 -0
- package/dist/esm2020/src/map/models/index.mjs +2 -1
- package/dist/esm2020/src/map/models/map.constants.mjs +4 -0
- package/dist/esm2020/src/map/models/marker-model.mjs +3 -2
- package/dist/esm2020/src/map/models/polygon.model.mjs +25 -0
- package/dist/esm2020/src/map/services/map-click.service.mjs +7 -3
- package/dist/esm2020/src/map/services/map-feature.service.mjs +39 -0
- package/dist/esm2020/src/map/services/map-management.service.mjs +6 -3
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +9 -6
- package/dist/fesm2015/maps-components-src-map.mjs +355 -17
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +355 -17
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +349 -16
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +349 -16
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/helpers/index.d.ts +2 -0
- package/dist/map/helpers/marker-style.helper.d.ts +2 -0
- package/dist/map/helpers/polygon-style.helper.d.ts +4 -0
- package/dist/map/helpers/text-style.helper.d.ts +4 -0
- package/dist/map/map-plate/features/index.d.ts +1 -0
- package/dist/map/map-plate/features/polygons/polygons.component.d.ts +16 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +11 -0
- package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +20 -0
- package/dist/map/map-plate/layers/index.d.ts +2 -0
- package/dist/map/map.module.d.ts +4 -2
- package/dist/map/messages/commands/add-layer.command.d.ts +3 -2
- package/dist/map/messages/commands/fit-to-features.command.d.ts +10 -0
- package/dist/map/messages/events/map-click.event.d.ts +10 -2
- package/dist/map/models/i-identified.d.ts +3 -0
- package/dist/map/models/index.d.ts +1 -0
- package/dist/map/models/map.constants.d.ts +3 -0
- package/dist/map/models/polygon.model.d.ts +19 -0
- package/dist/map/services/map-feature.service.d.ts +14 -0
- package/dist/map/services/message-registrator.service.d.ts +2 -1
- package/dist/src/map/helpers/index.d.ts +2 -0
- package/dist/src/map/helpers/marker-style.helper.d.ts +2 -0
- package/dist/src/map/helpers/polygon-style.helper.d.ts +4 -0
- package/dist/src/map/helpers/text-style.helper.d.ts +4 -0
- package/dist/src/map/map-plate/features/index.d.ts +1 -0
- package/dist/src/map/map-plate/features/polygons/polygons.component.d.ts +16 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +21 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +11 -0
- package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +20 -0
- package/dist/src/map/map-plate/layers/index.d.ts +2 -0
- package/dist/src/map/map.module.d.ts +4 -2
- package/dist/src/map/messages/commands/add-layer.command.d.ts +3 -2
- package/dist/src/map/messages/commands/fit-to-features.command.d.ts +10 -0
- package/dist/src/map/messages/events/map-click.event.d.ts +10 -2
- package/dist/src/map/models/i-identified.d.ts +3 -0
- package/dist/src/map/models/index.d.ts +1 -0
- package/dist/src/map/models/map.constants.d.ts +3 -0
- package/dist/src/map/models/polygon.model.d.ts +19 -0
- package/dist/src/map/services/map-feature.service.d.ts +14 -0
- package/dist/src/map/services/message-registrator.service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@ import * as i4 from '@angular/common';
|
|
|
4
4
|
import { CommonModule } from '@angular/common';
|
|
5
5
|
import { Feature } from 'ol';
|
|
6
6
|
import { Point } from 'ol/geom';
|
|
7
|
+
import { GeoJSON, WKT } from 'ol/format';
|
|
8
|
+
import { getCenter, createEmpty, extend } from 'ol/extent';
|
|
7
9
|
import { useGeographic, get } from 'ol/proj';
|
|
8
10
|
import { Subject } from 'rxjs';
|
|
9
11
|
import { PostboyService, PostboyAbstractRegistrator } from '@artstesh/postboy';
|
|
@@ -15,8 +17,11 @@ import { filter, first } from 'rxjs/operators';
|
|
|
15
17
|
import { XYZ, Vector } from 'ol/source';
|
|
16
18
|
import { Vector as Vector$1 } from 'ol/layer';
|
|
17
19
|
import Overlay from 'ol/Overlay';
|
|
20
|
+
import { bbox } from 'ol/loadingstrategy';
|
|
21
|
+
import { fromExtent } from 'ol/geom/Polygon';
|
|
22
|
+
import Cluster from 'ol/source/Cluster';
|
|
18
23
|
import Style from 'ol/style/Style';
|
|
19
|
-
import { Icon, Circle, Fill, Stroke } from 'ol/style';
|
|
24
|
+
import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
|
|
20
25
|
|
|
21
26
|
class DestructibleComponent {
|
|
22
27
|
constructor() {
|
|
@@ -120,6 +125,10 @@ class IdGenerator {
|
|
|
120
125
|
}
|
|
121
126
|
IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
122
127
|
|
|
128
|
+
class MapConstants {
|
|
129
|
+
}
|
|
130
|
+
MapConstants.FeatureInfo = 'f-info';
|
|
131
|
+
|
|
123
132
|
class MarkerModel {
|
|
124
133
|
constructor(lat, lng, id, info) {
|
|
125
134
|
this.lat = lat;
|
|
@@ -135,11 +144,34 @@ class MarkerModel {
|
|
|
135
144
|
const feature = new Feature(new Point([this.lng, this.lat]));
|
|
136
145
|
feature.setId(this.id);
|
|
137
146
|
if (this.info)
|
|
138
|
-
feature.set(
|
|
147
|
+
feature.set(MapConstants.FeatureInfo, this.info);
|
|
139
148
|
return feature;
|
|
140
149
|
}
|
|
141
150
|
}
|
|
142
151
|
|
|
152
|
+
class PolygonModel {
|
|
153
|
+
static fromGeoJson(id, json, info) {
|
|
154
|
+
let feature = new GeoJSON().readFeature(json);
|
|
155
|
+
feature.setId(id);
|
|
156
|
+
return new PolygonModel(feature, id, info);
|
|
157
|
+
}
|
|
158
|
+
static fromWKT(id, wkt, info) {
|
|
159
|
+
let feature = new WKT().readFeature(wkt);
|
|
160
|
+
feature.setId(id);
|
|
161
|
+
return new PolygonModel(feature, id, info);
|
|
162
|
+
}
|
|
163
|
+
constructor(feature, id, info) {
|
|
164
|
+
var _a;
|
|
165
|
+
this.info = info;
|
|
166
|
+
this.id = id == null ? IdGenerator.get() : id;
|
|
167
|
+
this._feature = feature;
|
|
168
|
+
[this.lng, this.lat] = getCenter((_a = this._feature.getGeometry()) === null || _a === void 0 ? void 0 : _a.getExtent());
|
|
169
|
+
}
|
|
170
|
+
get feature() {
|
|
171
|
+
return this._feature;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
143
175
|
class GenericMessage {
|
|
144
176
|
}
|
|
145
177
|
class CallbackMessage extends GenericMessage {
|
|
@@ -166,10 +198,11 @@ class MapRenderedEvent extends GenericMessage {
|
|
|
166
198
|
MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
167
199
|
|
|
168
200
|
class MapClickEvent extends GenericMessage {
|
|
169
|
-
constructor(coordinates, entities) {
|
|
201
|
+
constructor(coordinates, entities, features) {
|
|
170
202
|
super();
|
|
171
203
|
this.coordinates = coordinates;
|
|
172
204
|
this.entities = entities;
|
|
205
|
+
this.features = features;
|
|
173
206
|
}
|
|
174
207
|
get id() {
|
|
175
208
|
return MapClickEvent.ID;
|
|
@@ -244,6 +277,18 @@ class RemoveTileCommand extends GenericMessage {
|
|
|
244
277
|
}
|
|
245
278
|
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
246
279
|
|
|
280
|
+
class FitToFeaturesCommand extends GenericMessage {
|
|
281
|
+
constructor(features, zoomAfter = 0) {
|
|
282
|
+
super();
|
|
283
|
+
this.features = features;
|
|
284
|
+
this.zoomAfter = zoomAfter;
|
|
285
|
+
}
|
|
286
|
+
get id() {
|
|
287
|
+
return FitToFeaturesCommand.ID;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
FitToFeaturesCommand.ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
|
|
291
|
+
|
|
247
292
|
class MapPostboyService extends PostboyService {
|
|
248
293
|
constructor() {
|
|
249
294
|
super(...arguments);
|
|
@@ -298,11 +343,14 @@ class MapManagementService {
|
|
|
298
343
|
}
|
|
299
344
|
observePlaceFeatures() {
|
|
300
345
|
this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
|
|
301
|
-
var _a
|
|
346
|
+
var _a;
|
|
302
347
|
if (!this.layers[c.layer])
|
|
303
348
|
return;
|
|
304
|
-
|
|
305
|
-
(
|
|
349
|
+
let source = (_a = this.layers[c.layer]) === null || _a === void 0 ? void 0 : _a.getSource();
|
|
350
|
+
if (!!source['getSource'])
|
|
351
|
+
source = source === null || source === void 0 ? void 0 : source.getSource();
|
|
352
|
+
source === null || source === void 0 ? void 0 : source.clear();
|
|
353
|
+
source === null || source === void 0 ? void 0 : source.addFeatures(c.features);
|
|
306
354
|
});
|
|
307
355
|
}
|
|
308
356
|
observeRemoveLayer() {
|
|
@@ -334,6 +382,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
334
382
|
type: Injectable
|
|
335
383
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
336
384
|
|
|
385
|
+
class MapFeatureService {
|
|
386
|
+
constructor(postboy) {
|
|
387
|
+
this.postboy = postboy;
|
|
388
|
+
}
|
|
389
|
+
up() {
|
|
390
|
+
this.observeMapRender();
|
|
391
|
+
this.observeFitToFeatures();
|
|
392
|
+
}
|
|
393
|
+
observeMapRender() {
|
|
394
|
+
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
395
|
+
this.map = m.map;
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
observeFitToFeatures() {
|
|
399
|
+
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((m) => {
|
|
400
|
+
this.fitToGeometries(m.features.map((f) => f.getGeometry()), m.zoomAfter);
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
fitToGeometries(geometries, zoomAfter) {
|
|
404
|
+
if (!(geometries === null || geometries === void 0 ? void 0 : geometries.length) || !this.map)
|
|
405
|
+
return;
|
|
406
|
+
const extent = createEmpty();
|
|
407
|
+
geometries.forEach((g) => extend(extent, g.getExtent()));
|
|
408
|
+
this.map.getView().fit(extent);
|
|
409
|
+
this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
MapFeatureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapFeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
413
|
+
MapFeatureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapFeatureService });
|
|
414
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapFeatureService, decorators: [{
|
|
415
|
+
type: Injectable
|
|
416
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
417
|
+
|
|
337
418
|
class MapClickService {
|
|
338
419
|
constructor(postboy) {
|
|
339
420
|
this.postboy = postboy;
|
|
@@ -352,7 +433,7 @@ class MapClickService {
|
|
|
352
433
|
}
|
|
353
434
|
onClick(ev) {
|
|
354
435
|
var _a;
|
|
355
|
-
const model = new MapClickEvent(ev.coordinate, {});
|
|
436
|
+
const model = new MapClickEvent(ev.coordinate, {}, {});
|
|
356
437
|
(_a = this.map) === null || _a === void 0 ? void 0 : _a.forEachFeatureAtPixel(ev.pixel, (f, l) => {
|
|
357
438
|
this.getFeatureCollectionWithInner([f])
|
|
358
439
|
.filter((f) => f.getId() != null)
|
|
@@ -360,7 +441,10 @@ class MapClickService {
|
|
|
360
441
|
let layerName = l.get('name');
|
|
361
442
|
if (!model.entities[layerName])
|
|
362
443
|
model.entities[layerName] = [];
|
|
363
|
-
model.
|
|
444
|
+
if (!model.features[layerName])
|
|
445
|
+
model.features[layerName] = [];
|
|
446
|
+
model.entities[layerName].push(Object.assign({ id: fs.getId() }, fs.get(MapConstants.FeatureInfo)));
|
|
447
|
+
model.features[layerName].push(fs);
|
|
364
448
|
});
|
|
365
449
|
});
|
|
366
450
|
return model;
|
|
@@ -381,9 +465,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
381
465
|
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
382
466
|
|
|
383
467
|
class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
384
|
-
constructor(service, management, state, interaction) {
|
|
468
|
+
constructor(service, management, state, feature, interaction) {
|
|
385
469
|
super(service);
|
|
386
|
-
this.registerServices([management, state, interaction]);
|
|
470
|
+
this.registerServices([management, state, interaction, feature]);
|
|
387
471
|
}
|
|
388
472
|
_up() {
|
|
389
473
|
this.registerReplay(MapRenderedEvent.ID);
|
|
@@ -394,13 +478,14 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
394
478
|
this.registerSubject(RemoveTileCommand.ID);
|
|
395
479
|
this.registerSubject(MapClickEvent.ID);
|
|
396
480
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
481
|
+
this.registerSubject(FitToFeaturesCommand.ID);
|
|
397
482
|
}
|
|
398
483
|
}
|
|
399
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapClickService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
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 });
|
|
400
485
|
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
|
|
401
486
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
402
487
|
type: Injectable
|
|
403
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapClickService }]; } });
|
|
488
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }]; } });
|
|
404
489
|
|
|
405
490
|
class MapPlateFactory {
|
|
406
491
|
build(settings) {
|
|
@@ -517,10 +602,10 @@ class MapPlateComponent extends DestructibleComponent {
|
|
|
517
602
|
}
|
|
518
603
|
}
|
|
519
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 });
|
|
520
|
-
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], 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 });
|
|
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 });
|
|
521
606
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
522
607
|
type: Component,
|
|
523
|
-
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [MessageRegistratorService, MapStateService, MapManagementService, MapClickService], 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"] }]
|
|
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"] }]
|
|
524
609
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
525
610
|
type: Input
|
|
526
611
|
}] } });
|
|
@@ -900,6 +985,210 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
900
985
|
type: Input
|
|
901
986
|
}] } });
|
|
902
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
|
+
class ClusterLayerSettings {
|
|
1024
|
+
constructor() {
|
|
1025
|
+
this.name = IdGenerator.get();
|
|
1026
|
+
this.zIndex = 1;
|
|
1027
|
+
this.maxZoom = 19;
|
|
1028
|
+
this.minZoom = 0;
|
|
1029
|
+
this.distance = 20;
|
|
1030
|
+
this.bbox = false;
|
|
1031
|
+
}
|
|
1032
|
+
static copy(model) {
|
|
1033
|
+
const result = new ClusterLayerSettings();
|
|
1034
|
+
result.name = model.name;
|
|
1035
|
+
result.maxZoom = model.maxZoom;
|
|
1036
|
+
result.minZoom = model.minZoom;
|
|
1037
|
+
result.zIndex = model.zIndex;
|
|
1038
|
+
result.bbox = model.bbox;
|
|
1039
|
+
result.distance = model.distance;
|
|
1040
|
+
result.style = model.style;
|
|
1041
|
+
return result;
|
|
1042
|
+
}
|
|
1043
|
+
setZIndex(zIndex) {
|
|
1044
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
1045
|
+
}
|
|
1046
|
+
setDistance(distance) {
|
|
1047
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { distance }));
|
|
1048
|
+
}
|
|
1049
|
+
setName(name) {
|
|
1050
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
1051
|
+
}
|
|
1052
|
+
setMaxZoom(maxZoom) {
|
|
1053
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
1054
|
+
}
|
|
1055
|
+
setMinZoom(minZoom) {
|
|
1056
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
1057
|
+
}
|
|
1058
|
+
setBbox(bbox) {
|
|
1059
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { bbox }));
|
|
1060
|
+
}
|
|
1061
|
+
setStyle(style) {
|
|
1062
|
+
return ClusterLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
1063
|
+
}
|
|
1064
|
+
isSame(model) {
|
|
1065
|
+
if (this.maxZoom !== model.maxZoom)
|
|
1066
|
+
return false;
|
|
1067
|
+
if (this.minZoom !== model.minZoom)
|
|
1068
|
+
return false;
|
|
1069
|
+
if (this.zIndex !== model.zIndex)
|
|
1070
|
+
return false;
|
|
1071
|
+
if (this.name !== model.name)
|
|
1072
|
+
return false;
|
|
1073
|
+
if (this.distance !== model.distance)
|
|
1074
|
+
return false;
|
|
1075
|
+
if (this.bbox !== model.bbox)
|
|
1076
|
+
return false;
|
|
1077
|
+
if (this.style !== model.style)
|
|
1078
|
+
return false;
|
|
1079
|
+
return true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
class ClusterLayerManager {
|
|
1084
|
+
constructor(settings, layer, postboy) {
|
|
1085
|
+
this.settings = settings;
|
|
1086
|
+
this.layer = layer;
|
|
1087
|
+
this.postboy = postboy;
|
|
1088
|
+
this.observeClick();
|
|
1089
|
+
}
|
|
1090
|
+
observeClick() {
|
|
1091
|
+
this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
|
|
1092
|
+
var _a, _b;
|
|
1093
|
+
if (((_b = (_a = m.features[this.settings.name]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 1) {
|
|
1094
|
+
this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
|
|
1095
|
+
}
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
class ClusterLayerFactory {
|
|
1101
|
+
build(settings, postboy) {
|
|
1102
|
+
const source = new Vector({
|
|
1103
|
+
strategy: settings.bbox ? bbox : undefined,
|
|
1104
|
+
});
|
|
1105
|
+
const cluster = new Cluster({
|
|
1106
|
+
distance: settings.distance,
|
|
1107
|
+
source: source,
|
|
1108
|
+
geometryFunction: (feature) => {
|
|
1109
|
+
var _a;
|
|
1110
|
+
const geom = feature.getGeometry();
|
|
1111
|
+
if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Point') {
|
|
1112
|
+
return geom;
|
|
1113
|
+
}
|
|
1114
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'Polygon') {
|
|
1115
|
+
return geom === null || geom === void 0 ? void 0 : geom.getInteriorPoint();
|
|
1116
|
+
}
|
|
1117
|
+
else if ((geom === null || geom === void 0 ? void 0 : geom.getType()) == 'MultiPolygon') {
|
|
1118
|
+
return (_a = fromExtent(geom.getExtent())) === null || _a === void 0 ? void 0 : _a.getInteriorPoint();
|
|
1119
|
+
}
|
|
1120
|
+
return undefined;
|
|
1121
|
+
},
|
|
1122
|
+
});
|
|
1123
|
+
const layer = new Vector$1({
|
|
1124
|
+
source: cluster,
|
|
1125
|
+
maxZoom: settings.maxZoom || undefined,
|
|
1126
|
+
minZoom: settings.minZoom || undefined,
|
|
1127
|
+
zIndex: settings.zIndex || 0,
|
|
1128
|
+
});
|
|
1129
|
+
layer.setStyle(this.styleFunc(settings));
|
|
1130
|
+
layer.set('name', settings.name);
|
|
1131
|
+
return new ClusterLayerManager(settings, layer, postboy);
|
|
1132
|
+
}
|
|
1133
|
+
styleFunc(settings) {
|
|
1134
|
+
return (feature) => {
|
|
1135
|
+
const features = feature.get('features');
|
|
1136
|
+
if (!settings.style)
|
|
1137
|
+
return undefined;
|
|
1138
|
+
return settings.style(features.map((f) => (Object.assign({ id: f.getId() }, f.get(MapConstants.FeatureInfo)))));
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
ClusterLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1143
|
+
ClusterLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
|
|
1144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ClusterLayerFactory, decorators: [{
|
|
1145
|
+
type: Injectable,
|
|
1146
|
+
args: [{
|
|
1147
|
+
providedIn: 'root',
|
|
1148
|
+
}]
|
|
1149
|
+
}] });
|
|
1150
|
+
|
|
1151
|
+
class ClusterLayerComponent extends DestructibleComponent {
|
|
1152
|
+
constructor(postboy, factory) {
|
|
1153
|
+
super();
|
|
1154
|
+
this.postboy = postboy;
|
|
1155
|
+
this.factory = factory;
|
|
1156
|
+
this.manager = null;
|
|
1157
|
+
this._settings = new ClusterLayerSettings();
|
|
1158
|
+
this.onDestroy = () => this.removeLayer();
|
|
1159
|
+
}
|
|
1160
|
+
ngOnInit() {
|
|
1161
|
+
this.postboy
|
|
1162
|
+
.subscribe(MapRenderedEvent.ID)
|
|
1163
|
+
.pipe(filter((m) => !!m), first())
|
|
1164
|
+
.subscribe((m) => this.initLayer());
|
|
1165
|
+
}
|
|
1166
|
+
set settings(value) {
|
|
1167
|
+
if (!value || this._settings.isSame(value))
|
|
1168
|
+
return;
|
|
1169
|
+
this._settings = value;
|
|
1170
|
+
this.initLayer();
|
|
1171
|
+
}
|
|
1172
|
+
initLayer() {
|
|
1173
|
+
this.removeLayer();
|
|
1174
|
+
this.manager = this.factory.build(this._settings, this.postboy);
|
|
1175
|
+
this.postboy.fire(new AddLayerCommand(this.manager.layer));
|
|
1176
|
+
}
|
|
1177
|
+
removeLayer() {
|
|
1178
|
+
var _a;
|
|
1179
|
+
if ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.layer)
|
|
1180
|
+
this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
ClusterLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
1184
|
+
ClusterLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ClusterLayerComponent, selector: "lib-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ClusterLayerComponent, decorators: [{
|
|
1186
|
+
type: Component,
|
|
1187
|
+
args: [{ selector: 'lib-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
1188
|
+
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
|
|
1189
|
+
type: Input
|
|
1190
|
+
}] } });
|
|
1191
|
+
|
|
903
1192
|
class MapModule {
|
|
904
1193
|
}
|
|
905
1194
|
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
@@ -909,7 +1198,15 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
|
|
|
909
1198
|
OsmTileLayerComponent,
|
|
910
1199
|
FeatureLayerComponent,
|
|
911
1200
|
MarkersComponent,
|
|
912
|
-
TooltipComponent
|
|
1201
|
+
TooltipComponent,
|
|
1202
|
+
PolygonsComponent,
|
|
1203
|
+
ClusterLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
|
|
1204
|
+
FeatureLayerComponent,
|
|
1205
|
+
MarkersComponent,
|
|
1206
|
+
TileLayerComponent,
|
|
1207
|
+
TooltipComponent,
|
|
1208
|
+
PolygonsComponent,
|
|
1209
|
+
ClusterLayerComponent] });
|
|
913
1210
|
MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
914
1211
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
|
|
915
1212
|
type: NgModule,
|
|
@@ -923,8 +1220,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
923
1220
|
FeatureLayerComponent,
|
|
924
1221
|
MarkersComponent,
|
|
925
1222
|
TooltipComponent,
|
|
1223
|
+
PolygonsComponent,
|
|
1224
|
+
ClusterLayerComponent,
|
|
1225
|
+
],
|
|
1226
|
+
exports: [
|
|
1227
|
+
MapPlateComponent,
|
|
1228
|
+
FeatureLayerComponent,
|
|
1229
|
+
MarkersComponent,
|
|
1230
|
+
TileLayerComponent,
|
|
1231
|
+
TooltipComponent,
|
|
1232
|
+
PolygonsComponent,
|
|
1233
|
+
ClusterLayerComponent,
|
|
926
1234
|
],
|
|
927
|
-
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent, TooltipComponent],
|
|
928
1235
|
}]
|
|
929
1236
|
}] });
|
|
930
1237
|
|
|
@@ -949,6 +1256,37 @@ class MarkerStyleHelper {
|
|
|
949
1256
|
}),
|
|
950
1257
|
});
|
|
951
1258
|
}
|
|
1259
|
+
static withText(style, text) {
|
|
1260
|
+
style.setText(text);
|
|
1261
|
+
return style;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
class PolygonStyleHelper {
|
|
1266
|
+
static simple(fill, stroke, strokeWidth = 1) {
|
|
1267
|
+
return new Style({
|
|
1268
|
+
fill: new Fill({
|
|
1269
|
+
color: fill,
|
|
1270
|
+
}),
|
|
1271
|
+
stroke: new Stroke({
|
|
1272
|
+
color: stroke,
|
|
1273
|
+
width: strokeWidth,
|
|
1274
|
+
}),
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
class TextStyleHelper {
|
|
1280
|
+
static get(text, font, color) {
|
|
1281
|
+
return new Text({
|
|
1282
|
+
text: text,
|
|
1283
|
+
font: font,
|
|
1284
|
+
textAlign: 'center',
|
|
1285
|
+
fill: new Fill({
|
|
1286
|
+
color: color,
|
|
1287
|
+
}),
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
952
1290
|
}
|
|
953
1291
|
|
|
954
1292
|
/*
|
|
@@ -959,5 +1297,5 @@ class MarkerStyleHelper {
|
|
|
959
1297
|
* Generated bundle index. Do not edit.
|
|
960
1298
|
*/
|
|
961
1299
|
|
|
962
|
-
export { CallbackMessage, CloseTooltipCommand, FeatureLayerComponent, FeatureLayerSettings, GenericMessage, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
1300
|
+
export { CallbackMessage, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, FeatureLayerComponent, FeatureLayerSettings, GenericMessage, MapClickEvent, MapLyrs, MapLyrsLabel, MapModule, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings };
|
|
963
1301
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|