@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 {
@@ -387,15 +390,17 @@ class ModifyFeatureCommand extends PostboyCallbackMessage {
387
390
  /**
388
391
  * Constructs an instance of the class.
389
392
  *
390
- * @param {PolygonModel} model - The polygon model to be used.
391
- * @param {Style} style - The style configuration for the polygon.
392
- * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the features. Default is GeoJson.
393
+ * @param {PolygonModel} model - The model representing the polygon data.
394
+ * @param {Style} style - The style to be applied to the polygon.
395
+ * @param {FeatureOutputFormat} [format=FeatureOutputFormat.GeoJson] - The output format of the feature, defaults to GeoJson.
396
+ * @param {boolean} [draggable=true] - Determines whether the polygon is draggable, defaults to true.
393
397
  */
394
- constructor(model, style, format = FeatureOutputFormat.GeoJson) {
398
+ constructor(model, style, format = FeatureOutputFormat.GeoJson, draggable = true) {
395
399
  super();
396
400
  this.model = model;
397
401
  this.style = style;
398
402
  this.format = format;
403
+ this.draggable = draggable;
399
404
  }
400
405
  }
401
406
  ModifyFeatureCommand.ID = '8f76507e-f18d-4232-bab7-f3d4e3d707bb';
@@ -863,6 +868,22 @@ class ZoomControlFactory {
863
868
  }
864
869
  }
865
870
 
871
+ class AddImageLayerCommand extends PostboyGenericMessage {
872
+ constructor(layer) {
873
+ super();
874
+ this.layer = layer;
875
+ }
876
+ }
877
+ AddImageLayerCommand.ID = '70f9b86f-8bc2-4f28-ae79-a13fc0b1ee5d';
878
+
879
+ class RemoveImageLayerCommand extends PostboyGenericMessage {
880
+ constructor(layer) {
881
+ super();
882
+ this.layer = layer;
883
+ }
884
+ }
885
+ RemoveImageLayerCommand.ID = 'c8e7efdb-17ff-4cf9-89be-e688b8de3b95';
886
+
866
887
  class MapPostboyService extends PostboyService {
867
888
  constructor() {
868
889
  super();
@@ -894,6 +915,7 @@ class MapManagementService {
894
915
  this.observeLayerQuery();
895
916
  this.observeFeaturesInArea();
896
917
  this.observeFeaturesInPoint();
918
+ this.observeImageLayer();
897
919
  }
898
920
  observeRemoveTile() {
899
921
  this.postboy.sub(RemoveTileCommand).subscribe((c) => {
@@ -912,6 +934,18 @@ class MapManagementService {
912
934
  this.map.addLayer(c.layer);
913
935
  });
914
936
  }
937
+ observeImageLayer() {
938
+ this.postboy.sub(AddImageLayerCommand).subscribe((c) => {
939
+ if (!this.map)
940
+ return;
941
+ this.map.addLayer(c.layer);
942
+ });
943
+ this.postboy.sub(RemoveImageLayerCommand).subscribe((c) => {
944
+ if (!this.map)
945
+ return;
946
+ this.map.removeLayer(c.layer);
947
+ });
948
+ }
915
949
  observeMapRender() {
916
950
  this.postboy.sub(MapRenderedEvent).subscribe((m) => {
917
951
  this.map = m.map;
@@ -1228,7 +1262,8 @@ class FeatureModificationService {
1228
1262
  this.observeCancelation(ev, l);
1229
1263
  this.initFeature(l, ev.model.feature);
1230
1264
  this.addModify(ev);
1231
- this.addDragging(ev);
1265
+ if (ev.draggable)
1266
+ this.addDragging(ev);
1232
1267
  });
1233
1268
  });
1234
1269
  }
@@ -1341,6 +1376,8 @@ class MessageRegistratorService extends PostboyAbstractRegistrator {
1341
1376
  this.recordSubject(AddLayerCommand);
1342
1377
  this.recordSubject(RemoveLayerCommand);
1343
1378
  this.recordSubject(AddTileCommand);
1379
+ this.recordSubject(RemoveImageLayerCommand);
1380
+ this.recordSubject(AddImageLayerCommand);
1344
1381
  this.recordSubject(RemoveTileCommand);
1345
1382
  this.recordSubject(MapClickEvent);
1346
1383
  this.recordSubject(CloseTooltipCommand);
@@ -2127,6 +2164,202 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2127
2164
  type: Input
2128
2165
  }] } });
2129
2166
 
2167
+ class ImageLayerSettings {
2168
+ constructor() {
2169
+ /**
2170
+ * Represents the tiles URL.
2171
+ * @typedef {string} url
2172
+ *
2173
+ * @example
2174
+ * 'https://example.ex/{z}/{x}/{y}.png'
2175
+ */
2176
+ this.url = '';
2177
+ /**
2178
+ * Use interpolated values when resampling.
2179
+ * By default, linear interpolation is used when resampling.
2180
+ * Set to false to use the nearest neighbor instead.
2181
+ */
2182
+ this.interpolate = undefined;
2183
+ /**
2184
+ * The projection of the coordinate system.
2185
+ *
2186
+ * @type {string}
2187
+ * @default 'EPSG:3857'
2188
+ */
2189
+ this.projection = 'EPSG:3857';
2190
+ this.extent = [0, 0, 0, 0];
2191
+ /**
2192
+ * Additional headers that should be added to each tile request
2193
+ *
2194
+ * @type {Record<string, string>}
2195
+ * @default An empty array
2196
+ */
2197
+ this.requestHeaders = null;
2198
+ }
2199
+ /**
2200
+ * Creates a copy of the given tile layer settings.
2201
+ *
2202
+ * @param {ImageLayerSettings} model - The tile layer settings to be copied.
2203
+ * @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the same properties as the model.
2204
+ */
2205
+ static copy(model) {
2206
+ const result = new ImageLayerSettings();
2207
+ result.interpolate = model.interpolate;
2208
+ result.projection = model.projection;
2209
+ result.extent = model.extent;
2210
+ result.url = model.url;
2211
+ result.requestHeaders = model.requestHeaders;
2212
+ return result;
2213
+ }
2214
+ /**
2215
+ * Sets the URL of the ImageLayerSettings object.
2216
+ *
2217
+ * @param {string} url - The URL to be set.
2218
+ * @return {ImageLayerSettings} - The updated ImageLayerSettings object.
2219
+ */
2220
+ setUrl(url) {
2221
+ return ImageLayerSettings.copy({ ...this, url });
2222
+ }
2223
+ /**
2224
+ * Sets the interpolation state for the image layer settings.
2225
+ *
2226
+ * @param {boolean} [interpolate] - Use interpolated values when resampling.
2227
+ * By default, linear interpolation is used when resampling.
2228
+ * Set to false to use the nearest neighbor instead.
2229
+ * @return {ImageLayerSettings} A new instance of ImageLayerSettings with the updated interpolation setting.
2230
+ */
2231
+ setInterpolate(interpolate) {
2232
+ return ImageLayerSettings.copy({ ...this, interpolate });
2233
+ }
2234
+ setExtent(extent) {
2235
+ return ImageLayerSettings.copy({ ...this, extent });
2236
+ }
2237
+ /**
2238
+ * Sets the requestHeaders of the ImageLayerSettings object.
2239
+ *
2240
+ * @param {Record<string, string>} requestHeaders - The headers which should be provided.
2241
+ * @return {ImageLayerSettings} - The updated ImageLayerSettings object.
2242
+ */
2243
+ setRequestHeaders(requestHeaders) {
2244
+ return ImageLayerSettings.copy({ ...this, requestHeaders });
2245
+ }
2246
+ /**
2247
+ * Sets the maximum zoom level for the tile layer.
2248
+ *
2249
+ * @param {number} maxZoom - The maximum zoom level.
2250
+ * @returns {ImageLayerSettings} - The updated tile layer settings object.
2251
+ */
2252
+ setMaxZoom(maxZoom) {
2253
+ return ImageLayerSettings.copy({ ...this, maxZoom });
2254
+ }
2255
+ /**
2256
+ * Sets the minimum zoom level for the Tile Layer.
2257
+ *
2258
+ * @param {number} minZoom - The minimum zoom level to be set.
2259
+ * @return {ImageLayerSettings} The modified ImageLayerSettings object with the updated minimum zoom level.
2260
+ */
2261
+ setMinZoom(minZoom) {
2262
+ return ImageLayerSettings.copy({ ...this, minZoom });
2263
+ }
2264
+ /**
2265
+ * Sets the opacity of the ImageLayerSettings.
2266
+ *
2267
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
2268
+ * @return {ImageLayerSettings} - A new instance of ImageLayerSettings with the opacity set.
2269
+ */
2270
+ setOpacity(opacity) {
2271
+ return ImageLayerSettings.copy({ ...this, opacity });
2272
+ }
2273
+ /**
2274
+ * Sets the projection for the tile layer settings.
2275
+ *
2276
+ * @param {string} projection - The desired projection for the tile layer settings.
2277
+ * @return {ImageLayerSettings} - The updated tile layer settings with the new projection.
2278
+ */
2279
+ setProjection(projection) {
2280
+ return ImageLayerSettings.copy({ ...this, projection });
2281
+ }
2282
+ /**
2283
+ * Checks if the current instance of ImageLayerSettings is equal to the given model.
2284
+ * @param {ImageLayerSettings} model - The model to compare against.
2285
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
2286
+ * otherwise, false.
2287
+ */
2288
+ isSame(model) {
2289
+ if (this.url !== model.url)
2290
+ return false;
2291
+ if (this.projection !== model.projection)
2292
+ return false;
2293
+ if (this.extent !== model.extent)
2294
+ return false;
2295
+ if (this.interpolate !== model.interpolate)
2296
+ return false;
2297
+ if (this.requestHeaders !== model.requestHeaders)
2298
+ return false;
2299
+ return true;
2300
+ }
2301
+ }
2302
+
2303
+ class ImageLayerFactory {
2304
+ build(settings) {
2305
+ const source = new Static({
2306
+ url: settings.url,
2307
+ interpolate: settings.interpolate,
2308
+ crossOrigin: 'Anonymous',
2309
+ projection: get(settings.projection),
2310
+ imageExtent: settings.extent,
2311
+ });
2312
+ return new ImageLayer({ source });
2313
+ }
2314
+ }
2315
+ ImageLayerFactory.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2316
+ ImageLayerFactory.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, providedIn: 'root' });
2317
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerFactory, decorators: [{
2318
+ type: Injectable,
2319
+ args: [{
2320
+ providedIn: 'root',
2321
+ }]
2322
+ }] });
2323
+
2324
+ class ImageLayerComponent extends DestructibleComponent {
2325
+ constructor(postboy, factory) {
2326
+ super();
2327
+ this.postboy = postboy;
2328
+ this.factory = factory;
2329
+ this._settings = new ImageLayerSettings();
2330
+ this.onDestroy = () => this.removeLayer();
2331
+ }
2332
+ set settings(value) {
2333
+ if (!value || this._settings.isSame(value))
2334
+ return;
2335
+ this._settings = value;
2336
+ this.initLayer();
2337
+ }
2338
+ ngOnInit() {
2339
+ this.postboy
2340
+ .sub(MapRenderedEvent)
2341
+ .pipe(filter((m) => !!m), first())
2342
+ .subscribe((m) => this.initLayer());
2343
+ }
2344
+ initLayer() {
2345
+ this.removeLayer();
2346
+ this.layer = this.factory.build(this._settings);
2347
+ this.postboy.fire(new AddImageLayerCommand(this.layer));
2348
+ }
2349
+ removeLayer() {
2350
+ if (this.layer)
2351
+ this.postboy.fire(new RemoveImageLayerCommand(this.layer));
2352
+ }
2353
+ }
2354
+ 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 });
2355
+ 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 });
2356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ImageLayerComponent, decorators: [{
2357
+ type: Component,
2358
+ args: [{ selector: 'art-image-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2359
+ }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ImageLayerFactory }]; }, propDecorators: { settings: [{
2360
+ type: Input
2361
+ }] } });
2362
+
2130
2363
  class MapPlateFactory {
2131
2364
  build(settings) {
2132
2365
  return new Map({
@@ -2601,14 +2834,16 @@ MapModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.
2601
2834
  TooltipComponent,
2602
2835
  PolygonsComponent,
2603
2836
  ClusterLayerComponent,
2604
- MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
2837
+ MapControlZoomComponent,
2838
+ ImageLayerComponent], imports: [CommonModule], exports: [MapPlateComponent,
2605
2839
  FeatureLayerComponent,
2606
2840
  MarkersComponent,
2607
2841
  TileLayerComponent,
2608
2842
  TooltipComponent,
2609
2843
  PolygonsComponent,
2610
2844
  ClusterLayerComponent,
2611
- MapControlZoomComponent] });
2845
+ MapControlZoomComponent,
2846
+ ImageLayerComponent] });
2612
2847
  MapModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, imports: [CommonModule] });
2613
2848
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: MapModule, decorators: [{
2614
2849
  type: NgModule,
@@ -2625,6 +2860,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2625
2860
  PolygonsComponent,
2626
2861
  ClusterLayerComponent,
2627
2862
  MapControlZoomComponent,
2863
+ ImageLayerComponent,
2628
2864
  ],
2629
2865
  exports: [
2630
2866
  MapPlateComponent,
@@ -2635,6 +2871,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
2635
2871
  PolygonsComponent,
2636
2872
  ClusterLayerComponent,
2637
2873
  MapControlZoomComponent,
2874
+ ImageLayerComponent,
2638
2875
  ],
2639
2876
  }]
2640
2877
  }] });
@@ -2835,5 +3072,5 @@ class StringifyFeatureHelper {
2835
3072
  * Generated bundle index. Do not edit.
2836
3073
  */
2837
3074
 
2838
- 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 };
3075
+ 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 };
2839
3076
  //# sourceMappingURL=maps-components.mjs.map