@artstesh/maps 4.1.25 → 4.1.27

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.
Files changed (53) hide show
  1. package/dist/esm2020/map/map-plate/layers/image-layer/image-layer-factory.mjs +26 -0
  2. package/dist/esm2020/map/map-plate/layers/image-layer/image-layer.component.mjs +49 -0
  3. package/dist/esm2020/map/map-plate/layers/image-layer/image-layer.settings.mjs +136 -0
  4. package/dist/esm2020/map/map-plate/layers/index.mjs +3 -1
  5. package/dist/esm2020/map/map.module.mjs +8 -3
  6. package/dist/esm2020/map/messages/commands/add-image-layer.command.mjs +9 -0
  7. package/dist/esm2020/map/messages/commands/modify-feature.command.mjs +7 -5
  8. package/dist/esm2020/map/messages/commands/remove-image-layer.command.mjs +9 -0
  9. package/dist/esm2020/map/public-api.mjs +2 -1
  10. package/dist/esm2020/map/services/drawing/feature-modification.service.mjs +3 -2
  11. package/dist/esm2020/map/services/map-management.service.mjs +16 -1
  12. package/dist/esm2020/map/services/message-registrator.service.mjs +5 -1
  13. package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer-factory.mjs +26 -0
  14. package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer.component.mjs +49 -0
  15. package/dist/esm2020/src/map/map-plate/layers/image-layer/image-layer.settings.mjs +136 -0
  16. package/dist/esm2020/src/map/map-plate/layers/index.mjs +3 -1
  17. package/dist/esm2020/src/map/map.module.mjs +8 -3
  18. package/dist/esm2020/src/map/messages/commands/add-image-layer.command.mjs +9 -0
  19. package/dist/esm2020/src/map/messages/commands/modify-feature.command.mjs +7 -5
  20. package/dist/esm2020/src/map/messages/commands/remove-image-layer.command.mjs +9 -0
  21. package/dist/esm2020/src/map/public-api.mjs +2 -1
  22. package/dist/esm2020/src/map/services/drawing/feature-modification.service.mjs +3 -2
  23. package/dist/esm2020/src/map/services/map-management.service.mjs +16 -1
  24. package/dist/esm2020/src/map/services/message-registrator.service.mjs +5 -1
  25. package/dist/fesm2015/maps-components-src-map.mjs +245 -8
  26. package/dist/fesm2015/maps-components-src-map.mjs.map +1 -1
  27. package/dist/fesm2015/maps-components.mjs +245 -8
  28. package/dist/fesm2015/maps-components.mjs.map +1 -1
  29. package/dist/fesm2020/maps-components-src-map.mjs +245 -8
  30. package/dist/fesm2020/maps-components-src-map.mjs.map +1 -1
  31. package/dist/fesm2020/maps-components.mjs +245 -8
  32. package/dist/fesm2020/maps-components.mjs.map +1 -1
  33. package/dist/map/map-plate/layers/image-layer/image-layer-factory.d.ts +9 -0
  34. package/dist/map/map-plate/layers/image-layer/image-layer.component.d.ts +22 -0
  35. package/dist/map/map-plate/layers/image-layer/image-layer.settings.d.ts +97 -0
  36. package/dist/map/map-plate/layers/index.d.ts +2 -0
  37. package/dist/map/map.module.d.ts +3 -2
  38. package/dist/map/messages/commands/add-image-layer.command.d.ts +8 -0
  39. package/dist/map/messages/commands/modify-feature.command.d.ts +6 -4
  40. package/dist/map/messages/commands/remove-image-layer.command.d.ts +8 -0
  41. package/dist/map/public-api.d.ts +1 -0
  42. package/dist/map/services/map-management.service.d.ts +1 -0
  43. package/dist/src/map/map-plate/layers/image-layer/image-layer-factory.d.ts +9 -0
  44. package/dist/src/map/map-plate/layers/image-layer/image-layer.component.d.ts +22 -0
  45. package/dist/src/map/map-plate/layers/image-layer/image-layer.settings.d.ts +97 -0
  46. package/dist/src/map/map-plate/layers/index.d.ts +2 -0
  47. package/dist/src/map/map.module.d.ts +3 -2
  48. package/dist/src/map/messages/commands/add-image-layer.command.d.ts +8 -0
  49. package/dist/src/map/messages/commands/modify-feature.command.d.ts +6 -4
  50. package/dist/src/map/messages/commands/remove-image-layer.command.d.ts +8 -0
  51. package/dist/src/map/public-api.d.ts +1 -0
  52. package/dist/src/map/services/map-management.service.d.ts +1 -0
  53. package/package.json +1 -1
@@ -22,11 +22,14 @@ import OSM from 'ol/source/OSM';
22
22
  import { Vector as Vector$1 } from 'ol/layer';
23
23
  import { bbox } from 'ol/loadingstrategy';
24
24
  import Cluster from 'ol/source/Cluster';
25
+ import Static from 'ol/source/ImageStatic';
26
+ import ImageLayer from 'ol/layer/Image';
25
27
  import Map from 'ol/Map';
26
28
  import View from 'ol/View';
27
29
  import Overlay from 'ol/Overlay';
28
30
  import Style from 'ol/style/Style';
29
31
  import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
32
+ export { Style } from 'ol/style';
30
33
  import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
31
34
 
32
35
  class DestructibleComponent {
@@ -388,15 +391,17 @@ class ModifyFeatureCommand extends PostboyCallbackMessage {
388
391
  /**
389
392
  * Constructs an instance of the class.
390
393
  *
391
- * @param {PolygonModel} model - The polygon model to be used.
392
- * @param {Style} style - The style configuration for the polygon.
393
- * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the features. Default is GeoJson.
394
+ * @param {PolygonModel} model - The model representing the polygon data.
395
+ * @param {Style} style - The style to be applied to the polygon.
396
+ * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the feature, defaults to GeoJson.
397
+ * @param {boolean} [draggable=true] - Determines whether the polygon is draggable, defaults to true.
394
398
  */
395
- constructor(model, style, format = FeatureOutputFormat.GeoJson) {
399
+ constructor(model, style, format = FeatureOutputFormat.GeoJson, draggable = true) {
396
400
  super();
397
401
  this.model = model;
398
402
  this.style = style;
399
403
  this.format = format;
404
+ this.draggable = draggable;
400
405
  }
401
406
  }
402
407
  ModifyFeatureCommand.ID = '8f76507e-f18d-4232-bab7-f3d4e3d707bb';
@@ -864,6 +869,22 @@ class ZoomControlFactory {
864
869
  }
865
870
  }
866
871
 
872
+ class AddImageLayerCommand extends PostboyGenericMessage {
873
+ constructor(layer) {
874
+ super();
875
+ this.layer = layer;
876
+ }
877
+ }
878
+ AddImageLayerCommand.ID = '70f9b86f-8bc2-4f28-ae79-a13fc0b1ee5d';
879
+
880
+ class RemoveImageLayerCommand extends PostboyGenericMessage {
881
+ constructor(layer) {
882
+ super();
883
+ this.layer = layer;
884
+ }
885
+ }
886
+ RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
887
+
867
888
  class MapPostboyService extends PostboyService {
868
889
  constructor() {
869
890
  super();
@@ -895,6 +916,7 @@ class MapManagementService {
895
916
  this.observeLayerQuery();
896
917
  this.observeFeaturesInArea();
897
918
  this.observeFeaturesInPoint();
919
+ this.observeImageLayer();
898
920
  }
899
921
  observeRemoveTile() {
900
922
  this.postboy.sub(RemoveTileCommand).subscribe((c) => {
@@ -913,6 +935,18 @@ class MapManagementService {
913
935
  this.map.addLayer(c.layer);
914
936
  });
915
937
  }
938
+ observeImageLayer() {
939
+ this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
940
+ if (!this.map)
941
+ return;
942
+ this.map.addLayer(c.layer);
943
+ });
944
+ this.postboy.sub(RemoveImageLayerCommand).subscribe((c) => {
945
+ if (!this.map)
946
+ return;
947
+ this.map.removeLayer(c.layer);
948
+ });
949
+ }
916
950
  observeMapRender() {
917
951
  this.postboy.sub(MapRenderedEvent).subscribe((m) => {
918
952
  this.map = m.map;
@@ -1238,7 +1272,8 @@ class FeatureModificationService {
1238
1272
  this.observeCancelation(ev, l);
1239
1273
  this.initFeature(l, ev.model.feature);
1240
1274
  this.addModify(ev);
1241
- this.addDragging(ev);
1275
+ if (ev.draggable)
1276
+ this.addDragging(ev);
1242
1277
  });
1243
1278
  });
1244
1279
  }
@@ -1356,6 +1391,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1356
1391
  this.recordSubject(AddLayerCommand);
1357
1392
  this.recordSubject(RemoveLayerCommand);
1358
1393
  this.recordSubject(AddTileCommand);
1394
+ this.recordSubject(RemoveImageLayerCommand);
1395
+ this.recordSubject(AddImageLayerCommand);
1359
1396
  this.recordSubject(RemoveTileCommand);
1360
1397
  this.recordSubject(MapClickEvent);
1361
1398
  this.recordSubject(CloseTooltipCommand);
@@ -2147,6 +2184,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2147
2184
  type: Input
2148
2185
  }] } });
2149
2186
 
2187
+ class ImageLayerSettings {
2188
+ constructor() {
2189
+ /**
2190
+ * Represents the tiles URL.
2191
+ * @typedef {string} url
2192
+ *
2193
+ * @example
2194
+ * 'https://example.ex/{z}/{x}/{y}.png'
2195
+ */
2196
+ this.url = '';
2197
+ /**
2198
+ * Use interpolated values when resampling.
2199
+ * By default, linear interpolation is used when resampling.
2200
+ * Set to false to use the nearest neighbor instead.
2201
+ */
2202
+ this.interpolate = undefined;
2203
+ /**
2204
+ * The projection of the coordinate system.
2205
+ *
2206
+ * @type {string}
2207
+ * @default 'EPSG:3857'
2208
+ */
2209
+ this.projection = 'EPSG:3857';
2210
+ this.extent = [0, 0, 0, 0];
2211
+ /**
2212
+ * Additional headers that should be added to each tile request
2213
+ *
2214
+ * @type {Record<string, string>}
2215
+ * @default An empty array
2216
+ */
2217
+ this.requestHeaders = null;
2218
+ }
2219
+ /**
2220
+ * Creates a copy of the given tile layer settings.
2221
+ *
2222
+ * @param {ImageLayerSettings} model - The tile layer settings to be copied.
2223
+ * @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the same properties as the model.
2224
+ */
2225
+ static copy(model) {
2226
+ const result = new ImageLayerSettings();
2227
+ result.interpolate = model.interpolate;
2228
+ result.projection = model.projection;
2229
+ result.extent = model.extent;
2230
+ result.url = model.url;
2231
+ result.requestHeaders = model.requestHeaders;
2232
+ return result;
2233
+ }
2234
+ /**
2235
+ * Sets the URL of the ImageLayerSettings object.
2236
+ *
2237
+ * @param {string} url - The URL to be set.
2238
+ * @return {ImageLayerSettings} - The updated ImageLayerSettings object.
2239
+ */
2240
+ setUrl(url) {
2241
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { url }));
2242
+ }
2243
+ /**
2244
+ * Sets the interpolation state for the image layer settings.
2245
+ *
2246
+ * @param {boolean} [interpolate] - Use interpolated values when resampling.
2247
+ * By default, linear interpolation is used when resampling.
2248
+ * Set to false to use the nearest neighbor instead.
2249
+ * @return {ImageLayerSettings} A new instance of ImageLayerSettings with the updated interpolation setting.
2250
+ */
2251
+ setInterpolate(interpolate) {
2252
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { interpolate }));
2253
+ }
2254
+ setExtent(extent) {
2255
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { extent }));
2256
+ }
2257
+ /**
2258
+ * Sets the requestHeaders of the ImageLayerSettings object.
2259
+ *
2260
+ * @param {Record<string, string>} requestHeaders - The headers which should be provided.
2261
+ * @return {ImageLayerSettings} - The updated ImageLayerSettings object.
2262
+ */
2263
+ setRequestHeaders(requestHeaders) {
2264
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { requestHeaders }));
2265
+ }
2266
+ /**
2267
+ * Sets the maximum zoom level for the tile layer.
2268
+ *
2269
+ * @param {number} maxZoom - The maximum zoom level.
2270
+ * @returns {ImageLayerSettings} - The updated tile layer settings object.
2271
+ */
2272
+ setMaxZoom(maxZoom) {
2273
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { maxZoom }));
2274
+ }
2275
+ /**
2276
+ * Sets the minimum zoom level for the Tile Layer.
2277
+ *
2278
+ * @param {number} minZoom - The minimum zoom level to be set.
2279
+ * @return {ImageLayerSettings} The modified ImageLayerSettings object with the updated minimum zoom level.
2280
+ */
2281
+ setMinZoom(minZoom) {
2282
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { minZoom }));
2283
+ }
2284
+ /**
2285
+ * Sets the opacity of the ImageLayerSettings.
2286
+ *
2287
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
2288
+ * @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the opacity set.
2289
+ */
2290
+ setOpacity(opacity) {
2291
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { opacity }));
2292
+ }
2293
+ /**
2294
+ * Sets the projection for the tile layer settings.
2295
+ *
2296
+ * @param {string} projection - The desired projection for the tile layer settings.
2297
+ * @return {ImageLayerSettings} - The updated tile layer settings with the new projection.
2298
+ */
2299
+ setProjection(projection) {
2300
+ return ImageLayerSettings.copy(Object.assign(Object.assign({}, this), { projection }));
2301
+ }
2302
+ /**
2303
+ * Checks if the current instance of ImageLayerSettings is equal to the given model.
2304
+ * @param {ImageLayerSettings} model - The model to compare against.
2305
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
2306
+ * otherwise, false.
2307
+ */
2308
+ isSame(model) {
2309
+ if (this.url !== model.url)
2310
+ return false;
2311
+ if (this.projection !== model.projection)
2312
+ return false;
2313
+ if (this.extent !== model.extent)
2314
+ return false;
2315
+ if (this.interpolate !== model.interpolate)
2316
+ return false;
2317
+ if (this.requestHeaders !== model.requestHeaders)
2318
+ return false;
2319
+ return true;
2320
+ }
2321
+ }
2322
+
2323
+ class ImageLayerFactory {
2324
+ build(settings) {
2325
+ const source = new Static({
2326
+ url: settings.url,
2327
+ interpolate: settings.interpolate,
2328
+ crossOrigin: 'Anonymous',
2329
+ projection: get(settings.projection),
2330
+ imageExtent: settings.extent,
2331
+ });
2332
+ return new ImageLayer({ source });
2333
+ }
2334
+ }
2335
+ ImageLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2336
+ ImageLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, providedIn: 'root' });
2337
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, decorators: [{
2338
+ type: Injectable,
2339
+ args: [{
2340
+ providedIn: 'root',
2341
+ }]
2342
+ }] });
2343
+
2344
+ class ImageLayerComponent extends DestructibleComponent {
2345
+ constructor(postboy, factory) {
2346
+ super();
2347
+ this.postboy = postboy;
2348
+ this.factory = factory;
2349
+ this._settings = new ImageLayerSettings();
2350
+ this.onDestroy = () => this.removeLayer();
2351
+ }
2352
+ set settings(value) {
2353
+ if (!value || this._settings.isSame(value))
2354
+ return;
2355
+ this._settings = value;
2356
+ this.initLayer();
2357
+ }
2358
+ ngOnInit() {
2359
+ this.postboy
2360
+ .sub(MapRenderedEvent)
2361
+ .pipe(filter((m) => !!m), first())
2362
+ .subscribe((m) => this.initLayer());
2363
+ }
2364
+ initLayer() {
2365
+ this.removeLayer();
2366
+ this.layer = this.factory.build(this._settings);
2367
+ this.postboy.fire(new AddImageLayerCommand(this.layer));
2368
+ }
2369
+ removeLayer() {
2370
+ if (this.layer)
2371
+ this.postboy.fire(new RemoveImageLayerCommand(this.layer));
2372
+ }
2373
+ }
2374
+ ImageLayerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerComponent, deps: [{ token: MapPostboyService }, { token: ImageLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
2375
+ ImageLayerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ImageLayerComponent, selector: "art-image-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2376
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerComponent, decorators: [{
2377
+ type: Component,
2378
+ args: [{ selector: 'art-image-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2379
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ImageLayerFactory }]; }, propDecorators: { settings: [{
2380
+ type: Input
2381
+ }] } });
2382
+
2150
2383
  class MapPlateFactory {
2151
2384
  build(settings) {
2152
2385
  return new Map({
@@ -2624,14 +2857,16 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
2624
2857
  TooltipComponent,
2625
2858
  PolygonsComponent,
2626
2859
  ClusterLayerComponent,
2627
- MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
2860
+ MapControlZoomComponent,
2861
+ ImageLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
2628
2862
  FeatureLayerComponent,
2629
2863
  MarkersComponent,
2630
2864
  TileLayerComponent,
2631
2865
  TooltipComponent,
2632
2866
  PolygonsComponent,
2633
2867
  ClusterLayerComponent,
2634
- MapControlZoomComponent] });
2868
+ MapControlZoomComponent,
2869
+ ImageLayerComponent] });
2635
2870
  MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
2636
2871
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
2637
2872
  type: NgModule,
@@ -2648,6 +2883,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2648
2883
  PolygonsComponent,
2649
2884
  ClusterLayerComponent,
2650
2885
  MapControlZoomComponent,
2886
+ ImageLayerComponent,
2651
2887
  ],
2652
2888
  exports: [
2653
2889
  MapPlateComponent,
@@ -2658,6 +2894,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2658
2894
  PolygonsComponent,
2659
2895
  ClusterLayerComponent,
2660
2896
  MapControlZoomComponent,
2897
+ ImageLayerComponent,
2661
2898
  ],
2662
2899
  }]
2663
2900
  }] });
@@ -2858,5 +3095,5 @@ class StringifyFeatureHelper {
2858
3095
  * Generated bundle index. Do not edit.
2859
3096
  */
2860
3097
 
2861
- export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
3098
+ export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FilterFeaturesInAreaExecutor, FilterFeaturesInPointExecutor, FitToFeaturesCommand, FitToPolygonsCommand, GetFeaturesInAreaQuery, GetFeaturesInPointQuery, GetMapPositionExecutor, ImageLayerComponent, ImageLayerSettings, MapClickEvent, MapConstants, MapControl, MapControlZoomComponent, MapFeatureHoveredEvent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPointerMoveEvent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonSelfIntersectionExecutor, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };
2862
3099
  //# sourceMappingURL=maps-components.mjs.map