@artstesh/maps 4.1.6 → 4.1.8
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/messages/commands/draw-selection-area.command.mjs +1 -1
- package/dist/esm2020/map/messages/commands/fit-to-polygons.command.mjs +13 -0
- package/dist/esm2020/map/messages/index.mjs +2 -1
- package/dist/esm2020/map/messages/queries/get-features-in-area.query.mjs +1 -1
- package/dist/esm2020/map/models/index.mjs +1 -2
- package/dist/esm2020/map/models/map-settings.mjs +2 -2
- package/dist/esm2020/map/services/drawing/drawing.service.mjs +3 -2
- package/dist/esm2020/map/services/map-feature.service.mjs +17 -4
- package/dist/esm2020/map/services/map-management.service.mjs +2 -2
- package/dist/esm2020/map/services/message-registrator.service.mjs +3 -2
- package/dist/esm2020/src/map/messages/commands/draw-selection-area.command.mjs +1 -1
- package/dist/esm2020/src/map/messages/commands/fit-to-polygons.command.mjs +13 -0
- package/dist/esm2020/src/map/messages/index.mjs +2 -1
- package/dist/esm2020/src/map/messages/queries/get-features-in-area.query.mjs +1 -1
- package/dist/esm2020/src/map/models/index.mjs +1 -2
- package/dist/esm2020/src/map/models/map-settings.mjs +2 -2
- package/dist/esm2020/src/map/services/drawing/drawing.service.mjs +3 -2
- package/dist/esm2020/src/map/services/map-feature.service.mjs +17 -4
- package/dist/esm2020/src/map/services/map-management.service.mjs +2 -2
- package/dist/esm2020/src/map/services/message-registrator.service.mjs +3 -2
- package/dist/fesm2015/maps-components-src-map.mjs +31 -60
- package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2015/maps-components.mjs +31 -60
- package/dist/fesm2015/maps-components.mjs.map +1 -1
- package/dist/fesm2020/maps-components-src-map.mjs +31 -60
- package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
- package/dist/fesm2020/maps-components.mjs +31 -60
- package/dist/fesm2020/maps-components.mjs.map +1 -1
- package/dist/map/messages/commands/draw-selection-area.command.d.ts +2 -1
- package/dist/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
- package/dist/map/messages/index.d.ts +1 -0
- package/dist/map/messages/queries/get-features-in-area.query.d.ts +1 -1
- package/dist/map/models/index.d.ts +0 -1
- package/dist/map/services/map-feature.service.d.ts +2 -0
- package/dist/package.json +1 -0
- package/dist/src/map/messages/commands/draw-selection-area.command.d.ts +2 -1
- package/dist/src/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
- package/dist/src/map/messages/index.d.ts +1 -0
- package/dist/src/map/messages/queries/get-features-in-area.query.d.ts +1 -1
- package/dist/src/map/models/index.d.ts +0 -1
- package/dist/src/map/services/map-feature.service.d.ts +2 -0
- package/package.json +3 -2
- package/dist/esm2020/map/models/dictionary.mjs +0 -56
- package/dist/esm2020/src/map/models/dictionary.mjs +0 -56
- package/dist/map/models/dictionary.d.ts +0 -17
- package/dist/src/map/models/dictionary.d.ts +0 -17
|
@@ -12,6 +12,7 @@ import { PostboyGenericMessage, PostboyCallbackMessage, PostboyExecutor, Postboy
|
|
|
12
12
|
import { Draw, Modify, Translate } from 'ol/interaction';
|
|
13
13
|
import { createRegularPolygon, createBox } from 'ol/interaction/Draw';
|
|
14
14
|
import * as Sphere from 'ol/sphere';
|
|
15
|
+
import { Dictionary } from '@artstesh/collections';
|
|
15
16
|
import { first, filter, auditTime } from 'rxjs/operators';
|
|
16
17
|
import { Vector, XYZ } from 'ol/source';
|
|
17
18
|
import TileLayer from 'ol/layer/Tile';
|
|
@@ -112,7 +113,7 @@ class MapSettings {
|
|
|
112
113
|
return false;
|
|
113
114
|
if (this.language !== model.language)
|
|
114
115
|
return false;
|
|
115
|
-
return this.center.length
|
|
116
|
+
return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
|
|
116
117
|
}
|
|
117
118
|
}
|
|
118
119
|
|
|
@@ -193,62 +194,6 @@ var FeatureOutputFormat;
|
|
|
193
194
|
FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
|
|
194
195
|
})(FeatureOutputFormat || (FeatureOutputFormat = {}));
|
|
195
196
|
|
|
196
|
-
class Dictionary {
|
|
197
|
-
constructor() {
|
|
198
|
-
this.collection = {};
|
|
199
|
-
this._keys = new Set();
|
|
200
|
-
this.has = (key) => this._keys.has(key);
|
|
201
|
-
}
|
|
202
|
-
get keys() {
|
|
203
|
-
return Array.from(this._keys);
|
|
204
|
-
}
|
|
205
|
-
get size() {
|
|
206
|
-
return this._keys.size;
|
|
207
|
-
}
|
|
208
|
-
static clone(dic, action) {
|
|
209
|
-
return Dictionary.create(dic.collection, action);
|
|
210
|
-
}
|
|
211
|
-
static create(dic, action) {
|
|
212
|
-
let keyList = Object.keys(dic);
|
|
213
|
-
const result = new Dictionary();
|
|
214
|
-
for (let i = 0; i < keyList.length; i++) {
|
|
215
|
-
let key = keyList[i];
|
|
216
|
-
result._keys.add(key);
|
|
217
|
-
result.collection[key] = action ? action(dic[key], key) : dic[key];
|
|
218
|
-
}
|
|
219
|
-
return result;
|
|
220
|
-
}
|
|
221
|
-
find(predicate) {
|
|
222
|
-
let result = null;
|
|
223
|
-
this.forEach((e) => {
|
|
224
|
-
if (result === null && predicate(e))
|
|
225
|
-
result = e;
|
|
226
|
-
});
|
|
227
|
-
return result;
|
|
228
|
-
}
|
|
229
|
-
take(key) {
|
|
230
|
-
return this._keys.has(key) ? this.collection[key] : null;
|
|
231
|
-
}
|
|
232
|
-
put(key, value) {
|
|
233
|
-
if (value == null)
|
|
234
|
-
return;
|
|
235
|
-
this.collection[key] = value;
|
|
236
|
-
this._keys.add(key);
|
|
237
|
-
}
|
|
238
|
-
rmv(key) {
|
|
239
|
-
if (!this._keys.has(key))
|
|
240
|
-
return;
|
|
241
|
-
delete this.collection[key];
|
|
242
|
-
this._keys.delete(key);
|
|
243
|
-
}
|
|
244
|
-
forEach(callback) {
|
|
245
|
-
let keys = Object.keys(this.collection);
|
|
246
|
-
for (let i = 0; i < keys.length; i++) {
|
|
247
|
-
callback(this.collection[keys[i]], i);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
197
|
/**
|
|
253
198
|
*
|
|
254
199
|
* A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
|
|
@@ -418,6 +363,18 @@ class CalculateAreaExecutor extends PostboyExecutor {
|
|
|
418
363
|
}
|
|
419
364
|
CalculateAreaExecutor.ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
|
|
420
365
|
|
|
366
|
+
class FitToPolygonsCommand extends PostboyGenericMessage {
|
|
367
|
+
constructor(features, zoomAfter = 0) {
|
|
368
|
+
super();
|
|
369
|
+
this.features = features;
|
|
370
|
+
this.zoomAfter = zoomAfter;
|
|
371
|
+
}
|
|
372
|
+
get id() {
|
|
373
|
+
return FitToPolygonsCommand.ID;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
FitToPolygonsCommand.ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
|
|
377
|
+
|
|
421
378
|
class AddLayerCommand extends PostboyGenericMessage {
|
|
422
379
|
constructor(layer) {
|
|
423
380
|
super();
|
|
@@ -751,15 +708,28 @@ class MapFeatureService {
|
|
|
751
708
|
up() {
|
|
752
709
|
this.observeMapRender();
|
|
753
710
|
this.observeFitToFeatures();
|
|
711
|
+
this.observeFitToPolygons();
|
|
754
712
|
}
|
|
755
713
|
observeMapRender() {
|
|
756
714
|
this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
|
|
757
715
|
this.map = m.map;
|
|
716
|
+
if (this.fitPolygonsWaiting)
|
|
717
|
+
this.postboy.fire(this.fitPolygonsWaiting);
|
|
758
718
|
});
|
|
759
719
|
}
|
|
760
720
|
observeFitToFeatures() {
|
|
761
|
-
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((
|
|
762
|
-
this.fitToGeometries(
|
|
721
|
+
this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
|
|
722
|
+
this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
observeFitToPolygons() {
|
|
726
|
+
this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
|
|
727
|
+
if (!this.map) {
|
|
728
|
+
this.fitPolygonsWaiting = cmd;
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
this.fitPolygonsWaiting = undefined;
|
|
732
|
+
this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
|
|
763
733
|
});
|
|
764
734
|
}
|
|
765
735
|
fitToGeometries(geometries, zoomAfter) {
|
|
@@ -1041,6 +1011,7 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
|
|
|
1041
1011
|
this.registerSubject(MapClickEvent.ID);
|
|
1042
1012
|
this.registerSubject(CloseTooltipCommand.ID);
|
|
1043
1013
|
this.registerSubject(FitToFeaturesCommand.ID);
|
|
1014
|
+
this.registerSubject(FitToPolygonsCommand.ID);
|
|
1044
1015
|
this.registerSubject(MapMoveEndEvent.ID);
|
|
1045
1016
|
this.registerSubject(CancelDrawingCommand.ID);
|
|
1046
1017
|
this.registerSubject(StartDrawingCommand.ID);
|
|
@@ -2113,5 +2084,5 @@ class StringifyFeatureHelper {
|
|
|
2113
2084
|
* Generated bundle index. Do not edit.
|
|
2114
2085
|
*/
|
|
2115
2086
|
|
|
2116
|
-
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings,
|
|
2087
|
+
export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FitToPolygonsCommand, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
|
|
2117
2088
|
//# sourceMappingURL=maps-components-src-map.mjs.map
|