@artstesh/maps 4.0.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm2022/map/common/destructible.component.mjs +18 -0
- package/dist/esm2022/map/common/id.generator.mjs +14 -0
- package/dist/esm2022/map/map-plate/features/markers/markers.component.mjs +42 -0
- package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -0
- package/dist/{esm2020 → esm2022}/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +4 -4
- package/dist/{esm2020 → esm2022}/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +6 -7
- package/dist/esm2022/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -0
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +17 -0
- package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +39 -0
- package/dist/esm2022/map/map-plate/map-plate.component.mjs +64 -0
- package/dist/{esm2020 → esm2022}/map/map-plate/map-plate.factory.service.mjs +4 -4
- package/dist/esm2022/map/map.module.mjs +35 -0
- package/dist/esm2022/map/messages/commands/add-layer.command.mjs +13 -0
- package/dist/esm2022/map/messages/commands/clear-layer.command.mjs +13 -0
- package/dist/esm2022/map/messages/commands/place-layer-features.command.mjs +15 -0
- package/dist/esm2022/map/messages/commands/remove-layer.command.mjs +13 -0
- package/dist/esm2022/map/messages/events/map-rendered.event.mjs +13 -0
- package/dist/esm2022/map/messages/generic-message.mjs +12 -0
- package/dist/esm2022/map/models/map-lyrs.enum.mjs +19 -0
- package/dist/esm2022/map/models/map-settings.mjs +51 -0
- package/dist/esm2022/map/models/marker-model.mjs +31 -0
- package/dist/esm2022/map/services/map-management.service.mjs +61 -0
- package/dist/esm2022/map/services/map-postboy.service.mjs +24 -0
- package/dist/esm2022/map/services/map-state.service.mjs +18 -0
- package/dist/esm2022/map/services/message-registrator.service.mjs +24 -0
- package/dist/{esm2020 → esm2022}/map/services/service.collector.mjs +4 -4
- package/dist/esm2022/src/map/common/destructible.component.mjs +18 -0
- package/dist/esm2022/src/map/common/id.generator.mjs +14 -0
- package/dist/esm2022/src/map/map-plate/features/markers/markers.component.mjs +42 -0
- package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -0
- package/dist/{esm2020 → esm2022}/src/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +4 -4
- package/dist/{esm2020 → esm2022}/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +6 -7
- package/dist/esm2022/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -0
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +17 -0
- package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +39 -0
- package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +64 -0
- package/dist/{esm2020 → esm2022}/src/map/map-plate/map-plate.factory.service.mjs +4 -4
- package/dist/esm2022/src/map/map.module.mjs +35 -0
- package/dist/esm2022/src/map/messages/commands/add-layer.command.mjs +13 -0
- package/dist/esm2022/src/map/messages/commands/clear-layer.command.mjs +13 -0
- package/dist/esm2022/src/map/messages/commands/place-layer-features.command.mjs +15 -0
- package/dist/esm2022/src/map/messages/commands/remove-layer.command.mjs +13 -0
- package/dist/esm2022/src/map/messages/events/map-rendered.event.mjs +13 -0
- package/dist/esm2022/src/map/messages/generic-message.mjs +12 -0
- package/dist/esm2022/src/map/models/map-lyrs.enum.mjs +19 -0
- package/dist/esm2022/src/map/models/map-settings.mjs +51 -0
- package/dist/esm2022/src/map/models/marker-model.mjs +31 -0
- package/dist/esm2022/src/map/services/map-management.service.mjs +61 -0
- package/dist/esm2022/src/map/services/map-postboy.service.mjs +24 -0
- package/dist/esm2022/src/map/services/map-state.service.mjs +18 -0
- package/dist/esm2022/src/map/services/message-registrator.service.mjs +24 -0
- package/dist/{esm2020 → esm2022}/src/map/services/service.collector.mjs +4 -4
- package/dist/{fesm2020 → fesm2022}/maps-components-src-map.mjs +172 -256
- package/dist/fesm2022/maps-components-src-map.mjs.map +1 -0
- package/dist/{fesm2020 → fesm2022}/maps-components.mjs +172 -256
- package/dist/fesm2022/maps-components.mjs.map +1 -0
- package/dist/map/map-plate/features/markers/markers.component.d.ts +1 -1
- package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +1 -1
- package/dist/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +1 -1
- package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +5 -14
- package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +2 -3
- package/dist/map/map-plate/map-plate.component.d.ts +1 -1
- package/dist/map/map.module.d.ts +1 -1
- package/dist/map/messages/commands/clear-layer.command.d.ts +7 -0
- package/dist/map/services/map-management.service.d.ts +1 -2
- package/dist/package.json +9 -17
- package/dist/src/map/map-plate/features/markers/markers.component.d.ts +1 -1
- package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +1 -1
- package/dist/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +1 -1
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +5 -14
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +2 -3
- package/dist/src/map/map-plate/map-plate.component.d.ts +1 -1
- package/dist/src/map/map.module.d.ts +1 -1
- package/dist/src/map/messages/commands/clear-layer.command.d.ts +7 -0
- package/dist/src/map/services/map-management.service.d.ts +1 -2
- package/package.json +22 -26
- package/dist/esm2020/map/common/destructible.component.mjs +0 -19
- package/dist/esm2020/map/common/id.generator.mjs +0 -14
- package/dist/esm2020/map/map-plate/features/markers/markers.component.mjs +0 -41
- package/dist/esm2020/map/map-plate/layers/feature-layer/feature-layer.component.mjs +0 -50
- package/dist/esm2020/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +0 -55
- package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.component.mjs +0 -49
- package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +0 -50
- package/dist/esm2020/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +0 -47
- package/dist/esm2020/map/map-plate/map-plate.component.mjs +0 -59
- package/dist/esm2020/map/map.module.mjs +0 -35
- package/dist/esm2020/map/messages/commands/add-layer.command.mjs +0 -12
- package/dist/esm2020/map/messages/commands/add-tile.command.mjs +0 -12
- package/dist/esm2020/map/messages/commands/place-layer-features.command.mjs +0 -13
- package/dist/esm2020/map/messages/commands/remove-layer.command.mjs +0 -12
- package/dist/esm2020/map/messages/commands/remove-tile.command.mjs +0 -12
- package/dist/esm2020/map/messages/events/map-rendered.event.mjs +0 -12
- package/dist/esm2020/map/messages/generic-message.mjs +0 -15
- package/dist/esm2020/map/models/map-lyrs.enum.mjs +0 -19
- package/dist/esm2020/map/models/map-settings.mjs +0 -53
- package/dist/esm2020/map/models/marker-model.mjs +0 -26
- package/dist/esm2020/map/services/map-management.service.mjs +0 -70
- package/dist/esm2020/map/services/map-postboy.service.mjs +0 -26
- package/dist/esm2020/map/services/map-state.service.mjs +0 -16
- package/dist/esm2020/map/services/message-registrator.service.mjs +0 -26
- package/dist/esm2020/src/map/common/destructible.component.mjs +0 -19
- package/dist/esm2020/src/map/common/id.generator.mjs +0 -14
- package/dist/esm2020/src/map/map-plate/features/markers/markers.component.mjs +0 -41
- package/dist/esm2020/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +0 -50
- package/dist/esm2020/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +0 -55
- package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +0 -49
- package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +0 -50
- package/dist/esm2020/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +0 -47
- package/dist/esm2020/src/map/map-plate/map-plate.component.mjs +0 -59
- package/dist/esm2020/src/map/map.module.mjs +0 -35
- package/dist/esm2020/src/map/messages/commands/add-layer.command.mjs +0 -12
- package/dist/esm2020/src/map/messages/commands/add-tile.command.mjs +0 -12
- package/dist/esm2020/src/map/messages/commands/place-layer-features.command.mjs +0 -13
- package/dist/esm2020/src/map/messages/commands/remove-layer.command.mjs +0 -12
- package/dist/esm2020/src/map/messages/commands/remove-tile.command.mjs +0 -12
- package/dist/esm2020/src/map/messages/events/map-rendered.event.mjs +0 -12
- package/dist/esm2020/src/map/messages/generic-message.mjs +0 -15
- package/dist/esm2020/src/map/models/map-lyrs.enum.mjs +0 -19
- package/dist/esm2020/src/map/models/map-settings.mjs +0 -53
- package/dist/esm2020/src/map/models/marker-model.mjs +0 -26
- package/dist/esm2020/src/map/services/map-management.service.mjs +0 -70
- package/dist/esm2020/src/map/services/map-postboy.service.mjs +0 -26
- package/dist/esm2020/src/map/services/map-state.service.mjs +0 -16
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +0 -26
- package/dist/fesm2015/maps-components-src-map.mjs +0 -800
- package/dist/fesm2015/maps-components-src-map.mjs.map +0 -1
- package/dist/fesm2015/maps-components.mjs +0 -804
- package/dist/fesm2015/maps-components.mjs.map +0 -1
- package/dist/fesm2020/maps-components-src-map.mjs.map +0 -1
- package/dist/fesm2020/maps-components.mjs.map +0 -1
- package/dist/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +0 -11
- package/dist/map/messages/commands/add-tile.command.d.ts +0 -9
- package/dist/map/messages/commands/remove-tile.command.d.ts +0 -9
- package/dist/src/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +0 -11
- package/dist/src/map/messages/commands/add-tile.command.d.ts +0 -9
- package/dist/src/map/messages/commands/remove-tile.command.d.ts +0 -9
- /package/dist/{esm2020 → esm2022}/map/helpers/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/helpers/marker-style.helper.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/map-plate/features/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/map-plate/layers/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/messages/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/models/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/map/public-api.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/maps-components.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/public-api.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/helpers/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/helpers/marker-style.helper.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/map-plate/features/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/map-plate/layers/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/maps-components-src-map.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/messages/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/models/index.mjs +0 -0
- /package/dist/{esm2020 → esm2022}/src/map/public-api.mjs +0 -0
|
@@ -1,804 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Injectable, ChangeDetectionStrategy, Input, NgModule } from '@angular/core';
|
|
3
|
-
import * as i4 from '@angular/common';
|
|
4
|
-
import { CommonModule } from '@angular/common';
|
|
5
|
-
import { Feature } from 'ol';
|
|
6
|
-
import { Point } from 'ol/geom';
|
|
7
|
-
import { useGeographic, get } from 'ol/proj';
|
|
8
|
-
import { Subject, ReplaySubject } from 'rxjs';
|
|
9
|
-
import Map from 'ol/Map';
|
|
10
|
-
import View from 'ol/View';
|
|
11
|
-
import TileLayer from 'ol/layer/Tile';
|
|
12
|
-
import OSM from 'ol/source/OSM';
|
|
13
|
-
import { filter, first } from 'rxjs/operators';
|
|
14
|
-
import { XYZ, Vector } from 'ol/source';
|
|
15
|
-
import { Vector as Vector$1 } from 'ol/layer';
|
|
16
|
-
import Style from 'ol/style/Style';
|
|
17
|
-
import { Icon, Circle, Fill, Stroke } from 'ol/style';
|
|
18
|
-
|
|
19
|
-
class DestructibleComponent {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.subs = [];
|
|
22
|
-
}
|
|
23
|
-
ngOnDestroy() {
|
|
24
|
-
this.subs.forEach((s) => s.unsubscribe());
|
|
25
|
-
if (this.onDestroy)
|
|
26
|
-
this.onDestroy();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
DestructibleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DestructibleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
30
|
-
DestructibleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: DestructibleComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
|
|
31
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: DestructibleComponent, decorators: [{
|
|
32
|
-
type: Component,
|
|
33
|
-
args: [{ template: '' }]
|
|
34
|
-
}] });
|
|
35
|
-
|
|
36
|
-
var MapLyrs;
|
|
37
|
-
(function (MapLyrs) {
|
|
38
|
-
MapLyrs[MapLyrs["Hybrid"] = 1] = "Hybrid";
|
|
39
|
-
MapLyrs[MapLyrs["Satellite"] = 2] = "Satellite";
|
|
40
|
-
MapLyrs[MapLyrs["Streets"] = 3] = "Streets";
|
|
41
|
-
MapLyrs[MapLyrs["Terrain"] = 4] = "Terrain";
|
|
42
|
-
})(MapLyrs || (MapLyrs = {}));
|
|
43
|
-
class MapLyrsLabel {
|
|
44
|
-
static get(lyrs) {
|
|
45
|
-
return MapLyrsLabel.lyrs[lyrs];
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
MapLyrsLabel.lyrs = {
|
|
49
|
-
[MapLyrs.Hybrid]: 's,h',
|
|
50
|
-
[MapLyrs.Satellite]: 's',
|
|
51
|
-
[MapLyrs.Streets]: 'm',
|
|
52
|
-
[MapLyrs.Terrain]: 'p',
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
class MapSettings {
|
|
56
|
-
constructor() {
|
|
57
|
-
this.center = [0, 0];
|
|
58
|
-
this.maxZoom = 19;
|
|
59
|
-
this.minZoom = 0;
|
|
60
|
-
this.zoom = 4;
|
|
61
|
-
this.lyrs = MapLyrs.Hybrid;
|
|
62
|
-
this.language = 'en';
|
|
63
|
-
}
|
|
64
|
-
static copy(model) {
|
|
65
|
-
const result = new MapSettings();
|
|
66
|
-
result.center = model.center;
|
|
67
|
-
result.maxZoom = model.maxZoom;
|
|
68
|
-
result.minZoom = model.minZoom;
|
|
69
|
-
result.zoom = model.zoom;
|
|
70
|
-
result.lyrs = model.lyrs;
|
|
71
|
-
result.language = model.language;
|
|
72
|
-
return result;
|
|
73
|
-
}
|
|
74
|
-
setCenter(center) {
|
|
75
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { center }));
|
|
76
|
-
}
|
|
77
|
-
setMaxZoom(maxZoom) {
|
|
78
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
79
|
-
}
|
|
80
|
-
setMinZoom(minZoom) {
|
|
81
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
82
|
-
}
|
|
83
|
-
setZoom(zoom) {
|
|
84
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { zoom }));
|
|
85
|
-
}
|
|
86
|
-
setLyrs(lyrs) {
|
|
87
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { lyrs }));
|
|
88
|
-
}
|
|
89
|
-
setLanguage(language) {
|
|
90
|
-
return MapSettings.copy(Object.assign(Object.assign({}, this), { language }));
|
|
91
|
-
}
|
|
92
|
-
isSame(model) {
|
|
93
|
-
if (this.maxZoom !== model.maxZoom)
|
|
94
|
-
return false;
|
|
95
|
-
if (this.minZoom !== model.minZoom)
|
|
96
|
-
return false;
|
|
97
|
-
if (this.zoom !== model.zoom)
|
|
98
|
-
return false;
|
|
99
|
-
if (this.lyrs !== model.lyrs)
|
|
100
|
-
return false;
|
|
101
|
-
if (this.language !== model.language)
|
|
102
|
-
return false;
|
|
103
|
-
return this.center.length !== model.center.length || !!this.center.filter((c, i) => c !== model.center[i]);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
class IdGenerator {
|
|
108
|
-
static get() {
|
|
109
|
-
let result = [];
|
|
110
|
-
for (let i = 0; i < 7; i++) {
|
|
111
|
-
result.push(IdGenerator.collection
|
|
112
|
-
.sort(() => 0.5 - Math.random())
|
|
113
|
-
.slice(0, 5)
|
|
114
|
-
.join(''));
|
|
115
|
-
}
|
|
116
|
-
return result.join('-');
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
IdGenerator.collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
|
|
120
|
-
|
|
121
|
-
class MarkerModel {
|
|
122
|
-
constructor(lat, lng, id, info) {
|
|
123
|
-
this.lat = lat;
|
|
124
|
-
this.lng = lng;
|
|
125
|
-
this.id = id;
|
|
126
|
-
this.info = info;
|
|
127
|
-
if (id == null)
|
|
128
|
-
this.id = IdGenerator.get();
|
|
129
|
-
this._feature = this.getFeature();
|
|
130
|
-
}
|
|
131
|
-
get feature() {
|
|
132
|
-
return this._feature;
|
|
133
|
-
}
|
|
134
|
-
getFeature() {
|
|
135
|
-
const feature = new Feature(new Point([this.lng, this.lat]));
|
|
136
|
-
feature.setId(this.id);
|
|
137
|
-
if (this.info) {
|
|
138
|
-
Object.keys(this.info).forEach((k) => feature.set(k, this.info[k]));
|
|
139
|
-
}
|
|
140
|
-
return feature;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
class GenericMessage {
|
|
145
|
-
}
|
|
146
|
-
class CallbackMessage extends GenericMessage {
|
|
147
|
-
constructor() {
|
|
148
|
-
super(...arguments);
|
|
149
|
-
this.result$ = new Subject();
|
|
150
|
-
this.result = this.result$.asObservable();
|
|
151
|
-
}
|
|
152
|
-
finish(value) {
|
|
153
|
-
this.result$.next(value);
|
|
154
|
-
this.result$.complete();
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
class MapRenderedEvent extends GenericMessage {
|
|
159
|
-
constructor(map) {
|
|
160
|
-
super();
|
|
161
|
-
this.map = map;
|
|
162
|
-
}
|
|
163
|
-
get id() {
|
|
164
|
-
return MapRenderedEvent.ID;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
MapRenderedEvent.ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
|
|
168
|
-
|
|
169
|
-
class AddLayerCommand extends GenericMessage {
|
|
170
|
-
constructor(layer) {
|
|
171
|
-
super();
|
|
172
|
-
this.layer = layer;
|
|
173
|
-
}
|
|
174
|
-
get id() {
|
|
175
|
-
return AddLayerCommand.ID;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
AddLayerCommand.ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
|
|
179
|
-
|
|
180
|
-
class PlaceLayerFeaturesCommand extends GenericMessage {
|
|
181
|
-
constructor(layer, features) {
|
|
182
|
-
super();
|
|
183
|
-
this.layer = layer;
|
|
184
|
-
this.features = features;
|
|
185
|
-
}
|
|
186
|
-
get id() {
|
|
187
|
-
return PlaceLayerFeaturesCommand.ID;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
PlaceLayerFeaturesCommand.ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
|
|
191
|
-
|
|
192
|
-
class RemoveLayerCommand extends GenericMessage {
|
|
193
|
-
constructor(layer) {
|
|
194
|
-
super();
|
|
195
|
-
this.layer = layer;
|
|
196
|
-
}
|
|
197
|
-
get id() {
|
|
198
|
-
return RemoveLayerCommand.ID;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
RemoveLayerCommand.ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
|
|
202
|
-
|
|
203
|
-
class AddTileCommand extends GenericMessage {
|
|
204
|
-
constructor(layer) {
|
|
205
|
-
super();
|
|
206
|
-
this.layer = layer;
|
|
207
|
-
}
|
|
208
|
-
get id() {
|
|
209
|
-
return AddTileCommand.ID;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
AddTileCommand.ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
|
|
213
|
-
|
|
214
|
-
class RemoveTileCommand extends GenericMessage {
|
|
215
|
-
constructor(layer) {
|
|
216
|
-
super();
|
|
217
|
-
this.layer = layer;
|
|
218
|
-
}
|
|
219
|
-
get id() {
|
|
220
|
-
return RemoveTileCommand.ID;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
RemoveTileCommand.ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
|
|
224
|
-
|
|
225
|
-
class MapPostboyService {
|
|
226
|
-
constructor() {
|
|
227
|
-
this.applications = {};
|
|
228
|
-
}
|
|
229
|
-
register(id, sub) {
|
|
230
|
-
this.applications[id] = sub;
|
|
231
|
-
}
|
|
232
|
-
subscribe(id) {
|
|
233
|
-
if (!this.applications[id])
|
|
234
|
-
throw new Error(`There is no event with id ${id}`);
|
|
235
|
-
return this.applications[id].asObservable();
|
|
236
|
-
}
|
|
237
|
-
fire(message) {
|
|
238
|
-
if (!this.applications[message.id])
|
|
239
|
-
throw new Error(`There is no event with id ${message.id}`);
|
|
240
|
-
this.applications[message.id].next(message);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
MapPostboyService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
244
|
-
MapPostboyService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService });
|
|
245
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPostboyService, decorators: [{
|
|
246
|
-
type: Injectable
|
|
247
|
-
}] });
|
|
248
|
-
|
|
249
|
-
class MessageRegistratorService {
|
|
250
|
-
constructor(service) {
|
|
251
|
-
service.register(MapRenderedEvent.ID, new ReplaySubject(1));
|
|
252
|
-
service.register(AddLayerCommand.ID, new Subject());
|
|
253
|
-
service.register(PlaceLayerFeaturesCommand.ID, new ReplaySubject(1));
|
|
254
|
-
service.register(RemoveLayerCommand.ID, new Subject());
|
|
255
|
-
service.register(AddTileCommand.ID, new Subject());
|
|
256
|
-
service.register(RemoveTileCommand.ID, new Subject());
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
MessageRegistratorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
260
|
-
MessageRegistratorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService });
|
|
261
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MessageRegistratorService, decorators: [{
|
|
262
|
-
type: Injectable
|
|
263
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
264
|
-
|
|
265
|
-
class MapStateService {
|
|
266
|
-
constructor(postboy) {
|
|
267
|
-
this.postboy = postboy;
|
|
268
|
-
postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => (this.map = m));
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
MapStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
272
|
-
MapStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapStateService });
|
|
273
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapStateService, decorators: [{
|
|
274
|
-
type: Injectable
|
|
275
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
276
|
-
|
|
277
|
-
class MapManagementService {
|
|
278
|
-
constructor(postboy) {
|
|
279
|
-
this.postboy = postboy;
|
|
280
|
-
this.layers = {};
|
|
281
|
-
this.observeMapRender();
|
|
282
|
-
this.observeAddLayer();
|
|
283
|
-
this.observeRemoveLayer();
|
|
284
|
-
this.observePlaceFeatures();
|
|
285
|
-
this.observeAddTile();
|
|
286
|
-
this.observeRemoveTile();
|
|
287
|
-
}
|
|
288
|
-
observeRemoveTile() {
|
|
289
|
-
this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
|
|
290
|
-
if (!this.map)
|
|
291
|
-
return;
|
|
292
|
-
this.map.removeLayer(c.layer);
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
observeAddTile() {
|
|
296
|
-
this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
|
|
297
|
-
if (!this.map)
|
|
298
|
-
return;
|
|
299
|
-
this.map.addLayer(c.layer);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
observeMapRender() {
|
|
303
|
-
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
304
|
-
this.map = m.map;
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
observeAddLayer() {
|
|
308
|
-
this.postboy.subscribe(AddLayerCommand.ID).subscribe((c) => {
|
|
309
|
-
if (!this.map)
|
|
310
|
-
return;
|
|
311
|
-
this.layers[c.layer.get('name')] = c.layer;
|
|
312
|
-
this.map.addLayer(c.layer);
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
observePlaceFeatures() {
|
|
316
|
-
this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
|
|
317
|
-
var _a, _b, _c;
|
|
318
|
-
if (!this.layers[c.layer])
|
|
319
|
-
return;
|
|
320
|
-
(_b = (_a = this.layers[c.layer]) === null || _a === void 0 ? void 0 : _a.getSource()) === null || _b === void 0 ? void 0 : _b.clear();
|
|
321
|
-
(_c = this.layers[c.layer].getSource()) === null || _c === void 0 ? void 0 : _c.addFeatures(c.features);
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
observeRemoveLayer() {
|
|
325
|
-
this.postboy.subscribe(RemoveLayerCommand.ID).subscribe((c) => {
|
|
326
|
-
if (!this.map)
|
|
327
|
-
return;
|
|
328
|
-
delete this.layers[c.layer.get('name')];
|
|
329
|
-
this.map.removeLayer(c.layer);
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
MapManagementService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
334
|
-
MapManagementService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapManagementService });
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapManagementService, decorators: [{
|
|
336
|
-
type: Injectable
|
|
337
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
|
|
338
|
-
|
|
339
|
-
class ServiceCollector {
|
|
340
|
-
constructor(registrator, management, state) { }
|
|
341
|
-
}
|
|
342
|
-
ServiceCollector.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceCollector, deps: [{ token: MessageRegistratorService }, { token: MapManagementService }, { token: MapStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
343
|
-
ServiceCollector.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceCollector });
|
|
344
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ServiceCollector, decorators: [{
|
|
345
|
-
type: Injectable
|
|
346
|
-
}], ctorParameters: function () { return [{ type: MessageRegistratorService }, { type: MapManagementService }, { type: MapStateService }]; } });
|
|
347
|
-
|
|
348
|
-
class MapPlateFactory {
|
|
349
|
-
build(settings) {
|
|
350
|
-
return new Map({
|
|
351
|
-
controls: [],
|
|
352
|
-
view: new View({
|
|
353
|
-
center: (settings === null || settings === void 0 ? void 0 : settings.center) || [0, 0],
|
|
354
|
-
zoom: (settings === null || settings === void 0 ? void 0 : settings.zoom) || 4,
|
|
355
|
-
minZoom: (settings === null || settings === void 0 ? void 0 : settings.minZoom) || 0,
|
|
356
|
-
maxZoom: (settings === null || settings === void 0 ? void 0 : settings.maxZoom) || 19,
|
|
357
|
-
}),
|
|
358
|
-
layers: [],
|
|
359
|
-
});
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
MapPlateFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
363
|
-
MapPlateFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
|
|
364
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateFactory, decorators: [{
|
|
365
|
-
type: Injectable,
|
|
366
|
-
args: [{
|
|
367
|
-
providedIn: 'root',
|
|
368
|
-
}]
|
|
369
|
-
}] });
|
|
370
|
-
|
|
371
|
-
class OsmTileLayerComponent extends DestructibleComponent {
|
|
372
|
-
constructor() {
|
|
373
|
-
super();
|
|
374
|
-
this._url = '';
|
|
375
|
-
}
|
|
376
|
-
set url(value) {
|
|
377
|
-
if (!value || this._url === value)
|
|
378
|
-
return;
|
|
379
|
-
this._url = value;
|
|
380
|
-
this.initLayer();
|
|
381
|
-
}
|
|
382
|
-
set map(value) {
|
|
383
|
-
if (!value || this._map === value)
|
|
384
|
-
return;
|
|
385
|
-
this._map = value;
|
|
386
|
-
this.initLayer();
|
|
387
|
-
}
|
|
388
|
-
ngOnInit() { }
|
|
389
|
-
ngOnDestroy() {
|
|
390
|
-
var _a, _b;
|
|
391
|
-
if (this.layer) {
|
|
392
|
-
(_a = this._map) === null || _a === void 0 ? void 0 : _a.removeLayer(this.layer);
|
|
393
|
-
}
|
|
394
|
-
// @ts-ignore
|
|
395
|
-
(_b = this.layer) === null || _b === void 0 ? void 0 : _b.setMap(null);
|
|
396
|
-
}
|
|
397
|
-
initLayer() {
|
|
398
|
-
if (!this._url || !this._map)
|
|
399
|
-
return;
|
|
400
|
-
if (this.layer)
|
|
401
|
-
this._map.removeLayer(this.layer);
|
|
402
|
-
this.layer = new TileLayer({
|
|
403
|
-
source: new OSM({
|
|
404
|
-
url: this._url,
|
|
405
|
-
}),
|
|
406
|
-
});
|
|
407
|
-
this.layer.set('name', 'osm-tile-layer');
|
|
408
|
-
this._map.addLayer(this.layer);
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
OsmTileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
412
|
-
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 });
|
|
413
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
|
|
414
|
-
type: Component,
|
|
415
|
-
args: [{ selector: 'lib-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
416
|
-
}], ctorParameters: function () { return []; }, propDecorators: { url: [{
|
|
417
|
-
type: Input
|
|
418
|
-
}], map: [{
|
|
419
|
-
type: Input
|
|
420
|
-
}] } });
|
|
421
|
-
|
|
422
|
-
class MapPlateComponent extends DestructibleComponent {
|
|
423
|
-
constructor(elementRef, postboy, mapFactory, registrator, detector) {
|
|
424
|
-
super();
|
|
425
|
-
this.elementRef = elementRef;
|
|
426
|
-
this.postboy = postboy;
|
|
427
|
-
this.mapFactory = mapFactory;
|
|
428
|
-
this.detector = detector;
|
|
429
|
-
this.osmUrl = '';
|
|
430
|
-
this._settings = new MapSettings();
|
|
431
|
-
}
|
|
432
|
-
set settings(value) {
|
|
433
|
-
if (!value || this._settings.isSame(value))
|
|
434
|
-
return;
|
|
435
|
-
this._settings = value;
|
|
436
|
-
this.setOsm();
|
|
437
|
-
}
|
|
438
|
-
ngOnInit() {
|
|
439
|
-
useGeographic();
|
|
440
|
-
this.map = this.mapFactory.build(this._settings);
|
|
441
|
-
this.map.setTarget(this.elementRef.nativeElement);
|
|
442
|
-
this.detector.detectChanges();
|
|
443
|
-
this.map.once('postrender', () => {
|
|
444
|
-
this.map.updateSize();
|
|
445
|
-
this.postboy.fire(new MapRenderedEvent(this.map));
|
|
446
|
-
});
|
|
447
|
-
this.setOsm();
|
|
448
|
-
}
|
|
449
|
-
setOsm() {
|
|
450
|
-
if (!this.map)
|
|
451
|
-
return;
|
|
452
|
-
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}`;
|
|
453
|
-
this.detector.detectChanges();
|
|
454
|
-
this.map.updateSize();
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
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: ServiceCollector }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
458
|
-
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, ServiceCollector], 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 });
|
|
459
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapPlateComponent, decorators: [{
|
|
460
|
-
type: Component,
|
|
461
|
-
args: [{ selector: 'lib-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [MessageRegistratorService, MapStateService, MapManagementService, ServiceCollector], 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"] }]
|
|
462
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: ServiceCollector }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
|
|
463
|
-
type: Input
|
|
464
|
-
}] } });
|
|
465
|
-
|
|
466
|
-
class TileLayerSettings {
|
|
467
|
-
constructor() {
|
|
468
|
-
this.maxZoom = 19;
|
|
469
|
-
this.minZoom = 0;
|
|
470
|
-
this.opacity = 0.6;
|
|
471
|
-
this.url = '';
|
|
472
|
-
this.projection = 'EPSG:3857';
|
|
473
|
-
}
|
|
474
|
-
static copy(model) {
|
|
475
|
-
const result = new TileLayerSettings();
|
|
476
|
-
result.maxZoom = model.maxZoom;
|
|
477
|
-
result.minZoom = model.minZoom;
|
|
478
|
-
result.projection = model.projection;
|
|
479
|
-
result.opacity = model.opacity;
|
|
480
|
-
result.url = model.url;
|
|
481
|
-
return result;
|
|
482
|
-
}
|
|
483
|
-
setUrl(url) {
|
|
484
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
|
|
485
|
-
}
|
|
486
|
-
setMaxZoom(maxZoom) {
|
|
487
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
488
|
-
}
|
|
489
|
-
setMinZoom(minZoom) {
|
|
490
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
491
|
-
}
|
|
492
|
-
setOpacity(opacity) {
|
|
493
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
|
|
494
|
-
}
|
|
495
|
-
setProjection(projection) {
|
|
496
|
-
return TileLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
|
|
497
|
-
}
|
|
498
|
-
isSame(model) {
|
|
499
|
-
if (this.maxZoom !== model.maxZoom)
|
|
500
|
-
return false;
|
|
501
|
-
if (this.minZoom !== model.minZoom)
|
|
502
|
-
return false;
|
|
503
|
-
if (this.url !== model.url)
|
|
504
|
-
return false;
|
|
505
|
-
if (this.projection !== model.projection)
|
|
506
|
-
return false;
|
|
507
|
-
if (this.opacity !== model.opacity)
|
|
508
|
-
return false;
|
|
509
|
-
return true;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
class TileLayerFactory {
|
|
514
|
-
build(settings) {
|
|
515
|
-
const source = new XYZ({
|
|
516
|
-
tileSize: 256,
|
|
517
|
-
maxZoom: settings.maxZoom || 14,
|
|
518
|
-
minZoom: settings.minZoom || 1,
|
|
519
|
-
projection: get(settings.projection),
|
|
520
|
-
tileUrlFunction: this.getTileFunc(settings),
|
|
521
|
-
crossOrigin: 'Anonymous',
|
|
522
|
-
});
|
|
523
|
-
return new TileLayer({ source, opacity: settings.opacity });
|
|
524
|
-
}
|
|
525
|
-
getTileFunc(settings) {
|
|
526
|
-
return (tileCoord) => {
|
|
527
|
-
const zoom = tileCoord[0];
|
|
528
|
-
const x = tileCoord[1];
|
|
529
|
-
const y = tileCoord[2];
|
|
530
|
-
const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
|
|
531
|
-
const bound = 1 << zoom;
|
|
532
|
-
return settings.url
|
|
533
|
-
.replace('{x}', String((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.x) || x))
|
|
534
|
-
.replace('{z}', String(zoom))
|
|
535
|
-
.replace('{y}', String(bound - ((normalizedCoord === null || normalizedCoord === void 0 ? void 0 : normalizedCoord.y) || y) - 1));
|
|
536
|
-
};
|
|
537
|
-
}
|
|
538
|
-
getNormalizedCoord(coord, zoom) {
|
|
539
|
-
const y = coord.y;
|
|
540
|
-
let x = coord.x;
|
|
541
|
-
const tileRange = 1 << zoom;
|
|
542
|
-
if (y < 0 || y >= tileRange)
|
|
543
|
-
return null;
|
|
544
|
-
if (x < 0 || x >= tileRange)
|
|
545
|
-
x = ((x % tileRange) + tileRange) % tileRange;
|
|
546
|
-
return { x: x, y: y };
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
TileLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
550
|
-
TileLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TileLayerFactory, providedIn: 'root' });
|
|
551
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TileLayerFactory, decorators: [{
|
|
552
|
-
type: Injectable,
|
|
553
|
-
args: [{
|
|
554
|
-
providedIn: 'root',
|
|
555
|
-
}]
|
|
556
|
-
}] });
|
|
557
|
-
|
|
558
|
-
class TileLayerComponent extends DestructibleComponent {
|
|
559
|
-
constructor(postboy, factory) {
|
|
560
|
-
super();
|
|
561
|
-
this.postboy = postboy;
|
|
562
|
-
this.factory = factory;
|
|
563
|
-
this._settings = new TileLayerSettings();
|
|
564
|
-
this.onDestroy = () => this.removeLayer();
|
|
565
|
-
}
|
|
566
|
-
ngOnInit() {
|
|
567
|
-
this.postboy
|
|
568
|
-
.subscribe(MapRenderedEvent.ID)
|
|
569
|
-
.pipe(filter((m) => !!m), first())
|
|
570
|
-
.subscribe((m) => this.initLayer());
|
|
571
|
-
}
|
|
572
|
-
set settings(value) {
|
|
573
|
-
if (!value || this._settings.isSame(value))
|
|
574
|
-
return;
|
|
575
|
-
this._settings = value;
|
|
576
|
-
this.initLayer();
|
|
577
|
-
}
|
|
578
|
-
initLayer() {
|
|
579
|
-
this.removeLayer();
|
|
580
|
-
this.layer = this.factory.build(this._settings);
|
|
581
|
-
this.postboy.fire(new AddTileCommand(this.layer));
|
|
582
|
-
}
|
|
583
|
-
removeLayer() {
|
|
584
|
-
if (this.layer)
|
|
585
|
-
this.postboy.fire(new RemoveTileCommand(this.layer));
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
TileLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TileLayerComponent, deps: [{ token: MapPostboyService }, { token: TileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
589
|
-
TileLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: TileLayerComponent, selector: "lib-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
590
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: TileLayerComponent, decorators: [{
|
|
591
|
-
type: Component,
|
|
592
|
-
args: [{ selector: 'lib-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
593
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: TileLayerFactory }]; }, propDecorators: { settings: [{
|
|
594
|
-
type: Input
|
|
595
|
-
}] } });
|
|
596
|
-
|
|
597
|
-
class FeatureLayerSettings {
|
|
598
|
-
constructor() {
|
|
599
|
-
this.name = IdGenerator.get();
|
|
600
|
-
this.zIndex = 1;
|
|
601
|
-
this.maxZoom = 19;
|
|
602
|
-
this.minZoom = 0;
|
|
603
|
-
}
|
|
604
|
-
static copy(model) {
|
|
605
|
-
const result = new FeatureLayerSettings();
|
|
606
|
-
result.name = model.name;
|
|
607
|
-
result.maxZoom = model.maxZoom;
|
|
608
|
-
result.minZoom = model.minZoom;
|
|
609
|
-
result.zIndex = model.zIndex;
|
|
610
|
-
result.style = model.style;
|
|
611
|
-
return result;
|
|
612
|
-
}
|
|
613
|
-
setZIndex(zIndex) {
|
|
614
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { zIndex }));
|
|
615
|
-
}
|
|
616
|
-
setName(name) {
|
|
617
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { name }));
|
|
618
|
-
}
|
|
619
|
-
setMaxZoom(maxZoom) {
|
|
620
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
|
|
621
|
-
}
|
|
622
|
-
setMinZoom(minZoom) {
|
|
623
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
|
|
624
|
-
}
|
|
625
|
-
setStyle(style) {
|
|
626
|
-
return FeatureLayerSettings.copy(Object.assign(Object.assign({}, this), { style }));
|
|
627
|
-
}
|
|
628
|
-
isSame(model) {
|
|
629
|
-
if (this.maxZoom !== model.maxZoom)
|
|
630
|
-
return false;
|
|
631
|
-
if (this.minZoom !== model.minZoom)
|
|
632
|
-
return false;
|
|
633
|
-
if (this.zIndex !== model.zIndex)
|
|
634
|
-
return false;
|
|
635
|
-
if (this.name !== model.name)
|
|
636
|
-
return false;
|
|
637
|
-
if (this.style !== model.style)
|
|
638
|
-
return false;
|
|
639
|
-
return true;
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
class FeatureLayerFactory {
|
|
644
|
-
build(settings) {
|
|
645
|
-
const source = new Vector({});
|
|
646
|
-
const layer = new Vector$1({
|
|
647
|
-
source: source,
|
|
648
|
-
maxZoom: settings.maxZoom,
|
|
649
|
-
minZoom: settings.minZoom,
|
|
650
|
-
zIndex: settings.zIndex,
|
|
651
|
-
});
|
|
652
|
-
if (settings.style)
|
|
653
|
-
layer.setStyle(settings.style);
|
|
654
|
-
layer.set('name', settings.name);
|
|
655
|
-
return layer;
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
FeatureLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
659
|
-
FeatureLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureLayerFactory, providedIn: 'root' });
|
|
660
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureLayerFactory, decorators: [{
|
|
661
|
-
type: Injectable,
|
|
662
|
-
args: [{
|
|
663
|
-
providedIn: 'root',
|
|
664
|
-
}]
|
|
665
|
-
}] });
|
|
666
|
-
|
|
667
|
-
class FeatureLayerComponent extends DestructibleComponent {
|
|
668
|
-
constructor(postboy, factory) {
|
|
669
|
-
super();
|
|
670
|
-
this.postboy = postboy;
|
|
671
|
-
this.factory = factory;
|
|
672
|
-
this.layer = null;
|
|
673
|
-
this._settings = new FeatureLayerSettings();
|
|
674
|
-
this.onDestroy = () => this.removeLayer();
|
|
675
|
-
}
|
|
676
|
-
ngOnInit() {
|
|
677
|
-
this.postboy
|
|
678
|
-
.subscribe(MapRenderedEvent.ID)
|
|
679
|
-
.pipe(filter((m) => !!m), first())
|
|
680
|
-
.subscribe((m) => this.initLayer());
|
|
681
|
-
}
|
|
682
|
-
set settings(value) {
|
|
683
|
-
if (!value || this._settings.isSame(value))
|
|
684
|
-
return;
|
|
685
|
-
this._settings = value;
|
|
686
|
-
this.initLayer();
|
|
687
|
-
}
|
|
688
|
-
initLayer() {
|
|
689
|
-
this.removeLayer();
|
|
690
|
-
this.layer = this.factory.build(this._settings);
|
|
691
|
-
this.postboy.fire(new AddLayerCommand(this.layer));
|
|
692
|
-
}
|
|
693
|
-
removeLayer() {
|
|
694
|
-
if (this.layer)
|
|
695
|
-
this.postboy.fire(new RemoveLayerCommand(this.layer));
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
FeatureLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
|
|
699
|
-
FeatureLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: FeatureLayerComponent, selector: "lib-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
700
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: FeatureLayerComponent, decorators: [{
|
|
701
|
-
type: Component,
|
|
702
|
-
args: [{ selector: 'lib-feature-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
703
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }, { type: FeatureLayerFactory }]; }, propDecorators: { settings: [{
|
|
704
|
-
type: Input
|
|
705
|
-
}] } });
|
|
706
|
-
|
|
707
|
-
class MarkersComponent extends DestructibleComponent {
|
|
708
|
-
constructor(postboy) {
|
|
709
|
-
super();
|
|
710
|
-
this.postboy = postboy;
|
|
711
|
-
this.layerName = '';
|
|
712
|
-
this._markers = [];
|
|
713
|
-
}
|
|
714
|
-
set markers(value) {
|
|
715
|
-
this._markers = value;
|
|
716
|
-
this.putMarkers();
|
|
717
|
-
}
|
|
718
|
-
ngOnInit() {
|
|
719
|
-
this.postboy
|
|
720
|
-
.subscribe(MapRenderedEvent.ID)
|
|
721
|
-
.pipe(filter((m) => !!m), first())
|
|
722
|
-
.subscribe(() => this.putMarkers());
|
|
723
|
-
}
|
|
724
|
-
putMarkers() {
|
|
725
|
-
var _a;
|
|
726
|
-
if (!((_a = this._markers) === null || _a === void 0 ? void 0 : _a.length))
|
|
727
|
-
return;
|
|
728
|
-
this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
MarkersComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
|
|
732
|
-
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 });
|
|
733
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MarkersComponent, decorators: [{
|
|
734
|
-
type: Component,
|
|
735
|
-
args: [{ selector: 'lib-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
|
|
736
|
-
}], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
|
|
737
|
-
type: Input
|
|
738
|
-
}], markers: [{
|
|
739
|
-
type: Input
|
|
740
|
-
}] } });
|
|
741
|
-
|
|
742
|
-
class MapModule {
|
|
743
|
-
}
|
|
744
|
-
MapModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
745
|
-
MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
|
|
746
|
-
MapPlateComponent,
|
|
747
|
-
TileLayerComponent,
|
|
748
|
-
OsmTileLayerComponent,
|
|
749
|
-
FeatureLayerComponent,
|
|
750
|
-
MarkersComponent], imports: [CommonModule], exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent] });
|
|
751
|
-
MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
|
|
752
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
|
|
753
|
-
type: NgModule,
|
|
754
|
-
args: [{
|
|
755
|
-
imports: [CommonModule],
|
|
756
|
-
declarations: [
|
|
757
|
-
DestructibleComponent,
|
|
758
|
-
MapPlateComponent,
|
|
759
|
-
TileLayerComponent,
|
|
760
|
-
OsmTileLayerComponent,
|
|
761
|
-
FeatureLayerComponent,
|
|
762
|
-
MarkersComponent,
|
|
763
|
-
],
|
|
764
|
-
exports: [MapPlateComponent, FeatureLayerComponent, MarkersComponent, TileLayerComponent],
|
|
765
|
-
}]
|
|
766
|
-
}] });
|
|
767
|
-
|
|
768
|
-
class MarkerStyleHelper {
|
|
769
|
-
static fromSvg(svg, size = [30, 30], zIndex = 400) {
|
|
770
|
-
let image = new Image();
|
|
771
|
-
image.src = 'data:image/svg+xml,' + escape(svg);
|
|
772
|
-
return new Style({
|
|
773
|
-
image: new Icon({
|
|
774
|
-
img: image,
|
|
775
|
-
imgSize: size,
|
|
776
|
-
}),
|
|
777
|
-
zIndex,
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
static circle(radius, fill, strokeColor, strokeWidth = 1) {
|
|
781
|
-
return new Style({
|
|
782
|
-
image: new Circle({
|
|
783
|
-
radius,
|
|
784
|
-
fill: new Fill({ color: fill }),
|
|
785
|
-
stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
|
|
786
|
-
}),
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
/*
|
|
792
|
-
* Public API Surface of maps
|
|
793
|
-
*/
|
|
794
|
-
|
|
795
|
-
/*
|
|
796
|
-
* Public API Surface of maps-components
|
|
797
|
-
*/
|
|
798
|
-
|
|
799
|
-
/**
|
|
800
|
-
* Generated bundle index. Do not edit.
|
|
801
|
-
*/
|
|
802
|
-
|
|
803
|
-
export { CallbackMessage, FeatureLayerComponent, FeatureLayerSettings, GenericMessage, MapLyrs, MapLyrsLabel, MapModule, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, OsmTileLayerComponent, TileLayerComponent, TileLayerSettings };
|
|
804
|
-
//# sourceMappingURL=maps-components.mjs.map
|