@artstesh/maps 1.1.3 → 1.1.5

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.
@@ -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('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', '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.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, 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('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';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -26,6 +26,7 @@
26
26
 
27
27
  var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
28
28
  var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
29
+ var Sphere__namespace = /*#__PURE__*/_interopNamespace(Sphere);
29
30
  var TileLayer__default = /*#__PURE__*/_interopDefaultLegacy(TileLayer);
30
31
  var OSM__default = /*#__PURE__*/_interopDefaultLegacy(OSM);
31
32
  var Polygon__default = /*#__PURE__*/_interopDefaultLegacy(Polygon);
@@ -645,12 +646,14 @@
645
646
 
646
647
  var PolygonModel = /** @class */ (function () {
647
648
  function PolygonModel(feature, id, info) {
648
- var _b;
649
- var _a;
649
+ var _c;
650
+ var _a, _b;
650
651
  this.info = info;
651
652
  this.id = id == null ? IdGenerator.get() : id;
652
653
  this._feature = feature;
653
- _b = __read(extent.getCenter((_a = this._feature.getGeometry()) === null || _a === void 0 ? void 0 : _a.getExtent()), 2), this.lng = _b[0], this.lat = _b[1];
654
+ if (this.info)
655
+ (_a = this._feature) === null || _a === void 0 ? void 0 : _a.set(MapConstants.FeatureInfo, this.info);
656
+ _c = __read(extent.getCenter((_b = this._feature.getGeometry()) === null || _b === void 0 ? void 0 : _b.getExtent()), 2), this.lng = _c[0], this.lat = _c[1];
654
657
  }
655
658
  PolygonModel.fromGeoJson = function (id, json, info) {
656
659
  var feature = new format.GeoJSON().readFeature(json);
@@ -1003,6 +1006,24 @@
1003
1006
  }(postboy.PostboyGenericMessage));
1004
1007
  SetMapCenterCommand.ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
1005
1008
 
1009
+ var CalculateAreaExecutor = /** @class */ (function (_super) {
1010
+ __extends(CalculateAreaExecutor, _super);
1011
+ function CalculateAreaExecutor(polygon) {
1012
+ var _this = _super.call(this) || this;
1013
+ _this.polygon = polygon;
1014
+ return _this;
1015
+ }
1016
+ Object.defineProperty(CalculateAreaExecutor.prototype, "id", {
1017
+ get: function () {
1018
+ return CalculateAreaExecutor.ID;
1019
+ },
1020
+ enumerable: false,
1021
+ configurable: true
1022
+ });
1023
+ return CalculateAreaExecutor;
1024
+ }(postboy.PostboyExecutor));
1025
+ CalculateAreaExecutor.ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
1026
+
1006
1027
  var AddLayerCommand = /** @class */ (function (_super) {
1007
1028
  __extends(AddLayerCommand, _super);
1008
1029
  function AddLayerCommand(layer) {
@@ -1188,6 +1209,11 @@
1188
1209
  return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
1189
1210
  return false;
1190
1211
  };
1212
+ FeatureService.calculateArea = function (g) {
1213
+ if (!g)
1214
+ return 0;
1215
+ return Sphere__namespace.getArea(g, { projection: 'EPSG:4326' });
1216
+ };
1191
1217
  return FeatureService;
1192
1218
  }());
1193
1219
 
@@ -1780,6 +1806,7 @@
1780
1806
  };
1781
1807
  MessageRegistratorService.prototype.setExecutors = function () {
1782
1808
  this.registerExecutor(FilterFeaturesInAreaExecutor.ID, function (e) { return FeatureService.filterFeaturesInArea(e); });
1809
+ this.registerExecutor(CalculateAreaExecutor.ID, function (e) { var _a, _b; return FeatureService.calculateArea((_b = (_a = e.polygon) === null || _a === void 0 ? void 0 : _a.feature) === null || _b === void 0 ? void 0 : _b.getGeometry()); });
1783
1810
  this.registerExecutor(GenerateDrawExecutor.ID, function (e) { return DrawingGenerationService.getDraw(e); });
1784
1811
  this.registerExecutor(GenerateZoomControlExecutor.ID, function (e) { return ZoomControlFactory.build(e.settings); });
1785
1812
  };
@@ -3013,6 +3040,7 @@
3013
3040
  */
3014
3041
 
3015
3042
  exports.AddControlCommand = AddControlCommand;
3043
+ exports.CalculateAreaExecutor = CalculateAreaExecutor;
3016
3044
  exports.CancelDrawingCommand = CancelDrawingCommand;
3017
3045
  exports.CancelFeatureModificationCommand = CancelFeatureModificationCommand;
3018
3046
  exports.CloseTooltipCommand = CloseTooltipCommand;