react-spatial 1.12.0 → 1.12.1

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 (50) hide show
  1. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +51 -51
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +2 -2
  3. package/components/BasicMap/BasicMap.js +80 -80
  4. package/components/BasicMap/BasicMap.js.map +2 -2
  5. package/components/CanvasSaveButton/CanvasSaveButton.js +68 -68
  6. package/components/CanvasSaveButton/CanvasSaveButton.js.map +2 -2
  7. package/components/Copyright/Copyright.js +12 -12
  8. package/components/Copyright/Copyright.js.map +2 -2
  9. package/components/FeatureExportButton/FeatureExportButton.js +5 -5
  10. package/components/FeatureExportButton/FeatureExportButton.js.map +2 -2
  11. package/components/FitExtent/FitExtent.js +15 -15
  12. package/components/FitExtent/FitExtent.js.map +2 -2
  13. package/components/Geolocation/Geolocation.js +96 -96
  14. package/components/Geolocation/Geolocation.js.map +2 -2
  15. package/components/LayerTree/LayerTree.js +172 -172
  16. package/components/LayerTree/LayerTree.js.map +2 -2
  17. package/components/MousePosition/MousePosition.js +27 -27
  18. package/components/MousePosition/MousePosition.js.map +2 -2
  19. package/components/NorthArrow/NorthArrow.js +13 -13
  20. package/components/NorthArrow/NorthArrow.js.map +2 -2
  21. package/components/Overlay/Overlay.js +49 -49
  22. package/components/Overlay/Overlay.js.map +2 -2
  23. package/components/Permalink/Permalink.js +70 -70
  24. package/components/Permalink/Permalink.js.map +2 -2
  25. package/components/Popup/Popup.js +73 -73
  26. package/components/Popup/Popup.js.map +2 -2
  27. package/components/ResizeHandler/ResizeHandler.js +51 -49
  28. package/components/ResizeHandler/ResizeHandler.js.map +2 -2
  29. package/components/RouteSchedule/RouteSchedule.js +86 -74
  30. package/components/RouteSchedule/RouteSchedule.js.map +2 -2
  31. package/components/RouteSchedule/RouteSchedule.scss +0 -20
  32. package/components/ScaleLine/ScaleLine.js +2 -2
  33. package/components/ScaleLine/ScaleLine.js.map +2 -2
  34. package/components/StopsFinder/StopsFinder.js +21 -21
  35. package/components/StopsFinder/StopsFinder.js.map +2 -2
  36. package/components/StopsFinder/StopsFinderOption.js +3 -3
  37. package/components/StopsFinder/StopsFinderOption.js.map +2 -2
  38. package/components/Zoom/Zoom.js +35 -35
  39. package/components/Zoom/Zoom.js.map +2 -2
  40. package/package.json +33 -29
  41. package/propTypes.js +10 -10
  42. package/propTypes.js.map +2 -2
  43. package/utils/GlobalsForOle.js +57 -57
  44. package/utils/GlobalsForOle.js.map +2 -2
  45. package/utils/KML.js +32 -32
  46. package/utils/KML.js.map +2 -2
  47. package/utils/Styles.js +7 -7
  48. package/utils/Styles.js.map +2 -2
  49. package/utils/timeUtils.js +6 -6
  50. package/utils/timeUtils.js.map +2 -2
@@ -1,85 +1,85 @@
1
- import OLVectorLayer from "ol/layer/Vector";
2
- import VectorSource from "ol/source/Vector";
3
- import Control from "ol/control/Control";
4
- import Draw from "ol/interaction/Draw";
5
- import Snap from "ol/interaction/Snap";
6
- import Pointer from "ol/interaction/Pointer";
7
- import Select from "ol/interaction/Select";
8
- import Modify from "ol/interaction/Modify";
9
- import Style from "ol/style/Style";
10
- import Fill from "ol/style/Fill";
11
- import Stroke from "ol/style/Stroke";
12
- import Circle from "ol/style/Circle";
13
- import Icon from "ol/style/Icon";
14
- import RegularShape from "ol/style/RegularShape";
1
+ import { OL3Parser } from "jsts/org/locationtech/jts/io";
2
+ import { BufferOp } from "jsts/org/locationtech/jts/operation/buffer";
3
+ import { OverlayOp } from "jsts/org/locationtech/jts/operation/overlay";
15
4
  import Collection from "ol/Collection";
16
- import Feature from "ol/Feature";
17
- import Observable, { unByKey } from "ol/Observable";
5
+ import Control from "ol/control/Control";
6
+ import * as events from "ol/events";
7
+ import * as condition from "ol/events/condition";
18
8
  import { getCenter } from "ol/extent";
9
+ import Feature from "ol/Feature";
19
10
  import {
20
- Point,
21
11
  LineString,
22
- Polygon,
23
- MultiPoint,
24
12
  MultiLineString,
25
- MultiPolygon
13
+ MultiPoint,
14
+ MultiPolygon,
15
+ Point,
16
+ Polygon
26
17
  } from "ol/geom";
27
18
  import LinearRing from "ol/geom/LinearRing";
28
19
  import { fromExtent } from "ol/geom/Polygon";
29
- import * as events from "ol/events";
30
- import * as condition from "ol/events/condition";
31
- import { OL3Parser } from "jsts/org/locationtech/jts/io";
32
- import { BufferOp } from "jsts/org/locationtech/jts/operation/buffer";
33
- import { OverlayOp } from "jsts/org/locationtech/jts/operation/overlay";
20
+ import Draw from "ol/interaction/Draw";
21
+ import Modify from "ol/interaction/Modify";
22
+ import Pointer from "ol/interaction/Pointer";
23
+ import Select from "ol/interaction/Select";
24
+ import Snap from "ol/interaction/Snap";
25
+ import OLVectorLayer from "ol/layer/Vector";
26
+ import Observable, { unByKey } from "ol/Observable";
27
+ import VectorSource from "ol/source/Vector";
28
+ import Circle from "ol/style/Circle";
29
+ import Fill from "ol/style/Fill";
30
+ import Icon from "ol/style/Icon";
31
+ import RegularShape from "ol/style/RegularShape";
32
+ import Stroke from "ol/style/Stroke";
33
+ import Style from "ol/style/Style";
34
34
  if (!window.ol) {
35
35
  window.ol = {
36
- Feature,
37
36
  Collection,
38
- layer: {
39
- Vector: OLVectorLayer
40
- },
41
- source: {
42
- Vector: VectorSource
43
- },
44
- interaction: {
45
- Draw,
46
- Snap,
47
- Pointer,
48
- Select,
49
- Modify
50
- },
51
37
  control: {
52
38
  Control
53
39
  },
54
- style: {
55
- Style,
56
- Fill,
57
- Stroke,
58
- Circle,
59
- RegularShape,
60
- Icon
40
+ events: {
41
+ ...events,
42
+ condition: {
43
+ ...condition
44
+ }
61
45
  },
46
+ extent: {
47
+ getCenter
48
+ },
49
+ Feature,
62
50
  geom: {
63
- Point,
51
+ LinearRing,
64
52
  LineString,
65
- Polygon,
66
- MultiPoint,
67
53
  MultiLineString,
54
+ MultiPoint,
68
55
  MultiPolygon,
69
- LinearRing
56
+ Point,
57
+ Polygon
70
58
  },
71
- extent: {
72
- getCenter
59
+ interaction: {
60
+ Draw,
61
+ Modify,
62
+ Pointer,
63
+ Select,
64
+ Snap
65
+ },
66
+ layer: {
67
+ Vector: OLVectorLayer
73
68
  },
74
69
  Observable: {
75
70
  ...Observable,
76
71
  unByKey
77
72
  },
78
- events: {
79
- ...events,
80
- condition: {
81
- ...condition
82
- }
73
+ source: {
74
+ Vector: VectorSource
75
+ },
76
+ style: {
77
+ Circle,
78
+ Fill,
79
+ Icon,
80
+ RegularShape,
81
+ Stroke,
82
+ Style
83
83
  }
84
84
  };
85
85
  window.ol.geom.Polygon.fromExtent = fromExtent;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/GlobalsForOle.js"],
4
- "sourcesContent": ["import OLVectorLayer from \"ol/layer/Vector\";\nimport VectorSource from \"ol/source/Vector\";\nimport Control from \"ol/control/Control\";\nimport Draw from \"ol/interaction/Draw\";\nimport Snap from \"ol/interaction/Snap\";\nimport Pointer from \"ol/interaction/Pointer\";\nimport Select from \"ol/interaction/Select\";\nimport Modify from \"ol/interaction/Modify\";\nimport Style from \"ol/style/Style\";\nimport Fill from \"ol/style/Fill\";\nimport Stroke from \"ol/style/Stroke\";\nimport Circle from \"ol/style/Circle\";\nimport Icon from \"ol/style/Icon\";\nimport RegularShape from \"ol/style/RegularShape\";\nimport Collection from \"ol/Collection\";\nimport Feature from \"ol/Feature\";\nimport Observable, { unByKey } from \"ol/Observable\";\nimport { getCenter } from \"ol/extent\";\nimport {\n Point,\n LineString,\n Polygon,\n MultiPoint,\n MultiLineString,\n MultiPolygon,\n} from \"ol/geom\";\nimport LinearRing from \"ol/geom/LinearRing\";\nimport { fromExtent } from \"ol/geom/Polygon\";\nimport * as events from \"ol/events\";\nimport * as condition from \"ol/events/condition\";\nimport { OL3Parser } from \"jsts/org/locationtech/jts/io\";\nimport { BufferOp } from \"jsts/org/locationtech/jts/operation/buffer\";\nimport { OverlayOp } from \"jsts/org/locationtech/jts/operation/overlay\";\n\n/**\n * This module create window.ol and window.jsts variables for ole editor.\n */\nif (!window.ol) {\n window.ol = {\n Feature,\n Collection,\n layer: {\n Vector: OLVectorLayer,\n },\n source: {\n Vector: VectorSource,\n },\n interaction: {\n Draw,\n Snap,\n Pointer,\n Select,\n Modify,\n },\n control: {\n Control,\n },\n style: {\n Style,\n Fill,\n Stroke,\n Circle,\n RegularShape,\n Icon,\n },\n geom: {\n Point,\n LineString,\n Polygon,\n MultiPoint,\n MultiLineString,\n MultiPolygon,\n LinearRing,\n },\n extent: {\n getCenter,\n },\n Observable: {\n ...Observable,\n unByKey,\n },\n events: {\n ...events,\n condition: {\n ...condition,\n },\n },\n };\n window.ol.geom.Polygon.fromExtent = fromExtent;\n}\n\nif (!window.jsts) {\n window.jsts = {\n io: {\n OL3Parser,\n },\n operation: { buffer: { BufferOp }, overlay: { OverlayOp } },\n };\n}\n"],
5
- "mappings": "AAAA,OAAO,mBAAmB;AAC1B,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,kBAAkB;AACzB,OAAO,gBAAgB;AACvB,OAAO,aAAa;AACpB,OAAO,cAAc,eAAe;AACpC,SAAS,iBAAiB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,gBAAgB;AACvB,SAAS,kBAAkB;AAC3B,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAK1B,IAAI,CAAC,OAAO,IAAI;AACd,SAAO,KAAK;AAAA,IACV;AAAA,IACA;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,IACA,aAAa;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,MACP;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV,GAAG;AAAA,MACH;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,GAAG;AAAA,MACH,WAAW;AAAA,QACT,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AACA,SAAO,GAAG,KAAK,QAAQ,aAAa;AACtC;AAEA,IAAI,CAAC,OAAO,MAAM;AAChB,SAAO,OAAO;AAAA,IACZ,IAAI;AAAA,MACF;AAAA,IACF;AAAA,IACA,WAAW,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,UAAU,EAAE;AAAA,EAC5D;AACF;",
4
+ "sourcesContent": ["import { OL3Parser } from \"jsts/org/locationtech/jts/io\";\nimport { BufferOp } from \"jsts/org/locationtech/jts/operation/buffer\";\nimport { OverlayOp } from \"jsts/org/locationtech/jts/operation/overlay\";\nimport Collection from \"ol/Collection\";\nimport Control from \"ol/control/Control\";\nimport * as events from \"ol/events\";\nimport * as condition from \"ol/events/condition\";\nimport { getCenter } from \"ol/extent\";\nimport Feature from \"ol/Feature\";\nimport {\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n} from \"ol/geom\";\nimport LinearRing from \"ol/geom/LinearRing\";\nimport { fromExtent } from \"ol/geom/Polygon\";\nimport Draw from \"ol/interaction/Draw\";\nimport Modify from \"ol/interaction/Modify\";\nimport Pointer from \"ol/interaction/Pointer\";\nimport Select from \"ol/interaction/Select\";\nimport Snap from \"ol/interaction/Snap\";\nimport OLVectorLayer from \"ol/layer/Vector\";\nimport Observable, { unByKey } from \"ol/Observable\";\nimport VectorSource from \"ol/source/Vector\";\nimport Circle from \"ol/style/Circle\";\nimport Fill from \"ol/style/Fill\";\nimport Icon from \"ol/style/Icon\";\nimport RegularShape from \"ol/style/RegularShape\";\nimport Stroke from \"ol/style/Stroke\";\nimport Style from \"ol/style/Style\";\n\n/**\n * This module create window.ol and window.jsts variables for ole editor.\n */\nif (!window.ol) {\n window.ol = {\n Collection,\n control: {\n Control,\n },\n events: {\n ...events,\n condition: {\n ...condition,\n },\n },\n extent: {\n getCenter,\n },\n Feature,\n geom: {\n LinearRing,\n LineString,\n MultiLineString,\n MultiPoint,\n MultiPolygon,\n Point,\n Polygon,\n },\n interaction: {\n Draw,\n Modify,\n Pointer,\n Select,\n Snap,\n },\n layer: {\n Vector: OLVectorLayer,\n },\n Observable: {\n ...Observable,\n unByKey,\n },\n source: {\n Vector: VectorSource,\n },\n style: {\n Circle,\n Fill,\n Icon,\n RegularShape,\n Stroke,\n Style,\n },\n };\n window.ol.geom.Polygon.fromExtent = fromExtent;\n}\n\nif (!window.jsts) {\n window.jsts = {\n io: {\n OL3Parser,\n },\n operation: { buffer: { BufferOp }, overlay: { OverlayOp } },\n };\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,OAAO,gBAAgB;AACvB,OAAO,aAAa;AACpB,YAAY,YAAY;AACxB,YAAY,eAAe;AAC3B,SAAS,iBAAiB;AAC1B,OAAO,aAAa;AACpB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,OAAO,gBAAgB;AACvB,SAAS,kBAAkB;AAC3B,OAAO,UAAU;AACjB,OAAO,YAAY;AACnB,OAAO,aAAa;AACpB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,mBAAmB;AAC1B,OAAO,cAAc,eAAe;AACpC,OAAO,kBAAkB;AACzB,OAAO,YAAY;AACnB,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,kBAAkB;AACzB,OAAO,YAAY;AACnB,OAAO,WAAW;AAKlB,IAAI,CAAC,OAAO,IAAI;AACd,SAAO,KAAK;AAAA,IACV;AAAA,IACA,SAAS;AAAA,MACP;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,GAAG;AAAA,MACH,WAAW;AAAA,QACT,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,IACF;AAAA,IACA;AAAA,IACA,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,aAAa;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,OAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACV,GAAG;AAAA,MACH;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO,GAAG,KAAK,QAAQ,aAAa;AACtC;AAEA,IAAI,CAAC,OAAO,MAAM;AAChB,SAAO,OAAO;AAAA,IACZ,IAAI;AAAA,MACF;AAAA,IACF;AAAA,IACA,WAAW,EAAE,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,UAAU,EAAE;AAAA,EAC5D;AACF;",
6
6
  "names": []
7
7
  }
package/utils/KML.js CHANGED
@@ -1,16 +1,16 @@
1
- import KML from "ol/format/KML";
2
1
  import { Feature, getUid } from "ol";
3
- import Point from "ol/geom/Point";
4
- import MultiPoint from "ol/geom/MultiPoint";
5
- import GeometryCollection from "ol/geom/GeometryCollection";
6
- import { Style, Text, Icon, Circle, Fill, Stroke } from "ol/style";
7
2
  import { asString } from "ol/color";
8
- import { parse } from "ol/xml";
9
- import { fromCircle } from "ol/geom/Polygon";
10
- import { transform, get } from "ol/proj";
3
+ import KML from "ol/format/KML";
11
4
  import CircleGeom from "ol/geom/Circle";
12
- import { kmlStyle } from "./Styles";
5
+ import GeometryCollection from "ol/geom/GeometryCollection";
6
+ import MultiPoint from "ol/geom/MultiPoint";
7
+ import Point from "ol/geom/Point";
8
+ import { fromCircle } from "ol/geom/Polygon";
9
+ import { get, transform } from "ol/proj";
10
+ import { Circle, Fill, Icon, Stroke, Style, Text } from "ol/style";
11
+ import { parse } from "ol/xml";
13
12
  import getPolygonPattern from "./getPolygonPattern";
13
+ import { kmlStyle } from "./Styles";
14
14
  const CIRCLE_GEOMETRY_CENTER = "circleGeometryCenter";
15
15
  const CIRCLE_GEOMETRY_RADIUS = "circleGeometryRadius";
16
16
  const EPSG_4326 = get("EPSG:4326");
@@ -50,13 +50,13 @@ const getLineIcon = (feature, icon, color, start = true) => {
50
50
  return new Point(getVertexCoord(ge, start));
51
51
  },
52
52
  image: new Icon({
53
- src: icon.url,
54
53
  color,
55
- rotation: -rotation,
56
54
  rotateWithView: true,
55
+ rotation: -rotation,
57
56
  scale: icon.scale,
58
- size: icon.size
57
+ size: icon.size,
59
58
  // ie 11
59
+ src: icon.url
60
60
  }),
61
61
  zIndex: icon.zIndex
62
62
  });
@@ -105,8 +105,8 @@ const sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {
105
105
  if (feature.get("name") && style.getText() && style.getText().getScale() !== 0) {
106
106
  if (image && image.getScale() === 0) {
107
107
  image = new Circle({
108
- radius: 1,
109
108
  fill: new Fill({ color: [0, 0, 0, 0] }),
109
+ radius: 1,
110
110
  stroke: new Stroke({ color: [0, 0, 0, 0] })
111
111
  });
112
112
  }
@@ -130,19 +130,19 @@ const sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {
130
130
  name = [name, font];
131
131
  }
132
132
  text = new Text({
133
+ fill: style.getText().getFill(),
133
134
  font: font.replace(/bold/g, "normal"),
134
135
  // We manage bold in textArray
135
- text: name,
136
- fill: style.getText().getFill(),
137
136
  // rotation unsupported by KML, taken instead from custom field.
138
137
  rotation: feature.get("textRotation") || 0,
138
+ // stroke: style.getText().getStroke(),
139
+ scale: style.getText().getScale(),
139
140
  // since ol 6.3.1 : https://github.com/openlayers/openlayers/pull/10613/files#diff-1883da8b57e690db7ea0c35ce53c880aR925
140
141
  // a default textstroke is added to mimic google earth.
141
142
  // it was not the case before, the stroke was always null. So to keep
142
143
  // the same behavior we don't copy the stroke style.
143
144
  // TODO : maybe we should use this functionnality in the futur.
144
- // stroke: style.getText().getStroke(),
145
- scale: style.getText().getScale()
145
+ text: name
146
146
  });
147
147
  if (feature.get("textArray")) {
148
148
  try {
@@ -217,8 +217,8 @@ const sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {
217
217
  }
218
218
  return new Style({
219
219
  fill,
220
- stroke,
221
220
  image,
221
+ stroke,
222
222
  text,
223
223
  zIndex: style.getZIndex()
224
224
  });
@@ -228,8 +228,8 @@ const sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {
228
228
  styles = [
229
229
  new Style({
230
230
  fill: style.getFill(),
231
- stroke,
232
231
  image: null,
232
+ stroke,
233
233
  text: null,
234
234
  zIndex: style.getZIndex()
235
235
  })
@@ -317,11 +317,11 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
317
317
  clone.getGeometry().transform(featureProjection, EPSG_4326);
318
318
  Object.keys(feature.getProperties()).forEach((key) => {
319
319
  if (![
320
- "geometry",
321
- "name",
322
- "description",
323
320
  CIRCLE_GEOMETRY_CENTER,
324
- CIRCLE_GEOMETRY_RADIUS
321
+ CIRCLE_GEOMETRY_RADIUS,
322
+ "description",
323
+ "geometry",
324
+ "name"
325
325
  ].includes(key)) {
326
326
  clone.unset(key, true);
327
327
  }
@@ -335,9 +335,9 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
335
335
  const mainStyle = styles[0] || styles;
336
336
  const newStyle = {
337
337
  fill: mainStyle.getFill(),
338
+ image: mainStyle.getImage(),
338
339
  stroke: mainStyle.getStroke(),
339
340
  text: mainStyle.getText(),
340
- image: mainStyle.getImage(),
341
341
  zIndex: mainStyle.getZIndex()
342
342
  };
343
343
  if (newStyle.zIndex) {
@@ -445,8 +445,8 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
445
445
  }
446
446
  if (newStyle.text && !newStyle.image) {
447
447
  newStyle.image = new Icon({
448
- src: "noimage",
449
- scale: 0
448
+ scale: 0,
449
+ src: "noimage"
450
450
  });
451
451
  }
452
452
  const extraLineStyles = Array.isArray(styles) && styles.slice(1) || [];
@@ -458,9 +458,9 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
458
458
  clone.set(
459
459
  "lineStartIcon",
460
460
  JSON.stringify({
461
- url: extraLineStyle.getImage().getSrc(),
462
461
  scale: extraLineStyle.getImage().getScale(),
463
462
  size: extraLineStyle.getImage().getSize(),
463
+ url: extraLineStyle.getImage().getSrc(),
464
464
  zIndex: extraLineStyle.getZIndex()
465
465
  })
466
466
  );
@@ -468,9 +468,9 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
468
468
  clone.set(
469
469
  "lineEndIcon",
470
470
  JSON.stringify({
471
- url: extraLineStyle.getImage().getSrc(),
472
471
  scale: extraLineStyle.getImage().getScale(),
473
472
  size: extraLineStyle.getImage().getSize(),
473
+ url: extraLineStyle.getImage().getSrc(),
474
474
  zIndex: extraLineStyle.getZIndex()
475
475
  })
476
476
  );
@@ -488,8 +488,8 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
488
488
  exportFeatures.push(new Feature());
489
489
  }
490
490
  featString = new KML({
491
- extractStyles: true,
492
- defaultStyle: [kmlStyle]
491
+ defaultStyle: [kmlStyle],
492
+ extractStyles: true
493
493
  }).writeFeatures(exportFeatures);
494
494
  featString = featString.replace(
495
495
  /<Icon>\s*<href>noimage<\/href>\s*<\/Icon>/g,
@@ -531,7 +531,7 @@ const writeDocumentCamera = (kmlString, cameraAttributes) => {
531
531
  };
532
532
  export default {
533
533
  readFeatures,
534
- writeFeatures,
534
+ removeDocumentCamera,
535
535
  writeDocumentCamera,
536
- removeDocumentCamera
536
+ writeFeatures
537
537
  };
package/utils/KML.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/KML.js"],
4
- "sourcesContent": ["import KML from \"ol/format/KML\";\nimport { Feature, getUid } from \"ol\";\nimport Point from \"ol/geom/Point\";\nimport MultiPoint from \"ol/geom/MultiPoint\";\nimport GeometryCollection from \"ol/geom/GeometryCollection\";\nimport { Style, Text, Icon, Circle, Fill, Stroke } from \"ol/style\";\nimport { asString } from \"ol/color\";\nimport { parse } from \"ol/xml\";\nimport { fromCircle } from \"ol/geom/Polygon\";\nimport { transform, get } from \"ol/proj\";\nimport CircleGeom from \"ol/geom/Circle\";\nimport { kmlStyle } from \"./Styles\";\nimport getPolygonPattern from \"./getPolygonPattern\";\n\nconst CIRCLE_GEOMETRY_CENTER = \"circleGeometryCenter\";\nconst CIRCLE_GEOMETRY_RADIUS = \"circleGeometryRadius\";\nconst EPSG_4326 = get(\"EPSG:4326\");\n\n// Comes from ol >= 6.7,\n// https://github.com/openlayers/openlayers/blob/main/src/ol/format/KML.js#L320\nconst scaleForSize = (size) => {\n return 32 / Math.min(size[0], size[1]);\n};\n\nconst applyTextStyleForIcon = (olIcon, olText) => {\n const size = olIcon.getSize() || [48, 48];\n const scale = olIcon.getScale() || 1;\n const anchor = olIcon.getAnchor() || [\n (size[0] * scale) / 2,\n (size[1] * scale) / 2,\n ];\n const offset = [\n scale * (size[0] - anchor[0]) + 5,\n scale * (size[1] / 2 - anchor[1]),\n ];\n olText.setOffsetX(offset[0]);\n olText.setOffsetY(offset[1]);\n olText.setTextAlign(\"left\");\n};\n\nconst getVertexCoord = (geom, start = true, index = 0) => {\n const coords = geom.getCoordinates();\n const len = coords.length - 1;\n return start ? coords[index] : coords[len - index];\n};\n\nconst getLineIcon = (feature, icon, color, start = true) => {\n const geom = feature.getGeometry();\n const coordA = getVertexCoord(geom, start, 1);\n const coordB = getVertexCoord(geom, start);\n const dx = start ? coordA[0] - coordB[0] : coordB[0] - coordA[0];\n const dy = start ? coordA[1] - coordB[1] : coordB[1] - coordA[1];\n const rotation = Math.atan2(dy, dx);\n\n return new Style({\n geometry: (feat) => {\n const ge = feat.getGeometry();\n return new Point(getVertexCoord(ge, start));\n },\n image: new Icon({\n src: icon.url,\n color,\n rotation: -rotation,\n rotateWithView: true,\n scale: icon.scale,\n size: icon.size, // ie 11\n }),\n zIndex: icon.zIndex,\n });\n};\n\n// Clean the unneeded feature's style and properties created by the KML parser.\nconst sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {\n const geom = feature.getGeometry();\n let styles = feature.getStyleFunction();\n\n // Store maxZoom in properties\n if (feature.get(\"maxZoom\")) {\n feature.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // Store minZoom in properties\n if (feature.get(\"minZoom\")) {\n feature.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // The use of clone is part of the scale fix for OL > 6.7\n // If an IconStyle has no gx:w and gx:h defined, a scale factor is applied\n // after the image is loaded. To avoided having the scale factor applied we\n // clone the style and keep the scale as it is.\n // Having gx:w and gx:h not defined should not happen, using the last version of the parser/reader.\n const tmpStyles = styles(feature);\n const style = (Array.isArray(tmpStyles) ? tmpStyles[0] : tmpStyles).clone();\n\n let stroke = style.getStroke();\n\n if (feature.get(\"lineCap\")) {\n stroke?.setLineCap(feature.get(\"lineCap\"));\n }\n\n if (feature.get(\"lineJoin\")) {\n stroke?.setLineJoin(feature.get(\"lineJoin\"));\n }\n\n if (feature.get(\"lineDash\")) {\n stroke?.setLineDash(\n feature\n .get(\"lineDash\")\n .split(\",\")\n .map((l) => {\n return parseInt(l, 10);\n }),\n );\n }\n\n if (feature.get(\"lineDashOffset\")) {\n stroke?.setLineDashOffset(parseInt(feature.get(\"lineDashOffset\"), 10));\n }\n\n if (feature.get(\"miterLimit\")) {\n stroke?.setMiterLimit(parseInt(feature.get(\"miterLimit\"), 10));\n }\n\n // The canvas draws a stroke width=1 by default if width=0, so we\n // remove the stroke style in that case.\n if (stroke && stroke.getWidth() === 0) {\n stroke = undefined;\n }\n\n if (feature.get(\"zIndex\")) {\n style.setZIndex(parseInt(feature.get(\"zIndex\"), 10));\n }\n\n // if the feature is a Point and we are offline, we use default vector\n // style.\n // if the feature is a Point and has a name with a text style, we\n // create a correct text style.\n // TODO Handle GeometryCollection displaying name on the first Point\n // geometry.\n if (style && (geom instanceof Point || geom instanceof MultiPoint)) {\n let image = style.getImage();\n let text = null;\n let fill = style.getFill();\n\n // If the feature has name we display it on the map as Google does\n if (\n feature.get(\"name\") &&\n style.getText() &&\n style.getText().getScale() !== 0\n ) {\n if (image && image.getScale() === 0) {\n // transparentCircle is used to allow selection\n image = new Circle({\n radius: 1,\n fill: new Fill({ color: [0, 0, 0, 0] }),\n stroke: new Stroke({ color: [0, 0, 0, 0] }),\n });\n }\n\n // We replace empty white spaces used to keep normal spaces before and after the name.\n let name = feature.get(\"name\");\n if (/\\u200B/g.test(name)) {\n name = name.replace(/\\u200B/g, \"\");\n feature.set(\"name\", name);\n }\n\n // For backward compatibility we translate the bold and italic textFont property to a textArray prop\n const font = feature.get(\"textFont\") || \"normal 16px Helvetica\";\n\n // Since we use rich text in mapset editor we use a text array instead,\n // it's only necessary when there is new lines in the text\n // Manage new lines\n if (/\\n/.test(name)) {\n const array = [];\n const split = name.split(\"\\n\");\n split.forEach((txt, idx) => {\n array.push(txt || \"\\u200B\", txt ? font : \"\");\n\n if (idx < split.length - 1) {\n array.push(\"\\n\", \"\");\n }\n });\n name = array;\n } else {\n name = [name, font];\n }\n\n text = new Text({\n font: font.replace(/bold/g, \"normal\"), // We manage bold in textArray\n text: name,\n fill: style.getText().getFill(),\n // rotation unsupported by KML, taken instead from custom field.\n rotation: feature.get(\"textRotation\") || 0,\n // since ol 6.3.1 : https://github.com/openlayers/openlayers/pull/10613/files#diff-1883da8b57e690db7ea0c35ce53c880aR925\n // a default textstroke is added to mimic google earth.\n // it was not the case before, the stroke was always null. So to keep\n // the same behavior we don't copy the stroke style.\n // TODO : maybe we should use this functionnality in the futur.\n // stroke: style.getText().getStroke(),\n scale: style.getText().getScale(),\n });\n\n if (feature.get(\"textArray\")) {\n try {\n const textArray = JSON.parse(feature.get(\"textArray\"));\n text.setText(textArray);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(\n \"Error parsing textArray\",\n feature.get(\"textArray\"),\n err,\n );\n }\n }\n\n if (feature.get(\"textStrokeColor\") && feature.get(\"textStrokeWidth\")) {\n text.setStroke(\n new Stroke({\n color: feature.get(\"textStrokeColor\"),\n width: parseFloat(feature.get(\"textStrokeWidth\")),\n }),\n );\n }\n\n if (feature.get(\"textAlign\")) {\n text.setTextAlign(feature.get(\"textAlign\"));\n }\n\n if (feature.get(\"textOffsetX\")) {\n text.setOffsetX(parseFloat(feature.get(\"textOffsetX\")));\n }\n\n if (feature.get(\"textOffsetY\")) {\n text.setOffsetY(parseFloat(feature.get(\"textOffsetY\")));\n }\n\n if (feature.get(\"textBackgroundFillColor\")) {\n text.setBackgroundFill(\n new Fill({\n color: feature.get(\"textBackgroundFillColor\"),\n }),\n );\n }\n\n if (feature.get(\"textPadding\")) {\n text.setPadding(\n feature\n .get(\"textPadding\")\n .split(\",\")\n .map((n) => {\n return parseFloat(n);\n }),\n );\n }\n if (image instanceof Icon) {\n applyTextStyleForIcon(image, text);\n }\n }\n\n if (image instanceof Icon) {\n /* Apply icon rotation if defined (by default only written as\n * <heading> tag, which is not read as rotation value by the ol KML module)\n */\n image.setRotation(parseFloat(feature.get(\"iconRotation\")) || 0);\n\n if (feature.get(\"iconScale\")) {\n image.setScale(parseFloat(feature.get(\"iconScale\")) || 0);\n\n // We fix the 32px scaling introduced by OL 6.7 only if the image has a size defined.\n } else if (!doNotRevert32pxScaling && image.getSize()) {\n const resizeScale = scaleForSize(image.getSize());\n image.setScale(image.getScaleArray()[0] / resizeScale);\n }\n }\n\n fill = undefined;\n stroke = undefined;\n\n styles = (feat, resolution) => {\n /* Options to be used for picture scaling with map, should have at least\n * a resolution attribute (this is the map resolution at the zoom level when\n * the picture is created), can take an optional constant for further scale\n * adjustment.\n * e.g. { resolution: 0.123, defaultScale: 1 / 6 }\n */\n\n if (feat.get(\"pictureOptions\")) {\n let pictureOptions = feat.get(\"pictureOptions\");\n if (typeof pictureOptions === \"string\") {\n pictureOptions = JSON.parse(pictureOptions);\n }\n feat.set(\"pictureOptions\", pictureOptions);\n if (pictureOptions.resolution) {\n image.setScale(\n (pictureOptions.resolution / resolution) *\n pictureOptions.defaultScale || 1,\n );\n }\n }\n\n return new Style({\n fill,\n stroke,\n image,\n text,\n zIndex: style.getZIndex(),\n });\n };\n }\n\n // Remove image and text styles for polygons and lines\n if (\n !(\n geom instanceof Point ||\n geom instanceof MultiPoint ||\n geom instanceof GeometryCollection\n )\n ) {\n styles = [\n new Style({\n fill: style.getFill(),\n stroke,\n image: null,\n text: null,\n zIndex: style.getZIndex(),\n }),\n ];\n\n // Parse the fillPattern json string and store parsed object\n let fillPattern = feature.get(\"fillPattern\");\n if (fillPattern) {\n fillPattern = JSON.parse(fillPattern);\n feature.set(\"fillPattern\", fillPattern);\n\n /* We set the fill pattern for polygons */\n if (!style.getFill()) {\n styles[0].setFill(new Fill());\n }\n const patternOrColor = fillPattern.empty\n ? [0, 0, 0, 0]\n : getPolygonPattern(fillPattern.id, fillPattern.color);\n styles[0].getFill().setColor(patternOrColor);\n }\n\n // Add line's icons styles\n if (feature.get(\"lineStartIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineStartIcon\")),\n stroke.getColor(),\n ),\n );\n }\n\n if (feature.get(\"lineEndIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineEndIcon\")),\n stroke.getColor(),\n false,\n ),\n );\n }\n }\n feature.setStyle(styles);\n};\n\n/**\n * Read a KML string.\n * @param {String} kmlString A string representing a KML file.\n * @param {<ol.Projection|String>} featureProjection The projection used by the map.\n * @param {<boolean>} doNotRevert32pxScaling Set it to true if you use ol < 6.7 and last version of react-spatial, Fix the 32px scaling, introduced by (ol >= 6.7), see https://github.com/openlayers/openlayers/pull/12695.\n */\nconst readFeatures = (\n kmlString,\n featureProjection,\n doNotRevert32pxScaling = false,\n) => {\n // Since ol 6.7, the KML follows better the spec and GoogleEarth interpretation, see https://github.com/openlayers/openlayers/pull/12695.\n // so the <scale> value is interpreted using an image size of 32px.\n // So when revert32pxScaling is true we fix back the scale, to use only, if you use an OL < 6.7.\n // Now the writeFeatures function use the iconScale extended data to set the image's scale.\n // If the extended data is not found it will look at this boolean to define if we must revert the scale or not.\n const features = new KML().readFeatures(kmlString, {\n featureProjection,\n });\n features.forEach((feature) => {\n // Transform back polygon to circle geometry\n const {\n [CIRCLE_GEOMETRY_CENTER]: circleGeometryCenter,\n [CIRCLE_GEOMETRY_RADIUS]: circleGeometryRadius,\n } = feature?.getProperties() || {};\n if (circleGeometryCenter && circleGeometryRadius) {\n const circle = new CircleGeom(\n transform(\n JSON.parse(circleGeometryCenter),\n EPSG_4326,\n featureProjection || EPSG_4326,\n ),\n parseFloat(circleGeometryRadius, 10),\n );\n circle.setProperties(feature.getGeometry().getProperties());\n feature.setGeometry(circle);\n }\n\n sanitizeFeature(feature, doNotRevert32pxScaling);\n });\n return features;\n};\n\n/**\n * Create a KML string.\n * @param {VectorLayer} layer A react-spatial VectorLayer.\n * @param {<ol.Projection|String>} featureProjection The current projection used by the features.\n * @param {<boolean>} fixGxyAndGxh If the KML contains gx:w and gx:h, (ol >= 6.7), it will fix the bug introduced by https://github.com/openlayers/openlayers/pull/12695.\n */\nconst writeFeatures = (layer, featureProjection, mapResolution) => {\n let featString;\n const { olLayer } = layer;\n const exportFeatures = [];\n\n [...olLayer.getSource().getFeatures()]\n .sort((a, b) => {\n // The order of features must be kept.\n // We could use the useSpatialIndex = false property on the layer\n // but we prefer to sort feature by ol uid because ol uid is an integer\n // increased on each creation of a feature.\n // So we will keep the order of creation made by the the KML parser.\n // Ideally we should order by the zIndex of the style only.\n if (getUid(a) <= getUid(b)) {\n return -1;\n }\n return 1;\n })\n .forEach((feature) => {\n const clone = feature.clone();\n if (clone.getGeometry().getType() === \"Circle\") {\n // We transform circle elements into polygons\n // because circle not supported in KML spec and in ol KML parser\n const circleGeom = feature.getGeometry();\n clone.setGeometry(fromCircle(circleGeom, 100));\n clone.set(\n CIRCLE_GEOMETRY_CENTER,\n JSON.stringify(\n transform(circleGeom.getCenter(), featureProjection, EPSG_4326),\n ),\n );\n clone.set(CIRCLE_GEOMETRY_RADIUS, circleGeom.getRadius());\n }\n clone.setId(feature.getId());\n clone.getGeometry().transform(featureProjection, EPSG_4326);\n\n // We remove all ExtendedData not related to style.\n Object.keys(feature.getProperties()).forEach((key) => {\n if (\n ![\n \"geometry\",\n \"name\",\n \"description\",\n CIRCLE_GEOMETRY_CENTER,\n CIRCLE_GEOMETRY_RADIUS,\n ].includes(key)\n ) {\n clone.unset(key, true);\n }\n });\n\n let styles;\n\n if (feature.getStyleFunction()) {\n styles = feature.getStyleFunction()(feature, mapResolution);\n } else if (olLayer && olLayer.getStyleFunction()) {\n styles = olLayer.getStyleFunction()(feature, mapResolution);\n }\n\n const mainStyle = styles[0] || styles;\n\n const newStyle = {\n fill: mainStyle.getFill(),\n stroke: mainStyle.getStroke(),\n text: mainStyle.getText(),\n image: mainStyle.getImage(),\n zIndex: mainStyle.getZIndex(),\n };\n\n if (newStyle.zIndex) {\n clone.set(\"zIndex\", newStyle.zIndex);\n }\n\n const text = newStyle.text?.getText();\n\n if (text) {\n let kmlText = text;\n\n if (Array.isArray(text)) {\n // text can be a string or an array of strings\n clone.set(\"textArray\", JSON.stringify(text));\n\n // in the KML we just add the text without the bold or italic information\n kmlText = text\n .map((t, idx) => {\n return idx % 2 === 0 ? t : \"\";\n })\n\n .join(\"\")\n .replaceAll(\"\\u200B\", \"\");\n }\n\n // We add the current text as features's name so it will be added as Placemark's name in the kml\n if (kmlText) {\n // If we see spaces at the beginning or at the end we add a empty\n // white space at the beginning and at the end.\n if (/^(\\s|\\n)|(\\n|\\s)$/g.test(kmlText)) {\n clone.set(\"name\", `\\u200B${kmlText}\\u200B`);\n } else {\n clone.set(\"name\", kmlText);\n }\n }\n }\n\n // Set custom properties to be converted in extendedData in KML.\n if (newStyle.text?.getRotation()) {\n clone.set(\"textRotation\", newStyle.text.getRotation());\n }\n\n if (newStyle.text?.getFont()) {\n clone.set(\"textFont\", newStyle.text.getFont());\n }\n\n if (newStyle.text?.getTextAlign()) {\n clone.set(\"textAlign\", newStyle.text.getTextAlign());\n }\n\n if (newStyle.text?.getOffsetX()) {\n clone.set(\"textOffsetX\", newStyle.text.getOffsetX());\n }\n\n if (newStyle.text?.getOffsetY()) {\n clone.set(\"textOffsetY\", newStyle.text.getOffsetY());\n }\n\n if (newStyle.text?.getStroke()) {\n if (newStyle.text.getStroke().getColor()) {\n clone.set(\n \"textStrokeColor\",\n asString(newStyle.text.getStroke().getColor()),\n );\n }\n\n if (newStyle.text.getStroke().getWidth()) {\n clone.set(\"textStrokeWidth\", newStyle.text.getStroke().getWidth());\n }\n }\n\n if (newStyle.text?.getBackgroundFill()) {\n clone.set(\n \"textBackgroundFillColor\",\n asString(newStyle.text.getBackgroundFill().getColor()),\n );\n }\n\n if (newStyle.text?.getPadding()) {\n clone.set(\"textPadding\", newStyle.text.getPadding().join());\n }\n\n if (newStyle.stroke?.getLineCap()) {\n clone.set(\"lineCap\", newStyle.stroke.getLineCap());\n }\n\n if (newStyle.stroke?.getLineJoin()) {\n clone.set(\"lineJoin\", newStyle.stroke.getLineJoin());\n }\n\n if (newStyle.stroke?.getLineDash()) {\n clone.set(\"lineDash\", newStyle.stroke.getLineDash().join(\",\"));\n }\n\n if (newStyle.stroke?.getLineDashOffset()) {\n clone.set(\"lineDashOffset\", newStyle.stroke.getLineDashOffset());\n }\n\n if (newStyle.stroke?.getMiterLimit()) {\n clone.set(\"miterLimit\", newStyle.stroke.getMiterLimit());\n }\n\n if (newStyle.image instanceof Circle) {\n newStyle.image = null;\n }\n\n if (newStyle.image) {\n const imgSource = newStyle.image.getSrc();\n if (!/(http(s?)):\\/\\//gi.test(imgSource)) {\n // eslint-disable-next-line no-console\n console.log(\n \"Local image source not supported for KML export.\" +\n \"Should use remote web server\",\n );\n }\n\n if (newStyle.image.getRotation()) {\n // We set the icon rotation as extended data\n clone.set(\"iconRotation\", newStyle.image.getRotation());\n }\n\n if (newStyle.image.getScale()) {\n // We set the scale as extended metadata because the <scale> in the KML is related to a 32px img, since ol >= 6.10.\n clone.set(\"iconScale\", newStyle.image.getScale());\n }\n\n // Set map resolution to use for icon-to-map proportional scaling\n if (feature.get(\"pictureOptions\")) {\n clone.set(\n \"pictureOptions\",\n JSON.stringify(feature.get(\"pictureOptions\")),\n );\n }\n }\n\n // In case a fill pattern should be applied (use fillPattern attribute to store pattern id, color etc)\n if (feature.get(\"fillPattern\")) {\n clone.set(\"fillPattern\", JSON.stringify(feature.get(\"fillPattern\")));\n newStyle.fill = null;\n }\n\n // maxZoom: maximum zoom level at which the feature is displayed\n if (feature.get(\"maxZoom\")) {\n clone.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // minZoom: minimum zoom level at which the feature is displayed\n if (feature.get(\"minZoom\")) {\n clone.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // If only text is displayed we must specify an\n // image style with scale=0\n if (newStyle.text && !newStyle.image) {\n newStyle.image = new Icon({\n src: \"noimage\",\n scale: 0,\n });\n }\n\n // In case we use line's icon .\n const extraLineStyles = (Array.isArray(styles) && styles.slice(1)) || [];\n extraLineStyles.forEach((extraLineStyle) => {\n if (\n extraLineStyle &&\n extraLineStyle.getImage() instanceof Icon &&\n extraLineStyle.getGeometry()\n ) {\n const coord = extraLineStyle.getGeometry()(feature).getCoordinates();\n const startCoord = feature.getGeometry().getFirstCoordinate();\n if (coord[0] === startCoord[0] && coord[1] === startCoord[1]) {\n clone.set(\n \"lineStartIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n } else {\n clone.set(\n \"lineEndIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n }\n }\n });\n\n const olStyle = new Style(newStyle);\n clone.setStyle(olStyle);\n\n if (\n !(\n clone.getGeometry() instanceof Point &&\n olStyle.getText() &&\n !olStyle.getText().getText()\n )\n ) {\n exportFeatures.push(clone);\n }\n });\n\n if (exportFeatures.length > 0) {\n if (exportFeatures.length === 1) {\n // force the add of a <Document> node\n exportFeatures.push(new Feature());\n }\n\n featString = new KML({\n extractStyles: true,\n defaultStyle: [kmlStyle],\n }).writeFeatures(exportFeatures);\n\n // Remove no image hack\n featString = featString.replace(\n /<Icon>\\s*<href>noimage<\\/href>\\s*<\\/Icon>/g,\n \"\",\n );\n\n // Remove empty placemark added to have\n // <Document> tag\n featString = featString.replace(/<Placemark\\/>/g, \"\");\n\n // Add KML document name\n if (layer.name) {\n featString = featString.replace(\n /<Document>/,\n `<Document><name>${layer.name}</name>`,\n );\n }\n }\n\n return featString;\n};\n\n/**\n * Removes the <Camera> tag from a KML string. Returns the KML string with removed <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n */\nconst removeDocumentCamera = (kmlString) => {\n const kmlDoc = parse(kmlString);\n // Remove old Camera node\n const oldCameraNode = kmlDoc.getElementsByTagName(\"Camera\")[0];\n if (oldCameraNode) {\n oldCameraNode.remove();\n }\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\n/**\n * Write the <Camera> tag into a KML string. Returns the KML string with added <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n * @param {Object} cameraAttributes Object containing the camera tags (longitude, latitude, altitude, heading, tilt, altitudeMode, roll)\n * as keys with corresponding values. See https://developers.google.com/kml/documentation/kmlreference#camera\n */\nconst writeDocumentCamera = (kmlString, cameraAttributes) => {\n const kmlDoc = parse(removeDocumentCamera(kmlString));\n\n if (cameraAttributes) {\n // Create Camera node with child attributes if the cameraAttributes object is defined\n const cameraNode = kmlDoc.createElement(\"Camera\");\n Object.keys(cameraAttributes).forEach((key) => {\n const cameraAttribute = kmlDoc.createElement(\n `${key.charAt(0).toUpperCase() + key.slice(1)}`,\n );\n cameraAttribute.innerHTML = cameraAttributes[key];\n cameraNode.appendChild(cameraAttribute);\n });\n const documentNode = kmlDoc.getElementsByTagName(\"Document\")[0];\n documentNode.appendChild(cameraNode);\n }\n\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\nexport default {\n readFeatures,\n writeFeatures,\n writeDocumentCamera,\n removeDocumentCamera,\n};\n"],
5
- "mappings": "AAAA,OAAO,SAAS;AAChB,SAAS,SAAS,cAAc;AAChC,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAC/B,SAAS,OAAO,MAAM,MAAM,QAAQ,MAAM,cAAc;AACxD,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,WAAW,WAAW;AAC/B,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AACzB,OAAO,uBAAuB;AAE9B,MAAM,yBAAyB;AAC/B,MAAM,yBAAyB;AAC/B,MAAM,YAAY,IAAI,WAAW;AAIjC,MAAM,eAAe,CAAC,SAAS;AAC7B,SAAO,KAAK,KAAK,IAAI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AA,EACA;AACF;",
4
+ "sourcesContent": ["import { Feature, getUid } from \"ol\";\nimport { asString } from \"ol/color\";\nimport KML from \"ol/format/KML\";\nimport CircleGeom from \"ol/geom/Circle\";\nimport GeometryCollection from \"ol/geom/GeometryCollection\";\nimport MultiPoint from \"ol/geom/MultiPoint\";\nimport Point from \"ol/geom/Point\";\nimport { fromCircle } from \"ol/geom/Polygon\";\nimport { get, transform } from \"ol/proj\";\nimport { Circle, Fill, Icon, Stroke, Style, Text } from \"ol/style\";\nimport { parse } from \"ol/xml\";\n\nimport getPolygonPattern from \"./getPolygonPattern\";\nimport { kmlStyle } from \"./Styles\";\n\nconst CIRCLE_GEOMETRY_CENTER = \"circleGeometryCenter\";\nconst CIRCLE_GEOMETRY_RADIUS = \"circleGeometryRadius\";\nconst EPSG_4326 = get(\"EPSG:4326\");\n\n// Comes from ol >= 6.7,\n// https://github.com/openlayers/openlayers/blob/main/src/ol/format/KML.js#L320\nconst scaleForSize = (size) => {\n return 32 / Math.min(size[0], size[1]);\n};\n\nconst applyTextStyleForIcon = (olIcon, olText) => {\n const size = olIcon.getSize() || [48, 48];\n const scale = olIcon.getScale() || 1;\n const anchor = olIcon.getAnchor() || [\n (size[0] * scale) / 2,\n (size[1] * scale) / 2,\n ];\n const offset = [\n scale * (size[0] - anchor[0]) + 5,\n scale * (size[1] / 2 - anchor[1]),\n ];\n olText.setOffsetX(offset[0]);\n olText.setOffsetY(offset[1]);\n olText.setTextAlign(\"left\");\n};\n\nconst getVertexCoord = (geom, start = true, index = 0) => {\n const coords = geom.getCoordinates();\n const len = coords.length - 1;\n return start ? coords[index] : coords[len - index];\n};\n\nconst getLineIcon = (feature, icon, color, start = true) => {\n const geom = feature.getGeometry();\n const coordA = getVertexCoord(geom, start, 1);\n const coordB = getVertexCoord(geom, start);\n const dx = start ? coordA[0] - coordB[0] : coordB[0] - coordA[0];\n const dy = start ? coordA[1] - coordB[1] : coordB[1] - coordA[1];\n const rotation = Math.atan2(dy, dx);\n\n return new Style({\n geometry: (feat) => {\n const ge = feat.getGeometry();\n return new Point(getVertexCoord(ge, start));\n },\n image: new Icon({\n color,\n rotateWithView: true,\n rotation: -rotation,\n scale: icon.scale,\n size: icon.size, // ie 11\n src: icon.url,\n }),\n zIndex: icon.zIndex,\n });\n};\n\n// Clean the unneeded feature's style and properties created by the KML parser.\nconst sanitizeFeature = (feature, doNotRevert32pxScaling = false) => {\n const geom = feature.getGeometry();\n let styles = feature.getStyleFunction();\n\n // Store maxZoom in properties\n if (feature.get(\"maxZoom\")) {\n feature.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // Store minZoom in properties\n if (feature.get(\"minZoom\")) {\n feature.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // The use of clone is part of the scale fix for OL > 6.7\n // If an IconStyle has no gx:w and gx:h defined, a scale factor is applied\n // after the image is loaded. To avoided having the scale factor applied we\n // clone the style and keep the scale as it is.\n // Having gx:w and gx:h not defined should not happen, using the last version of the parser/reader.\n const tmpStyles = styles(feature);\n const style = (Array.isArray(tmpStyles) ? tmpStyles[0] : tmpStyles).clone();\n\n let stroke = style.getStroke();\n\n if (feature.get(\"lineCap\")) {\n stroke?.setLineCap(feature.get(\"lineCap\"));\n }\n\n if (feature.get(\"lineJoin\")) {\n stroke?.setLineJoin(feature.get(\"lineJoin\"));\n }\n\n if (feature.get(\"lineDash\")) {\n stroke?.setLineDash(\n feature\n .get(\"lineDash\")\n .split(\",\")\n .map((l) => {\n return parseInt(l, 10);\n }),\n );\n }\n\n if (feature.get(\"lineDashOffset\")) {\n stroke?.setLineDashOffset(parseInt(feature.get(\"lineDashOffset\"), 10));\n }\n\n if (feature.get(\"miterLimit\")) {\n stroke?.setMiterLimit(parseInt(feature.get(\"miterLimit\"), 10));\n }\n\n // The canvas draws a stroke width=1 by default if width=0, so we\n // remove the stroke style in that case.\n if (stroke && stroke.getWidth() === 0) {\n stroke = undefined;\n }\n\n if (feature.get(\"zIndex\")) {\n style.setZIndex(parseInt(feature.get(\"zIndex\"), 10));\n }\n\n // if the feature is a Point and we are offline, we use default vector\n // style.\n // if the feature is a Point and has a name with a text style, we\n // create a correct text style.\n // TODO Handle GeometryCollection displaying name on the first Point\n // geometry.\n if (style && (geom instanceof Point || geom instanceof MultiPoint)) {\n let image = style.getImage();\n let text = null;\n let fill = style.getFill();\n\n // If the feature has name we display it on the map as Google does\n if (\n feature.get(\"name\") &&\n style.getText() &&\n style.getText().getScale() !== 0\n ) {\n if (image && image.getScale() === 0) {\n // transparentCircle is used to allow selection\n image = new Circle({\n fill: new Fill({ color: [0, 0, 0, 0] }),\n radius: 1,\n stroke: new Stroke({ color: [0, 0, 0, 0] }),\n });\n }\n\n // We replace empty white spaces used to keep normal spaces before and after the name.\n let name = feature.get(\"name\");\n if (/\\u200B/g.test(name)) {\n name = name.replace(/\\u200B/g, \"\");\n feature.set(\"name\", name);\n }\n\n // For backward compatibility we translate the bold and italic textFont property to a textArray prop\n const font = feature.get(\"textFont\") || \"normal 16px Helvetica\";\n\n // Since we use rich text in mapset editor we use a text array instead,\n // it's only necessary when there is new lines in the text\n // Manage new lines\n if (/\\n/.test(name)) {\n const array = [];\n const split = name.split(\"\\n\");\n split.forEach((txt, idx) => {\n array.push(txt || \"\\u200B\", txt ? font : \"\");\n\n if (idx < split.length - 1) {\n array.push(\"\\n\", \"\");\n }\n });\n name = array;\n } else {\n name = [name, font];\n }\n\n text = new Text({\n fill: style.getText().getFill(),\n font: font.replace(/bold/g, \"normal\"), // We manage bold in textArray\n // rotation unsupported by KML, taken instead from custom field.\n rotation: feature.get(\"textRotation\") || 0,\n // stroke: style.getText().getStroke(),\n scale: style.getText().getScale(),\n // since ol 6.3.1 : https://github.com/openlayers/openlayers/pull/10613/files#diff-1883da8b57e690db7ea0c35ce53c880aR925\n // a default textstroke is added to mimic google earth.\n // it was not the case before, the stroke was always null. So to keep\n // the same behavior we don't copy the stroke style.\n // TODO : maybe we should use this functionnality in the futur.\n text: name,\n });\n\n if (feature.get(\"textArray\")) {\n try {\n const textArray = JSON.parse(feature.get(\"textArray\"));\n text.setText(textArray);\n } catch (err) {\n // eslint-disable-next-line no-console\n console.error(\n \"Error parsing textArray\",\n feature.get(\"textArray\"),\n err,\n );\n }\n }\n\n if (feature.get(\"textStrokeColor\") && feature.get(\"textStrokeWidth\")) {\n text.setStroke(\n new Stroke({\n color: feature.get(\"textStrokeColor\"),\n width: parseFloat(feature.get(\"textStrokeWidth\")),\n }),\n );\n }\n\n if (feature.get(\"textAlign\")) {\n text.setTextAlign(feature.get(\"textAlign\"));\n }\n\n if (feature.get(\"textOffsetX\")) {\n text.setOffsetX(parseFloat(feature.get(\"textOffsetX\")));\n }\n\n if (feature.get(\"textOffsetY\")) {\n text.setOffsetY(parseFloat(feature.get(\"textOffsetY\")));\n }\n\n if (feature.get(\"textBackgroundFillColor\")) {\n text.setBackgroundFill(\n new Fill({\n color: feature.get(\"textBackgroundFillColor\"),\n }),\n );\n }\n\n if (feature.get(\"textPadding\")) {\n text.setPadding(\n feature\n .get(\"textPadding\")\n .split(\",\")\n .map((n) => {\n return parseFloat(n);\n }),\n );\n }\n if (image instanceof Icon) {\n applyTextStyleForIcon(image, text);\n }\n }\n\n if (image instanceof Icon) {\n /* Apply icon rotation if defined (by default only written as\n * <heading> tag, which is not read as rotation value by the ol KML module)\n */\n image.setRotation(parseFloat(feature.get(\"iconRotation\")) || 0);\n\n if (feature.get(\"iconScale\")) {\n image.setScale(parseFloat(feature.get(\"iconScale\")) || 0);\n\n // We fix the 32px scaling introduced by OL 6.7 only if the image has a size defined.\n } else if (!doNotRevert32pxScaling && image.getSize()) {\n const resizeScale = scaleForSize(image.getSize());\n image.setScale(image.getScaleArray()[0] / resizeScale);\n }\n }\n\n fill = undefined;\n stroke = undefined;\n\n styles = (feat, resolution) => {\n /* Options to be used for picture scaling with map, should have at least\n * a resolution attribute (this is the map resolution at the zoom level when\n * the picture is created), can take an optional constant for further scale\n * adjustment.\n * e.g. { resolution: 0.123, defaultScale: 1 / 6 }\n */\n\n if (feat.get(\"pictureOptions\")) {\n let pictureOptions = feat.get(\"pictureOptions\");\n if (typeof pictureOptions === \"string\") {\n pictureOptions = JSON.parse(pictureOptions);\n }\n feat.set(\"pictureOptions\", pictureOptions);\n if (pictureOptions.resolution) {\n image.setScale(\n (pictureOptions.resolution / resolution) *\n pictureOptions.defaultScale || 1,\n );\n }\n }\n\n return new Style({\n fill,\n image,\n stroke,\n text,\n zIndex: style.getZIndex(),\n });\n };\n }\n\n // Remove image and text styles for polygons and lines\n if (\n !(\n geom instanceof Point ||\n geom instanceof MultiPoint ||\n geom instanceof GeometryCollection\n )\n ) {\n styles = [\n new Style({\n fill: style.getFill(),\n image: null,\n stroke,\n text: null,\n zIndex: style.getZIndex(),\n }),\n ];\n\n // Parse the fillPattern json string and store parsed object\n let fillPattern = feature.get(\"fillPattern\");\n if (fillPattern) {\n fillPattern = JSON.parse(fillPattern);\n feature.set(\"fillPattern\", fillPattern);\n\n /* We set the fill pattern for polygons */\n if (!style.getFill()) {\n styles[0].setFill(new Fill());\n }\n const patternOrColor = fillPattern.empty\n ? [0, 0, 0, 0]\n : getPolygonPattern(fillPattern.id, fillPattern.color);\n styles[0].getFill().setColor(patternOrColor);\n }\n\n // Add line's icons styles\n if (feature.get(\"lineStartIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineStartIcon\")),\n stroke.getColor(),\n ),\n );\n }\n\n if (feature.get(\"lineEndIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineEndIcon\")),\n stroke.getColor(),\n false,\n ),\n );\n }\n }\n feature.setStyle(styles);\n};\n\n/**\n * Read a KML string.\n * @param {String} kmlString A string representing a KML file.\n * @param {<ol.Projection|String>} featureProjection The projection used by the map.\n * @param {<boolean>} doNotRevert32pxScaling Set it to true if you use ol < 6.7 and last version of react-spatial, Fix the 32px scaling, introduced by (ol >= 6.7), see https://github.com/openlayers/openlayers/pull/12695.\n */\nconst readFeatures = (\n kmlString,\n featureProjection,\n doNotRevert32pxScaling = false,\n) => {\n // Since ol 6.7, the KML follows better the spec and GoogleEarth interpretation, see https://github.com/openlayers/openlayers/pull/12695.\n // so the <scale> value is interpreted using an image size of 32px.\n // So when revert32pxScaling is true we fix back the scale, to use only, if you use an OL < 6.7.\n // Now the writeFeatures function use the iconScale extended data to set the image's scale.\n // If the extended data is not found it will look at this boolean to define if we must revert the scale or not.\n const features = new KML().readFeatures(kmlString, {\n featureProjection,\n });\n features.forEach((feature) => {\n // Transform back polygon to circle geometry\n const {\n [CIRCLE_GEOMETRY_CENTER]: circleGeometryCenter,\n [CIRCLE_GEOMETRY_RADIUS]: circleGeometryRadius,\n } = feature?.getProperties() || {};\n if (circleGeometryCenter && circleGeometryRadius) {\n const circle = new CircleGeom(\n transform(\n JSON.parse(circleGeometryCenter),\n EPSG_4326,\n featureProjection || EPSG_4326,\n ),\n parseFloat(circleGeometryRadius, 10),\n );\n circle.setProperties(feature.getGeometry().getProperties());\n feature.setGeometry(circle);\n }\n\n sanitizeFeature(feature, doNotRevert32pxScaling);\n });\n return features;\n};\n\n/**\n * Create a KML string.\n * @param {VectorLayer} layer A react-spatial VectorLayer.\n * @param {<ol.Projection|String>} featureProjection The current projection used by the features.\n * @param {<boolean>} fixGxyAndGxh If the KML contains gx:w and gx:h, (ol >= 6.7), it will fix the bug introduced by https://github.com/openlayers/openlayers/pull/12695.\n */\nconst writeFeatures = (layer, featureProjection, mapResolution) => {\n let featString;\n const { olLayer } = layer;\n const exportFeatures = [];\n\n [...olLayer.getSource().getFeatures()]\n .sort((a, b) => {\n // The order of features must be kept.\n // We could use the useSpatialIndex = false property on the layer\n // but we prefer to sort feature by ol uid because ol uid is an integer\n // increased on each creation of a feature.\n // So we will keep the order of creation made by the the KML parser.\n // Ideally we should order by the zIndex of the style only.\n if (getUid(a) <= getUid(b)) {\n return -1;\n }\n return 1;\n })\n .forEach((feature) => {\n const clone = feature.clone();\n if (clone.getGeometry().getType() === \"Circle\") {\n // We transform circle elements into polygons\n // because circle not supported in KML spec and in ol KML parser\n const circleGeom = feature.getGeometry();\n clone.setGeometry(fromCircle(circleGeom, 100));\n clone.set(\n CIRCLE_GEOMETRY_CENTER,\n JSON.stringify(\n transform(circleGeom.getCenter(), featureProjection, EPSG_4326),\n ),\n );\n clone.set(CIRCLE_GEOMETRY_RADIUS, circleGeom.getRadius());\n }\n clone.setId(feature.getId());\n clone.getGeometry().transform(featureProjection, EPSG_4326);\n\n // We remove all ExtendedData not related to style.\n Object.keys(feature.getProperties()).forEach((key) => {\n if (\n ![\n CIRCLE_GEOMETRY_CENTER,\n CIRCLE_GEOMETRY_RADIUS,\n \"description\",\n \"geometry\",\n \"name\",\n ].includes(key)\n ) {\n clone.unset(key, true);\n }\n });\n\n let styles;\n\n if (feature.getStyleFunction()) {\n styles = feature.getStyleFunction()(feature, mapResolution);\n } else if (olLayer && olLayer.getStyleFunction()) {\n styles = olLayer.getStyleFunction()(feature, mapResolution);\n }\n\n const mainStyle = styles[0] || styles;\n\n const newStyle = {\n fill: mainStyle.getFill(),\n image: mainStyle.getImage(),\n stroke: mainStyle.getStroke(),\n text: mainStyle.getText(),\n zIndex: mainStyle.getZIndex(),\n };\n\n if (newStyle.zIndex) {\n clone.set(\"zIndex\", newStyle.zIndex);\n }\n\n const text = newStyle.text?.getText();\n\n if (text) {\n let kmlText = text;\n\n if (Array.isArray(text)) {\n // text can be a string or an array of strings\n clone.set(\"textArray\", JSON.stringify(text));\n\n // in the KML we just add the text without the bold or italic information\n kmlText = text\n .map((t, idx) => {\n return idx % 2 === 0 ? t : \"\";\n })\n\n .join(\"\")\n .replaceAll(\"\\u200B\", \"\");\n }\n\n // We add the current text as features's name so it will be added as Placemark's name in the kml\n if (kmlText) {\n // If we see spaces at the beginning or at the end we add a empty\n // white space at the beginning and at the end.\n if (/^(\\s|\\n)|(\\n|\\s)$/g.test(kmlText)) {\n clone.set(\"name\", `\\u200B${kmlText}\\u200B`);\n } else {\n clone.set(\"name\", kmlText);\n }\n }\n }\n\n // Set custom properties to be converted in extendedData in KML.\n if (newStyle.text?.getRotation()) {\n clone.set(\"textRotation\", newStyle.text.getRotation());\n }\n\n if (newStyle.text?.getFont()) {\n clone.set(\"textFont\", newStyle.text.getFont());\n }\n\n if (newStyle.text?.getTextAlign()) {\n clone.set(\"textAlign\", newStyle.text.getTextAlign());\n }\n\n if (newStyle.text?.getOffsetX()) {\n clone.set(\"textOffsetX\", newStyle.text.getOffsetX());\n }\n\n if (newStyle.text?.getOffsetY()) {\n clone.set(\"textOffsetY\", newStyle.text.getOffsetY());\n }\n\n if (newStyle.text?.getStroke()) {\n if (newStyle.text.getStroke().getColor()) {\n clone.set(\n \"textStrokeColor\",\n asString(newStyle.text.getStroke().getColor()),\n );\n }\n\n if (newStyle.text.getStroke().getWidth()) {\n clone.set(\"textStrokeWidth\", newStyle.text.getStroke().getWidth());\n }\n }\n\n if (newStyle.text?.getBackgroundFill()) {\n clone.set(\n \"textBackgroundFillColor\",\n asString(newStyle.text.getBackgroundFill().getColor()),\n );\n }\n\n if (newStyle.text?.getPadding()) {\n clone.set(\"textPadding\", newStyle.text.getPadding().join());\n }\n\n if (newStyle.stroke?.getLineCap()) {\n clone.set(\"lineCap\", newStyle.stroke.getLineCap());\n }\n\n if (newStyle.stroke?.getLineJoin()) {\n clone.set(\"lineJoin\", newStyle.stroke.getLineJoin());\n }\n\n if (newStyle.stroke?.getLineDash()) {\n clone.set(\"lineDash\", newStyle.stroke.getLineDash().join(\",\"));\n }\n\n if (newStyle.stroke?.getLineDashOffset()) {\n clone.set(\"lineDashOffset\", newStyle.stroke.getLineDashOffset());\n }\n\n if (newStyle.stroke?.getMiterLimit()) {\n clone.set(\"miterLimit\", newStyle.stroke.getMiterLimit());\n }\n\n if (newStyle.image instanceof Circle) {\n newStyle.image = null;\n }\n\n if (newStyle.image) {\n const imgSource = newStyle.image.getSrc();\n if (!/(http(s?)):\\/\\//gi.test(imgSource)) {\n // eslint-disable-next-line no-console\n console.log(\n \"Local image source not supported for KML export.\" +\n \"Should use remote web server\",\n );\n }\n\n if (newStyle.image.getRotation()) {\n // We set the icon rotation as extended data\n clone.set(\"iconRotation\", newStyle.image.getRotation());\n }\n\n if (newStyle.image.getScale()) {\n // We set the scale as extended metadata because the <scale> in the KML is related to a 32px img, since ol >= 6.10.\n clone.set(\"iconScale\", newStyle.image.getScale());\n }\n\n // Set map resolution to use for icon-to-map proportional scaling\n if (feature.get(\"pictureOptions\")) {\n clone.set(\n \"pictureOptions\",\n JSON.stringify(feature.get(\"pictureOptions\")),\n );\n }\n }\n\n // In case a fill pattern should be applied (use fillPattern attribute to store pattern id, color etc)\n if (feature.get(\"fillPattern\")) {\n clone.set(\"fillPattern\", JSON.stringify(feature.get(\"fillPattern\")));\n newStyle.fill = null;\n }\n\n // maxZoom: maximum zoom level at which the feature is displayed\n if (feature.get(\"maxZoom\")) {\n clone.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // minZoom: minimum zoom level at which the feature is displayed\n if (feature.get(\"minZoom\")) {\n clone.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // If only text is displayed we must specify an\n // image style with scale=0\n if (newStyle.text && !newStyle.image) {\n newStyle.image = new Icon({\n scale: 0,\n src: \"noimage\",\n });\n }\n\n // In case we use line's icon .\n const extraLineStyles = (Array.isArray(styles) && styles.slice(1)) || [];\n extraLineStyles.forEach((extraLineStyle) => {\n if (\n extraLineStyle &&\n extraLineStyle.getImage() instanceof Icon &&\n extraLineStyle.getGeometry()\n ) {\n const coord = extraLineStyle.getGeometry()(feature).getCoordinates();\n const startCoord = feature.getGeometry().getFirstCoordinate();\n if (coord[0] === startCoord[0] && coord[1] === startCoord[1]) {\n clone.set(\n \"lineStartIcon\",\n JSON.stringify({\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n url: extraLineStyle.getImage().getSrc(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n } else {\n clone.set(\n \"lineEndIcon\",\n JSON.stringify({\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n url: extraLineStyle.getImage().getSrc(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n }\n }\n });\n\n const olStyle = new Style(newStyle);\n clone.setStyle(olStyle);\n\n if (\n !(\n clone.getGeometry() instanceof Point &&\n olStyle.getText() &&\n !olStyle.getText().getText()\n )\n ) {\n exportFeatures.push(clone);\n }\n });\n\n if (exportFeatures.length > 0) {\n if (exportFeatures.length === 1) {\n // force the add of a <Document> node\n exportFeatures.push(new Feature());\n }\n\n featString = new KML({\n defaultStyle: [kmlStyle],\n extractStyles: true,\n }).writeFeatures(exportFeatures);\n\n // Remove no image hack\n featString = featString.replace(\n /<Icon>\\s*<href>noimage<\\/href>\\s*<\\/Icon>/g,\n \"\",\n );\n\n // Remove empty placemark added to have\n // <Document> tag\n featString = featString.replace(/<Placemark\\/>/g, \"\");\n\n // Add KML document name\n if (layer.name) {\n featString = featString.replace(\n /<Document>/,\n `<Document><name>${layer.name}</name>`,\n );\n }\n }\n\n return featString;\n};\n\n/**\n * Removes the <Camera> tag from a KML string. Returns the KML string with removed <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n */\nconst removeDocumentCamera = (kmlString) => {\n const kmlDoc = parse(kmlString);\n // Remove old Camera node\n const oldCameraNode = kmlDoc.getElementsByTagName(\"Camera\")[0];\n if (oldCameraNode) {\n oldCameraNode.remove();\n }\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\n/**\n * Write the <Camera> tag into a KML string. Returns the KML string with added <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n * @param {Object} cameraAttributes Object containing the camera tags (longitude, latitude, altitude, heading, tilt, altitudeMode, roll)\n * as keys with corresponding values. See https://developers.google.com/kml/documentation/kmlreference#camera\n */\nconst writeDocumentCamera = (kmlString, cameraAttributes) => {\n const kmlDoc = parse(removeDocumentCamera(kmlString));\n\n if (cameraAttributes) {\n // Create Camera node with child attributes if the cameraAttributes object is defined\n const cameraNode = kmlDoc.createElement(\"Camera\");\n Object.keys(cameraAttributes).forEach((key) => {\n const cameraAttribute = kmlDoc.createElement(\n `${key.charAt(0).toUpperCase() + key.slice(1)}`,\n );\n cameraAttribute.innerHTML = cameraAttributes[key];\n cameraNode.appendChild(cameraAttribute);\n });\n const documentNode = kmlDoc.getElementsByTagName(\"Document\")[0];\n documentNode.appendChild(cameraNode);\n }\n\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\nexport default {\n readFeatures,\n removeDocumentCamera,\n writeDocumentCamera,\n writeFeatures,\n};\n"],
5
+ "mappings": "AAAA,SAAS,SAAS,cAAc;AAChC,SAAS,gBAAgB;AACzB,OAAO,SAAS;AAChB,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAC/B,OAAO,gBAAgB;AACvB,OAAO,WAAW;AAClB,SAAS,kBAAkB;AAC3B,SAAS,KAAK,iBAAiB;AAC/B,SAAS,QAAQ,MAAM,MAAM,QAAQ,OAAO,YAAY;AACxD,SAAS,aAAa;AAEtB,OAAO,uBAAuB;AAC9B,SAAS,gBAAgB;AAEzB,MAAM,yBAAyB;AAC/B,MAAM,yBAAyB;AAC/B,MAAM,YAAY,IAAI,WAAW;AAIjC,MAAM,eAAe,CAAC,SAAS;AAC7B,SAAO,KAAK,KAAK,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;AACvC;AAEA,MAAM,wBAAwB,CAAC,QAAQ,WAAW;AAChD,QAAM,OAAO,OAAO,QAAQ,KAAK,CAAC,IAAI,EAAE;AACxC,QAAM,QAAQ,OAAO,SAAS,KAAK;AACnC,QAAM,SAAS,OAAO,UAAU,KAAK;AAAA,IAClC,KAAK,CAAC,IAAI,QAAS;AAAA,IACnB,KAAK,CAAC,IAAI,QAAS;AAAA,EACtB;AACA,QAAM,SAAS;AAAA,IACb,SAAS,KAAK,CAAC,IAAI,OAAO,CAAC,KAA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mBAAmB,MAAM,IAAI;AAAA,MAC/B;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAMA,MAAM,uBAAuB,CAAC,cAAc;AAC1C,QAAM,SAAS,MAAM,SAAS;AAE9B,QAAM,gBAAgB,OAAO,qBAAqB,QAAQ,EAAE,CAAC;AAC7D,MAAI,eAAe;AACjB,kBAAc,OAAO;AAAA,EACvB;AACA,SAAO,IAAI,cAAc,EAAE,kBAAkB,MAAM;AACrD;AAQA,MAAM,sBAAsB,CAAC,WAAW,qBAAqB;AAC3D,QAAM,SAAS,MAAM,qBAAqB,SAAS,CAAC;AAEpD,MAAI,kBAAkB;AAEpB,UAAM,aAAa,OAAO,cAAc,QAAQ;AAChD,WAAO,KAAK,gBAAgB,EAAE,QAAQ,CAAC,QAAQ;AAC7C,YAAM,kBAAkB,OAAO;AAAA,QAC7B,GAAG,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC,CAAC;AAAA,MAC/C;AACA,sBAAgB,YAAY,iBAAiB,GAAG;AAChD,iBAAW,YAAY,eAAe;AAAA,IACxC,CAAC;AACD,UAAM,eAAe,OAAO,qBAAqB,UAAU,EAAE,CAAC;AAC9D,iBAAa,YAAY,UAAU;AAAA,EACrC;AAEA,SAAO,IAAI,cAAc,EAAE,kBAAkB,MAAM;AACrD;AAEA,eAAe;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": []
7
7
  }
package/utils/Styles.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Fill, Stroke, Circle, Style, Text } from "ol/style";
1
+ import { Circle, Fill, Stroke, Style, Text } from "ol/style";
2
2
  const fill = new Fill({
3
3
  color: "rgba(255,255,255,0.4)"
4
4
  });
@@ -7,12 +7,12 @@ const stroke = new Stroke({
7
7
  width: 1.25
8
8
  });
9
9
  const dfltOlStyle = new Style({
10
+ fill,
10
11
  image: new Circle({
11
12
  fill,
12
- stroke,
13
- radius: 5
13
+ radius: 5,
14
+ stroke
14
15
  }),
15
- fill,
16
16
  stroke
17
17
  });
18
18
  const kmlFill = new Fill({
@@ -23,17 +23,17 @@ const kmlStroke = new Stroke({
23
23
  width: 1.5
24
24
  });
25
25
  const kmlcircle = new Circle({
26
- radius: 7,
27
26
  fill: kmlFill,
27
+ radius: 7,
28
28
  stroke: kmlStroke
29
29
  });
30
30
  const kmlStyle = new Style({
31
31
  fill: kmlFill,
32
- stroke: kmlStroke,
33
32
  image: kmlcircle,
33
+ stroke: kmlStroke,
34
34
  text: new Text({
35
- font: "normal 16px Helvetica",
36
35
  fill: kmlFill,
36
+ font: "normal 16px Helvetica",
37
37
  stroke: new Stroke({
38
38
  color: [255, 255, 255, 1],
39
39
  width: 3
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/Styles.js"],
4
- "sourcesContent": ["import { Fill, Stroke, Circle, Style, Text } from \"ol/style\";\n\n// Default style for Ol\nconst fill = new Fill({\n color: \"rgba(255,255,255,0.4)\",\n});\nconst stroke = new Stroke({\n color: \"#3399CC\",\n width: 1.25,\n});\nconst dfltOlStyle = new Style({\n image: new Circle({\n fill,\n stroke,\n radius: 5,\n }),\n fill,\n stroke,\n});\n\n// Default style for KML layer\nconst kmlFill = new Fill({\n color: [255, 0, 0, 0.7],\n});\nconst kmlStroke = new Stroke({\n color: [255, 0, 0, 1],\n width: 1.5,\n});\nconst kmlcircle = new Circle({\n radius: 7,\n fill: kmlFill,\n stroke: kmlStroke,\n});\nconst kmlStyle = new Style({\n fill: kmlFill,\n stroke: kmlStroke,\n image: kmlcircle,\n text: new Text({\n font: \"normal 16px Helvetica\",\n fill: kmlFill,\n stroke: new Stroke({\n color: [255, 255, 255, 1],\n width: 3,\n }),\n }),\n});\n\nexport { kmlStyle };\n\nexport default {\n default: dfltOlStyle,\n};\n"],
5
- "mappings": "AAAA,SAAS,MAAM,QAAQ,QAAQ,OAAO,YAAY;AAGlD,MAAM,OAAO,IAAI,KAAK;AAAA,EACpB,OAAO;AACT,CAAC;AACD,MAAM,SAAS,IAAI,OAAO;AAAA,EACxB,OAAO;AAAA,EACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,IAAI,MAAM;AAAA,EAC5B,OAAO,IAAI,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EACV,CAAC;AAAA,EACD;AAAA,EACA;AACF,CAAC;AAGD,MAAM,UAAU,IAAI,KAAK;AAAA,EACvB,OAAO,CAAC,KAAK,GAAG,GAAG,GAAG;AACxB,CAAC;AACD,MAAM,YAAY,IAAI,OAAO;AAAA,EAC3B,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;AAAA,EACpB,OAAO;AACT,CAAC;AACD,MAAM,YAAY,IAAI,OAAO;AAAA,EAC3B,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AACV,CAAC;AACD,MAAM,WAAW,IAAI,MAAM;AAAA,EACzB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,MAAM,IAAI,KAAK;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ,IAAI,OAAO;AAAA,MACjB,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;AAAA,MACxB,OAAO;AAAA,IACT,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,SAAS;AAET,eAAe;AAAA,EACb,SAAS;AACX;",
4
+ "sourcesContent": ["import { Circle, Fill, Stroke, Style, Text } from \"ol/style\";\n\n// Default style for Ol\nconst fill = new Fill({\n color: \"rgba(255,255,255,0.4)\",\n});\nconst stroke = new Stroke({\n color: \"#3399CC\",\n width: 1.25,\n});\nconst dfltOlStyle = new Style({\n fill,\n image: new Circle({\n fill,\n radius: 5,\n stroke,\n }),\n stroke,\n});\n\n// Default style for KML layer\nconst kmlFill = new Fill({\n color: [255, 0, 0, 0.7],\n});\nconst kmlStroke = new Stroke({\n color: [255, 0, 0, 1],\n width: 1.5,\n});\nconst kmlcircle = new Circle({\n fill: kmlFill,\n radius: 7,\n stroke: kmlStroke,\n});\nconst kmlStyle = new Style({\n fill: kmlFill,\n image: kmlcircle,\n stroke: kmlStroke,\n text: new Text({\n fill: kmlFill,\n font: \"normal 16px Helvetica\",\n stroke: new Stroke({\n color: [255, 255, 255, 1],\n width: 3,\n }),\n }),\n});\n\nexport { kmlStyle };\n\nexport default {\n default: dfltOlStyle,\n};\n"],
5
+ "mappings": "AAAA,SAAS,QAAQ,MAAM,QAAQ,OAAO,YAAY;AAGlD,MAAM,OAAO,IAAI,KAAK;AAAA,EACpB,OAAO;AACT,CAAC;AACD,MAAM,SAAS,IAAI,OAAO;AAAA,EACxB,OAAO;AAAA,EACP,OAAO;AACT,CAAC;AACD,MAAM,cAAc,IAAI,MAAM;AAAA,EAC5B;AAAA,EACA,OAAO,IAAI,OAAO;AAAA,IAChB;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,EACF,CAAC;AAAA,EACD;AACF,CAAC;AAGD,MAAM,UAAU,IAAI,KAAK;AAAA,EACvB,OAAO,CAAC,KAAK,GAAG,GAAG,GAAG;AACxB,CAAC;AACD,MAAM,YAAY,IAAI,OAAO;AAAA,EAC3B,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;AAAA,EACpB,OAAO;AACT,CAAC;AACD,MAAM,YAAY,IAAI,OAAO;AAAA,EAC3B,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AACV,CAAC;AACD,MAAM,WAAW,IAAI,MAAM;AAAA,EACzB,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM,IAAI,KAAK;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ,IAAI,OAAO;AAAA,MACjB,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;AAAA,MACxB,OAAO;AAAA,IACT,CAAC;AAAA,EACH,CAAC;AACH,CAAC;AAED,SAAS;AAET,eAAe;AAAA,EACb,SAAS;AACX;",
6
6
  "names": []
7
7
  }
@@ -17,19 +17,19 @@ export const getDelayString = (delayInMs) => {
17
17
  const m = Math.floor(timeInMs % 36e5 / 6e4);
18
18
  const s = Math.floor(timeInMs % 36e5 % 6e4 / 1e3);
19
19
  if (s === 0 && h === 0 && m === 0) {
20
- return "0";
20
+ return "+0";
21
21
  }
22
22
  if (s === 0 && h === 0) {
23
- return `${m}m`;
23
+ return `+${m}m`;
24
24
  }
25
25
  if (s === 0) {
26
- return `${h}h${m}m`;
26
+ return `+${h}h${m}m`;
27
27
  }
28
28
  if (m === 0 && h === 0) {
29
- return `${s}s`;
29
+ return `+${s}s`;
30
30
  }
31
31
  if (h === 0) {
32
- return `${m}m${s}s`;
32
+ return `+${m}m${s}s`;
33
33
  }
34
- return `${h}h${m}m${s}s`;
34
+ return `+${h}h${m}m${s}s`;
35
35
  };