@artstesh/maps 1.1.27 → 1.1.28

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 (41) hide show
  1. package/dist/bundles/maps-components-src-map.umd.js +73 -11
  2. package/dist/bundles/maps-components-src-map.umd.js.map +1 -1
  3. package/dist/bundles/maps-components.umd.js +73 -11
  4. package/dist/bundles/maps-components.umd.js.map +1 -1
  5. package/dist/esm2015/map/helpers/text-style.helper.js +15 -7
  6. package/dist/esm2015/map/messages/commands/start-drawing.command.js +1 -1
  7. package/dist/esm2015/map/messages/executors/generate-draw.executor.js +1 -1
  8. package/dist/esm2015/map/messages/executors/get-geometry-length.executor.js +16 -0
  9. package/dist/esm2015/map/messages/index.js +2 -1
  10. package/dist/esm2015/map/models/drawing-type.enum.js +2 -1
  11. package/dist/esm2015/map/ol-proxy.js +4 -1
  12. package/dist/esm2015/map/services/drawing/drawing-generation.service.js +2 -2
  13. package/dist/esm2015/map/services/message-registrator.service.js +3 -1
  14. package/dist/esm2015/src/map/helpers/text-style.helper.js +15 -7
  15. package/dist/esm2015/src/map/messages/commands/start-drawing.command.js +1 -1
  16. package/dist/esm2015/src/map/messages/executors/generate-draw.executor.js +1 -1
  17. package/dist/esm2015/src/map/messages/executors/get-geometry-length.executor.js +16 -0
  18. package/dist/esm2015/src/map/messages/index.js +2 -1
  19. package/dist/esm2015/src/map/models/drawing-type.enum.js +2 -1
  20. package/dist/esm2015/src/map/ol-proxy.js +4 -1
  21. package/dist/esm2015/src/map/services/drawing/drawing-generation.service.js +2 -2
  22. package/dist/esm2015/src/map/services/message-registrator.service.js +3 -1
  23. package/dist/fesm2015/maps-components-src-map.js +41 -13
  24. package/dist/fesm2015/maps-components-src-map.js.map +1 -1
  25. package/dist/fesm2015/maps-components.js +41 -13
  26. package/dist/fesm2015/maps-components.js.map +1 -1
  27. package/dist/map/helpers/text-style.helper.d.ts +10 -6
  28. package/dist/map/messages/commands/start-drawing.command.d.ts +3 -3
  29. package/dist/map/messages/executors/generate-draw.executor.d.ts +3 -3
  30. package/dist/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  31. package/dist/map/messages/index.d.ts +1 -0
  32. package/dist/map/models/drawing-type.enum.d.ts +2 -1
  33. package/dist/map/ol-proxy.d.ts +4 -0
  34. package/dist/src/map/helpers/text-style.helper.d.ts +10 -6
  35. package/dist/src/map/messages/commands/start-drawing.command.d.ts +3 -3
  36. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +3 -3
  37. package/dist/src/map/messages/executors/get-geometry-length.executor.d.ts +11 -0
  38. package/dist/src/map/messages/index.d.ts +1 -0
  39. package/dist/src/map/models/drawing-type.enum.d.ts +2 -1
  40. package/dist/src/map/ol-proxy.d.ts +4 -0
  41. package/package.json +1 -1
@@ -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/geom/Polygon'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/interaction'), require('ol/interaction/Draw'), require('ol/sphere'), require('rxjs'), require('rxjs/operators'), require('@artstesh/collections'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/source/Cluster'), require('ol/source/ImageStatic'), require('ol/layer/Image'), require('ol/source/Raster'), 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/geom/Polygon', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/interaction', 'ol/interaction/Draw', 'ol/sphere', 'rxjs', 'rxjs/operators', '@artstesh/collections', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/source/Cluster', 'ol/source/ImageStatic', 'ol/layer/Image', 'ol/source/Raster', '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.Polygon, global.control, global.proj, global.postboy, global.interaction, global.Draw, global.Sphere, global.rxjs, global.rxjs.operators, global.collections, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Cluster, global.Static, global.ImageLayer, global.RasterSource, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326));
5
- })(this, (function (exports, i0, i6, ol, geom, format, extent, Polygon, control, proj, postboy, interaction, Draw, Sphere, rxjs, operators, collections, source, TileLayer, OSM, layer, loadingstrategy, Cluster, Static, ImageLayer, RasterSource, 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/geom/Polygon'), require('ol/control'), require('ol/proj'), require('@artstesh/postboy'), require('ol/sphere'), require('ol/interaction'), require('ol/interaction/Draw'), require('rxjs'), require('rxjs/operators'), require('@artstesh/collections'), require('ol/source'), require('ol/layer/Tile'), require('ol/source/OSM'), require('ol/layer'), require('ol/loadingstrategy'), require('ol/source/Cluster'), require('ol/source/ImageStatic'), require('ol/layer/Image'), require('ol/source/Raster'), require('ol/Map'), require('ol/View'), require('ol/Overlay'), require('ol/style/Style'), require('ol/style'), require('ol/proj/epsg4326'), require('ol/style/Circle')) :
3
+ typeof define === 'function' && define.amd ? define('maps-components/src/map', ['exports', '@angular/core', '@angular/common', 'ol', 'ol/geom', 'ol/format', 'ol/extent', 'ol/geom/Polygon', 'ol/control', 'ol/proj', '@artstesh/postboy', 'ol/sphere', 'ol/interaction', 'ol/interaction/Draw', 'rxjs', 'rxjs/operators', '@artstesh/collections', 'ol/source', 'ol/layer/Tile', 'ol/source/OSM', 'ol/layer', 'ol/loadingstrategy', 'ol/source/Cluster', 'ol/source/ImageStatic', 'ol/layer/Image', 'ol/source/Raster', 'ol/Map', 'ol/View', 'ol/Overlay', 'ol/style/Style', 'ol/style', 'ol/proj/epsg4326', 'ol/style/Circle'], 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.Polygon, global.control, global.proj, global.postboy, global.Sphere, global.interaction, global.Draw, global.rxjs, global.rxjs.operators, global.collections, global.source, global.TileLayer, global.OSM, global.layer, global.loadingstrategy, global.Cluster, global.Static, global.ImageLayer, global.RasterSource, global.Map, global.View, global.Overlay, global.Style, global.style, global.epsg4326, global.Circle));
5
+ })(this, (function (exports, i0, i6, ol, geom, format, extent, Polygon, control, proj, postboy, Sphere, interaction, Draw, rxjs, operators, collections, source, TileLayer, OSM, layer, loadingstrategy, Cluster, Static, ImageLayer, RasterSource, Map, View, Overlay, Style, style, epsg4326, Circle) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -38,6 +38,7 @@
38
38
  var View__default = /*#__PURE__*/_interopDefaultLegacy(View);
39
39
  var Overlay__default = /*#__PURE__*/_interopDefaultLegacy(Overlay);
40
40
  var Style__default = /*#__PURE__*/_interopDefaultLegacy(Style);
41
+ var Circle__namespace = /*#__PURE__*/_interopNamespace(Circle);
41
42
 
42
43
  var DestructibleComponent = /** @class */ (function () {
43
44
  function DestructibleComponent() {
@@ -764,6 +765,7 @@
764
765
  DrawingType[DrawingType["Circle"] = 2] = "Circle";
765
766
  DrawingType[DrawingType["Square"] = 3] = "Square";
766
767
  DrawingType[DrawingType["Box"] = 4] = "Box";
768
+ DrawingType[DrawingType["LineString"] = 5] = "LineString";
767
769
  })(exports.DrawingType || (exports.DrawingType = {}));
768
770
 
769
771
  /**
@@ -1266,6 +1268,27 @@
1266
1268
  }(postboy.PostboyGenericMessage));
1267
1269
  FitToFeaturesCommand.ID = '04d67609-0b4c-4f52-aa53-ad0a3db967dc';
1268
1270
 
1271
+ var GetGeometryLengthExecutor = /** @class */ (function (_super) {
1272
+ __extends(GetGeometryLengthExecutor, _super);
1273
+ function GetGeometryLengthExecutor(geometry, projection) {
1274
+ if (projection === void 0) { projection = 'EPSG:4326'; }
1275
+ var _this = _super.call(this) || this;
1276
+ _this.geometry = geometry;
1277
+ _this.projection = projection;
1278
+ return _this;
1279
+ }
1280
+ return GetGeometryLengthExecutor;
1281
+ }(postboy.PostboyExecutor));
1282
+ GetGeometryLengthExecutor.ID = '763146df-6d93-4dc2-a532-0e9ba2b2d023';
1283
+ var GetGeometryLengthExecutorHandler = /** @class */ (function () {
1284
+ function GetGeometryLengthExecutorHandler() {
1285
+ }
1286
+ GetGeometryLengthExecutorHandler.prototype.handle = function (executor) {
1287
+ return Math.round(Sphere.getLength(executor.geometry, { projection: executor.projection }) * 100) / 100;
1288
+ };
1289
+ return GetGeometryLengthExecutorHandler;
1290
+ }());
1291
+
1269
1292
  var AddLayerCommand = /** @class */ (function (_super) {
1270
1293
  __extends(AddLayerCommand, _super);
1271
1294
  function AddLayerCommand(layer) {
@@ -1348,7 +1371,7 @@
1348
1371
  DrawingGenerationService.getDraw = function (ev) {
1349
1372
  return new interaction.Draw({
1350
1373
  source: ev.layer.getSource(),
1351
- type: ev.type === exports.DrawingType.Polygon ? 'Polygon' : 'Circle',
1374
+ type: ev.type === exports.DrawingType.Polygon ? 'Polygon' : ev.type === exports.DrawingType.LineString ? 'LineString' : 'Circle',
1352
1375
  style: ev.style,
1353
1376
  geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
1354
1377
  });
@@ -2115,6 +2138,7 @@
2115
2138
  this.recordExecutor(GenerateDrawExecutor, function (e) { return DrawingGenerationService.getDraw(e); });
2116
2139
  this.recordExecutor(GenerateZoomControlExecutor, function (e) { return ZoomControlFactory.build(e.settings); });
2117
2140
  this.recordExecutor(GetMapPositionExecutor, function () { return _this.state.getMapPosition(); });
2141
+ this.recordExecutor(GetGeometryLengthExecutor, function (e) { return new GetGeometryLengthExecutorHandler().handle(e); });
2118
2142
  };
2119
2143
  return MessageRegistratorService;
2120
2144
  }(postboy.PostboyAbstractRegistrator));
@@ -4167,14 +4191,18 @@
4167
4191
  function TextStyleHelper() {
4168
4192
  }
4169
4193
  /**
4170
- * Creates a new instance of the Text class with the specified properties.
4194
+ * Creates and returns a new Text instance with specified styling properties.
4171
4195
  *
4172
- * @param {string} text - The text content of the Text object.
4173
- * @param {string} font - The font style of the Text object.
4174
- * @param {string} color - The color of the Text object.
4175
- * @return {Text} A new instance of the Text class.
4196
+ * @param {string} text - The text content to display.
4197
+ * @param {string} font - The font style to use for the text.
4198
+ * @param {string} color - The color of the text.
4199
+ * @param {string|null|undefined} [backColor] - The background color of the text. Optional.
4200
+ * @param {number[]|null|undefined} [padding] - The padding around the text in pixels. Optional.
4201
+ * @param {string|null|undefined} [textBaseline] - The text baseline alignment. Optional.
4202
+ * @param {number|null|undefined} [offsetY] - The vertical offset for the text. Optional.
4203
+ * @return {Text} A new Text instance configured with the specified properties.
4176
4204
  */
4177
- TextStyleHelper.get = function (text, font, color) {
4205
+ TextStyleHelper.get = function (text, font, color, backColor, padding, textBaseline, offsetY) {
4178
4206
  return new style.Text({
4179
4207
  text: text,
4180
4208
  font: font,
@@ -4182,6 +4210,10 @@
4182
4210
  fill: new style.Fill({
4183
4211
  color: color,
4184
4212
  }),
4213
+ backgroundFill: backColor ? new style.Fill({ color: backColor }) : undefined,
4214
+ padding: padding !== null && padding !== void 0 ? padding : undefined,
4215
+ textBaseline: textBaseline !== null && textBaseline !== void 0 ? textBaseline : undefined,
4216
+ offsetY: offsetY !== null && offsetY !== void 0 ? offsetY : undefined,
4185
4217
  });
4186
4218
  };
4187
4219
  return TextStyleHelper;
@@ -4256,10 +4288,39 @@
4256
4288
  enumerable: true,
4257
4289
  get: function () { return ol.Feature; }
4258
4290
  });
4291
+ Object.defineProperty(exports, 'Geometry', {
4292
+ enumerable: true,
4293
+ get: function () { return geom.Geometry; }
4294
+ });
4295
+ Object.defineProperty(exports, 'LineString', {
4296
+ enumerable: true,
4297
+ get: function () { return geom.LineString; }
4298
+ });
4299
+ Object.defineProperty(exports, 'Point', {
4300
+ enumerable: true,
4301
+ get: function () { return geom.Point; }
4302
+ });
4303
+ Object.defineProperty(exports, 'Fill', {
4304
+ enumerable: true,
4305
+ get: function () { return style.Fill; }
4306
+ });
4307
+ Object.defineProperty(exports, 'RegularShape', {
4308
+ enumerable: true,
4309
+ get: function () { return style.RegularShape; }
4310
+ });
4311
+ Object.defineProperty(exports, 'Stroke', {
4312
+ enumerable: true,
4313
+ get: function () { return style.Stroke; }
4314
+ });
4259
4315
  Object.defineProperty(exports, 'Style', {
4260
4316
  enumerable: true,
4261
4317
  get: function () { return style.Style; }
4262
4318
  });
4319
+ Object.defineProperty(exports, 'Text', {
4320
+ enumerable: true,
4321
+ get: function () { return style.Text; }
4322
+ });
4323
+ exports.CircleStyle = Circle__namespace;
4263
4324
  exports.AddControlCommand = AddControlCommand;
4264
4325
  exports.CalculateAreaExecutor = CalculateAreaExecutor;
4265
4326
  exports.CancelDrawingCommand = CancelDrawingCommand;
@@ -4276,6 +4337,7 @@
4276
4337
  exports.FitToPolygonsCommand = FitToPolygonsCommand;
4277
4338
  exports.GetFeaturesInAreaQuery = GetFeaturesInAreaQuery;
4278
4339
  exports.GetFeaturesInPointQuery = GetFeaturesInPointQuery;
4340
+ exports.GetGeometryLengthExecutor = GetGeometryLengthExecutor;
4279
4341
  exports.GetMapPositionExecutor = GetMapPositionExecutor;
4280
4342
  exports.ImageLayerComponent = ImageLayerComponent;
4281
4343
  exports.ImageLayerSettings = ImageLayerSettings;