@artstesh/maps 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +46 -77
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +46 -77
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/messages/commands/draw-selection-area.command.js +1 -1
  6. package/dist/esm2015/map/messages/commands/fit-to-polygons.command.js +13 -0
  7. package/dist/esm2015/map/messages/index.js +2 -1
  8. package/dist/esm2015/map/messages/queries/get-features-in-area.query.js +1 -1
  9. package/dist/esm2015/map/models/index.js +1 -2
  10. package/dist/esm2015/map/models/map-settings.js +2 -2
  11. package/dist/esm2015/map/services/drawing/drawing.service.js +3 -2
  12. package/dist/esm2015/map/services/map-feature.service.js +17 -4
  13. package/dist/esm2015/map/services/map-management.service.js +2 -2
  14. package/dist/esm2015/map/services/message-registrator.service.js +3 -2
  15. package/dist/esm2015/src/map/messages/commands/draw-selection-area.command.js +1 -1
  16. package/dist/esm2015/src/map/messages/commands/fit-to-polygons.command.js +13 -0
  17. package/dist/esm2015/src/map/messages/index.js +2 -1
  18. package/dist/esm2015/src/map/messages/queries/get-features-in-area.query.js +1 -1
  19. package/dist/esm2015/src/map/models/index.js +1 -2
  20. package/dist/esm2015/src/map/models/map-settings.js +2 -2
  21. package/dist/esm2015/src/map/services/drawing/drawing.service.js +3 -2
  22. package/dist/esm2015/src/map/services/map-feature.service.js +17 -4
  23. package/dist/esm2015/src/map/services/map-management.service.js +2 -2
  24. package/dist/esm2015/src/map/services/message-registrator.service.js +3 -2
  25. package/dist/fesm2015/maps-components-src-map.js +31 -60
  26. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  27. package/dist/fesm2015/maps-components.js +31 -60
  28. package/dist/fesm2015/maps-components.js.map +1 -1
  29. package/dist/map/messages/commands/draw-selection-area.command.d.ts +2 -1
  30. package/dist/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
  31. package/dist/map/messages/index.d.ts +1 -0
  32. package/dist/map/messages/queries/get-features-in-area.query.d.ts +1 -1
  33. package/dist/map/models/index.d.ts +0 -1
  34. package/dist/map/services/map-feature.service.d.ts +2 -0
  35. package/dist/package.json +2 -1
  36. package/dist/src/map/messages/commands/draw-selection-area.command.d.ts +2 -1
  37. package/dist/src/map/messages/commands/fit-to-polygons.command.d.ts +9 -0
  38. package/dist/src/map/messages/index.d.ts +1 -0
  39. package/dist/src/map/messages/queries/get-features-in-area.query.d.ts +1 -1
  40. package/dist/src/map/models/index.d.ts +0 -1
  41. package/dist/src/map/services/map-feature.service.d.ts +2 -0
  42. package/package.json +3 -2
  43. package/dist/esm2015/map/models/dictionary.js +0 -56
  44. package/dist/esm2015/src/map/models/dictionary.js +0 -56
  45. package/dist/map/models/dictionary.d.ts +0 -17
  46. package/dist/src/map/models/dictionary.d.ts +0 -17
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/interaction'), require('ol/interaction/Draw'), require('ol/sphere'), require('rxjs/operators'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/geom/Polygon'), require('ol/source/Cluster'), require('rxjs'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style'), require('ol/proj/epsg4326')) :
3
- typeof define === 'function' && define.amd ? define('maps-components/src/map', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/interaction', 'ol/interaction/Draw', 'ol/sphere', 'rxjs/operators', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/geom/Polygon', 'ol/source/Cluster', 'rxjs', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style', 'ol/proj/epsg4326'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["maps-components"] = global["maps-components"] || {}, global["maps-components"].src = global["maps-components"].src || {}, global["maps-components"].src.map = {}), global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.control, global.proj, global.postboy, global.interaction, global.Draw, global.Sphere, global.rxjs.operators, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Polygon, global.Cluster, global.rxjs, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326));
5
- })(this, (function (exports, i0, i6, ol, geom, format, extent, control, proj, postboy, interaction, Draw, Sphere, operators, source, TileLayer, OSM, layer, loadingstrategy, Polygon, Cluster, rxjs, Map, View, Overlay, Style, style, epsg4326) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('ol'), require('ol/geom'), require('ol/format'), require('ol/extent'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/interaction'), require('ol/interaction/Draw'), require('ol/sphere'), require('@artstesh/collections'), require('rxjs/operators'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/geom/Polygon'), require('ol/source/Cluster'), require('rxjs'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style'), require('ol/proj/epsg4326')) :
3
+ typeof define === 'function' && define.amd ? define('maps-components/src/map', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/interaction', 'ol/interaction/Draw', 'ol/sphere', '@artstesh/collections', 'rxjs/operators', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/geom/Polygon', 'ol/source/Cluster', 'rxjs', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style', 'ol/proj/epsg4326'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["maps-components"] = global["maps-components"] || {}, global["maps-components"].src = global["maps-components"].src || {}, global["maps-components"].src.map = {}), global.ng.core, global.ng.common, global.ol, global.geom, global.format, global.extent, global.control, global.proj, global.postboy, global.interaction, global.Draw, global.Sphere, global.collections, global.rxjs.operators, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Polygon, global.Cluster, global.rxjs, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326));
5
+ })(this, (function (exports, i0, i6, ol, geom, format, extent, control, proj, postboy, interaction, Draw, Sphere, collections, operators, source, TileLayer, OSM, layer, loadingstrategy, Polygon, Cluster, rxjs, Map, View, Overlay, Style, style, epsg4326) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -589,7 +589,7 @@
589
589
  return false;
590
590
  if (this.language !== model.language)
591
591
  return false;
592
- return this.center.length !== model.center.length || !!this.center.filter(function (c, i) { return c !== model.center[i]; });
592
+ return this.center.length === model.center.length && !this.center.filter(function (c, i) { return c !== model.center[i]; }).length;
593
593
  };
594
594
  return MapSettings;
595
595
  }());
@@ -689,72 +689,6 @@
689
689
  FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
690
690
  })(exports.FeatureOutputFormat || (exports.FeatureOutputFormat = {}));
691
691
 
692
- var Dictionary = /** @class */ (function () {
693
- function Dictionary() {
694
- var _this = this;
695
- this.collection = {};
696
- this._keys = new Set();
697
- this.has = function (key) { return _this._keys.has(key); };
698
- }
699
- Object.defineProperty(Dictionary.prototype, "keys", {
700
- get: function () {
701
- return Array.from(this._keys);
702
- },
703
- enumerable: false,
704
- configurable: true
705
- });
706
- Object.defineProperty(Dictionary.prototype, "size", {
707
- get: function () {
708
- return this._keys.size;
709
- },
710
- enumerable: false,
711
- configurable: true
712
- });
713
- Dictionary.clone = function (dic, action) {
714
- return Dictionary.create(dic.collection, action);
715
- };
716
- Dictionary.create = function (dic, action) {
717
- var keyList = Object.keys(dic);
718
- var result = new Dictionary();
719
- for (var i = 0; i < keyList.length; i++) {
720
- var key = keyList[i];
721
- result._keys.add(key);
722
- result.collection[key] = action ? action(dic[key], key) : dic[key];
723
- }
724
- return result;
725
- };
726
- Dictionary.prototype.find = function (predicate) {
727
- var result = null;
728
- this.forEach(function (e) {
729
- if (result === null && predicate(e))
730
- result = e;
731
- });
732
- return result;
733
- };
734
- Dictionary.prototype.take = function (key) {
735
- return this._keys.has(key) ? this.collection[key] : null;
736
- };
737
- Dictionary.prototype.put = function (key, value) {
738
- if (value == null)
739
- return;
740
- this.collection[key] = value;
741
- this._keys.add(key);
742
- };
743
- Dictionary.prototype.rmv = function (key) {
744
- if (!this._keys.has(key))
745
- return;
746
- delete this.collection[key];
747
- this._keys.delete(key);
748
- };
749
- Dictionary.prototype.forEach = function (callback) {
750
- var keys = Object.keys(this.collection);
751
- for (var i = 0; i < keys.length; i++) {
752
- callback(this.collection[keys[i]], i);
753
- }
754
- };
755
- return Dictionary;
756
- }());
757
-
758
692
  /**
759
693
  *
760
694
  * 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.
@@ -1024,6 +958,26 @@
1024
958
  }(postboy.PostboyExecutor));
1025
959
  CalculateAreaExecutor.ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
1026
960
 
961
+ var FitToPolygonsCommand = /** @class */ (function (_super) {
962
+ __extends(FitToPolygonsCommand, _super);
963
+ function FitToPolygonsCommand(features, zoomAfter) {
964
+ if (zoomAfter === void 0) { zoomAfter = 0; }
965
+ var _this = _super.call(this) || this;
966
+ _this.features = features;
967
+ _this.zoomAfter = zoomAfter;
968
+ return _this;
969
+ }
970
+ Object.defineProperty(FitToPolygonsCommand.prototype, "id", {
971
+ get: function () {
972
+ return FitToPolygonsCommand.ID;
973
+ },
974
+ enumerable: false,
975
+ configurable: true
976
+ });
977
+ return FitToPolygonsCommand;
978
+ }(postboy.PostboyGenericMessage));
979
+ FitToPolygonsCommand.ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
980
+
1027
981
  var AddLayerCommand = /** @class */ (function (_super) {
1028
982
  __extends(AddLayerCommand, _super);
1029
983
  function AddLayerCommand(layer) {
@@ -1327,7 +1281,7 @@
1327
1281
  var MapManagementService = /** @class */ (function () {
1328
1282
  function MapManagementService(postboy) {
1329
1283
  this.postboy = postboy;
1330
- this.layers = new Dictionary();
1284
+ this.layers = new collections.Dictionary();
1331
1285
  }
1332
1286
  MapManagementService.prototype.up = function () {
1333
1287
  this.observeMapRender();
@@ -1399,7 +1353,7 @@
1399
1353
  MapManagementService.prototype.observeFeaturesInArea = function () {
1400
1354
  var _this = this;
1401
1355
  this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe(function (qr) {
1402
- var result = new Dictionary();
1356
+ var result = new collections.Dictionary();
1403
1357
  _this.layers.forEach(function (l) {
1404
1358
  var _a, _b;
1405
1359
  var layerName = l.get('name');
@@ -1470,17 +1424,31 @@
1470
1424
  MapFeatureService.prototype.up = function () {
1471
1425
  this.observeMapRender();
1472
1426
  this.observeFitToFeatures();
1427
+ this.observeFitToPolygons();
1473
1428
  };
1474
1429
  MapFeatureService.prototype.observeMapRender = function () {
1475
1430
  var _this = this;
1476
1431
  this.postboy.subscribe(MapRenderedEvent.ID).subscribe(function (m) {
1477
1432
  _this.map = m.map;
1433
+ if (_this.fitPolygonsWaiting)
1434
+ _this.postboy.fire(_this.fitPolygonsWaiting);
1478
1435
  });
1479
1436
  };
1480
1437
  MapFeatureService.prototype.observeFitToFeatures = function () {
1481
1438
  var _this = this;
1482
- this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe(function (m) {
1483
- _this.fitToGeometries(m.features.map(function (f) { return f.getGeometry(); }), m.zoomAfter);
1439
+ this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe(function (cmd) {
1440
+ _this.fitToGeometries(cmd.features.map(function (f) { return f.getGeometry(); }), cmd.zoomAfter);
1441
+ });
1442
+ };
1443
+ MapFeatureService.prototype.observeFitToPolygons = function () {
1444
+ var _this = this;
1445
+ this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe(function (cmd) {
1446
+ if (!_this.map) {
1447
+ _this.fitPolygonsWaiting = cmd;
1448
+ return;
1449
+ }
1450
+ _this.fitPolygonsWaiting = undefined;
1451
+ _this.fitToGeometries(cmd.features.map(function (f) { return f.feature.getGeometry(); }), cmd.zoomAfter);
1484
1452
  });
1485
1453
  };
1486
1454
  MapFeatureService.prototype.fitToGeometries = function (geometries, zoomAfter) {
@@ -1566,7 +1534,7 @@
1566
1534
  var drawingCommand = new StartDrawingCommand(ev.type, ev.style);
1567
1535
  drawingCommand.result.subscribe(function (r) {
1568
1536
  if (!r) {
1569
- ev.finish(new Dictionary());
1537
+ ev.finish(new collections.Dictionary());
1570
1538
  return;
1571
1539
  }
1572
1540
  var area = PolygonModel.fromGeoJson(1, r).feature.getGeometry();
@@ -1793,6 +1761,7 @@
1793
1761
  this.registerSubject(MapClickEvent.ID);
1794
1762
  this.registerSubject(CloseTooltipCommand.ID);
1795
1763
  this.registerSubject(FitToFeaturesCommand.ID);
1764
+ this.registerSubject(FitToPolygonsCommand.ID);
1796
1765
  this.registerSubject(MapMoveEndEvent.ID);
1797
1766
  this.registerSubject(CancelDrawingCommand.ID);
1798
1767
  this.registerSubject(StartDrawingCommand.ID);
@@ -3046,10 +3015,10 @@
3046
3015
  exports.CloseTooltipCommand = CloseTooltipCommand;
3047
3016
  exports.ClusterLayerComponent = ClusterLayerComponent;
3048
3017
  exports.ClusterLayerSettings = ClusterLayerSettings;
3049
- exports.Dictionary = Dictionary;
3050
3018
  exports.DrawSelectionAreaCommand = DrawSelectionAreaCommand;
3051
3019
  exports.FeatureLayerComponent = FeatureLayerComponent;
3052
3020
  exports.FeatureLayerSettings = FeatureLayerSettings;
3021
+ exports.FitToPolygonsCommand = FitToPolygonsCommand;
3053
3022
  exports.MapClickEvent = MapClickEvent;
3054
3023
  exports.MapControl = MapControl;
3055
3024
  exports.MapControlZoomComponent = MapControlZoomComponent;