@mapsight/lib-ol 4.0.0

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 (237) hide show
  1. package/README.md +20 -0
  2. package/dist/coordinate/add.d.ts +3 -0
  3. package/dist/coordinate/add.d.ts.map +1 -0
  4. package/dist/coordinate/add.js +8 -0
  5. package/dist/coordinate/add.js.map +1 -0
  6. package/dist/coordinate/addPixelPadding.d.ts +10 -0
  7. package/dist/coordinate/addPixelPadding.d.ts.map +1 -0
  8. package/dist/coordinate/addPixelPadding.js +13 -0
  9. package/dist/coordinate/addPixelPadding.js.map +1 -0
  10. package/dist/coordinate/fromPixel.d.ts +3 -0
  11. package/dist/coordinate/fromPixel.d.ts.map +1 -0
  12. package/dist/coordinate/fromPixel.js +8 -0
  13. package/dist/coordinate/fromPixel.js.map +1 -0
  14. package/dist/coordinate/scale.d.ts +3 -0
  15. package/dist/coordinate/scale.d.ts.map +1 -0
  16. package/dist/coordinate/scale.js +5 -0
  17. package/dist/coordinate/scale.js.map +1 -0
  18. package/dist/coordinate/toPixel.d.ts +3 -0
  19. package/dist/coordinate/toPixel.d.ts.map +1 -0
  20. package/dist/coordinate/toPixel.js +8 -0
  21. package/dist/coordinate/toPixel.js.map +1 -0
  22. package/dist/coordinates/equals.d.ts +3 -0
  23. package/dist/coordinates/equals.d.ts.map +1 -0
  24. package/dist/coordinates/equals.js +5 -0
  25. package/dist/coordinates/equals.js.map +1 -0
  26. package/dist/coordinates/middleCoordinate.d.ts +3 -0
  27. package/dist/coordinates/middleCoordinate.d.ts.map +1 -0
  28. package/dist/coordinates/middleCoordinate.js +5 -0
  29. package/dist/coordinates/middleCoordinate.js.map +1 -0
  30. package/dist/events/condition/clickOnFeature.d.ts +9 -0
  31. package/dist/events/condition/clickOnFeature.d.ts.map +1 -0
  32. package/dist/events/condition/clickOnFeature.js +10 -0
  33. package/dist/events/condition/clickOnFeature.js.map +1 -0
  34. package/dist/extent/getCentroid.d.ts +6 -0
  35. package/dist/extent/getCentroid.d.ts.map +1 -0
  36. package/dist/extent/getCentroid.js +9 -0
  37. package/dist/extent/getCentroid.js.map +1 -0
  38. package/dist/extent/isFiniteExtent.d.ts +3 -0
  39. package/dist/extent/isFiniteExtent.d.ts.map +1 -0
  40. package/dist/extent/isFiniteExtent.js +4 -0
  41. package/dist/extent/isFiniteExtent.js.map +1 -0
  42. package/dist/extents/combineExtents.d.ts +3 -0
  43. package/dist/extents/combineExtents.d.ts.map +1 -0
  44. package/dist/extents/combineExtents.js +9 -0
  45. package/dist/extents/combineExtents.js.map +1 -0
  46. package/dist/feature/animator.d.ts +9 -0
  47. package/dist/feature/animator.d.ts.map +1 -0
  48. package/dist/feature/animator.js +33 -0
  49. package/dist/feature/animator.js.map +1 -0
  50. package/dist/feature/cluster.d.ts +8 -0
  51. package/dist/feature/cluster.d.ts.map +1 -0
  52. package/dist/feature/cluster.js +50 -0
  53. package/dist/feature/cluster.js.map +1 -0
  54. package/dist/feature/detectFeatureHits.d.ts +11 -0
  55. package/dist/feature/detectFeatureHits.d.ts.map +1 -0
  56. package/dist/feature/detectFeatureHits.js +34 -0
  57. package/dist/feature/detectFeatureHits.js.map +1 -0
  58. package/dist/feature/ensureId.d.ts +3 -0
  59. package/dist/feature/ensureId.d.ts.map +1 -0
  60. package/dist/feature/ensureId.js +7 -0
  61. package/dist/feature/ensureId.js.map +1 -0
  62. package/dist/feature/getCentroid.d.ts +3 -0
  63. package/dist/feature/getCentroid.d.ts.map +1 -0
  64. package/dist/feature/getCentroid.js +13 -0
  65. package/dist/feature/getCentroid.js.map +1 -0
  66. package/dist/feature/getExtent.d.ts +3 -0
  67. package/dist/feature/getExtent.d.ts.map +1 -0
  68. package/dist/feature/getExtent.js +8 -0
  69. package/dist/feature/getExtent.js.map +1 -0
  70. package/dist/feature/getLayer.d.ts +4 -0
  71. package/dist/feature/getLayer.d.ts.map +1 -0
  72. package/dist/feature/getLayer.js +23 -0
  73. package/dist/feature/getLayer.js.map +1 -0
  74. package/dist/feature/getUid.d.ts +3 -0
  75. package/dist/feature/getUid.d.ts.map +1 -0
  76. package/dist/feature/getUid.js +5 -0
  77. package/dist/feature/getUid.js.map +1 -0
  78. package/dist/features/getCentroidForFeatures.d.ts +3 -0
  79. package/dist/features/getCentroidForFeatures.d.ts.map +1 -0
  80. package/dist/features/getCentroidForFeatures.js +7 -0
  81. package/dist/features/getCentroidForFeatures.js.map +1 -0
  82. package/dist/features/getExtentForFeatures.d.ts +3 -0
  83. package/dist/features/getExtentForFeatures.d.ts.map +1 -0
  84. package/dist/features/getExtentForFeatures.js +7 -0
  85. package/dist/features/getExtentForFeatures.js.map +1 -0
  86. package/dist/geometry/deriveGeometriesFromBase.d.ts +8 -0
  87. package/dist/geometry/deriveGeometriesFromBase.d.ts.map +1 -0
  88. package/dist/geometry/deriveGeometriesFromBase.js +69 -0
  89. package/dist/geometry/deriveGeometriesFromBase.js.map +1 -0
  90. package/dist/geometry/getDominantGeometryType.d.ts +4 -0
  91. package/dist/geometry/getDominantGeometryType.d.ts.map +1 -0
  92. package/dist/geometry/getDominantGeometryType.js +30 -0
  93. package/dist/geometry/getDominantGeometryType.js.map +1 -0
  94. package/dist/geometry/getLineStringSegmentVerticesWithRotation.d.ts +4 -0
  95. package/dist/geometry/getLineStringSegmentVerticesWithRotation.d.ts.map +1 -0
  96. package/dist/geometry/getLineStringSegmentVerticesWithRotation.js +28 -0
  97. package/dist/geometry/getLineStringSegmentVerticesWithRotation.js.map +1 -0
  98. package/dist/geometry/getPolygonRingSegmentVerticesWithRotation.d.ts +4 -0
  99. package/dist/geometry/getPolygonRingSegmentVerticesWithRotation.d.ts.map +1 -0
  100. package/dist/geometry/getPolygonRingSegmentVerticesWithRotation.js +49 -0
  101. package/dist/geometry/getPolygonRingSegmentVerticesWithRotation.js.map +1 -0
  102. package/dist/index.d.ts +52 -0
  103. package/dist/index.d.ts.map +1 -0
  104. package/dist/index.js +2 -0
  105. package/dist/index.js.map +1 -0
  106. package/dist/map/animateDuringTransition.d.ts +4 -0
  107. package/dist/map/animateDuringTransition.d.ts.map +1 -0
  108. package/dist/map/animateDuringTransition.js +41 -0
  109. package/dist/map/animateDuringTransition.js.map +1 -0
  110. package/dist/map/canvasSizeFixer.d.ts +10 -0
  111. package/dist/map/canvasSizeFixer.d.ts.map +1 -0
  112. package/dist/map/canvasSizeFixer.js +35 -0
  113. package/dist/map/canvasSizeFixer.js.map +1 -0
  114. package/dist/map/containsExtentWithPadding.d.ts +5 -0
  115. package/dist/map/containsExtentWithPadding.d.ts.map +1 -0
  116. package/dist/map/containsExtentWithPadding.js +9 -0
  117. package/dist/map/containsExtentWithPadding.js.map +1 -0
  118. package/dist/map/fitToExtent.d.ts +10 -0
  119. package/dist/map/fitToExtent.d.ts.map +1 -0
  120. package/dist/map/fitToExtent.js +26 -0
  121. package/dist/map/fitToExtent.js.map +1 -0
  122. package/dist/map/fitToFeature.d.ts +17 -0
  123. package/dist/map/fitToFeature.d.ts.map +1 -0
  124. package/dist/map/fitToFeature.js +16 -0
  125. package/dist/map/fitToFeature.js.map +1 -0
  126. package/dist/map/fitToFeatures.d.ts +17 -0
  127. package/dist/map/fitToFeatures.d.ts.map +1 -0
  128. package/dist/map/fitToFeatures.js +11 -0
  129. package/dist/map/fitToFeatures.js.map +1 -0
  130. package/dist/map/getPaddedViewExtent.d.ts +5 -0
  131. package/dist/map/getPaddedViewExtent.d.ts.map +1 -0
  132. package/dist/map/getPaddedViewExtent.js +28 -0
  133. package/dist/map/getPaddedViewExtent.js.map +1 -0
  134. package/dist/map/getVisibleLayersFromFramestate.d.ts +5 -0
  135. package/dist/map/getVisibleLayersFromFramestate.d.ts.map +1 -0
  136. package/dist/map/getVisibleLayersFromFramestate.js +8 -0
  137. package/dist/map/getVisibleLayersFromFramestate.js.map +1 -0
  138. package/dist/map/updateSizeDuringTransition.d.ts +3 -0
  139. package/dist/map/updateSizeDuringTransition.d.ts.map +1 -0
  140. package/dist/map/updateSizeDuringTransition.js +7 -0
  141. package/dist/map/updateSizeDuringTransition.js.map +1 -0
  142. package/dist/map/updateSizeOnTransitionEnd.d.ts +3 -0
  143. package/dist/map/updateSizeOnTransitionEnd.d.ts.map +1 -0
  144. package/dist/map/updateSizeOnTransitionEnd.js +19 -0
  145. package/dist/map/updateSizeOnTransitionEnd.js.map +1 -0
  146. package/dist/points/findClosestPoint.d.ts +11 -0
  147. package/dist/points/findClosestPoint.d.ts.map +1 -0
  148. package/dist/points/findClosestPoint.js +32 -0
  149. package/dist/points/findClosestPoint.js.map +1 -0
  150. package/dist/points/spreadPointClusterInRadius.d.ts +14 -0
  151. package/dist/points/spreadPointClusterInRadius.d.ts.map +1 -0
  152. package/dist/points/spreadPointClusterInRadius.js +53 -0
  153. package/dist/points/spreadPointClusterInRadius.js.map +1 -0
  154. package/dist/style/bindStyleToGeometry.d.ts +4 -0
  155. package/dist/style/bindStyleToGeometry.d.ts.map +1 -0
  156. package/dist/style/bindStyleToGeometry.js +6 -0
  157. package/dist/style/bindStyleToGeometry.js.map +1 -0
  158. package/dist/style/createCachedStyleFunction.d.ts +45 -0
  159. package/dist/style/createCachedStyleFunction.d.ts.map +1 -0
  160. package/dist/style/createCachedStyleFunction.js +175 -0
  161. package/dist/style/createCachedStyleFunction.js.map +1 -0
  162. package/dist/style/declarationToGeometry.d.ts +3 -0
  163. package/dist/style/declarationToGeometry.d.ts.map +1 -0
  164. package/dist/style/declarationToGeometry.js +4 -0
  165. package/dist/style/declarationToGeometry.js.map +1 -0
  166. package/dist/style/declarationToStyle.d.ts +6 -0
  167. package/dist/style/declarationToStyle.d.ts.map +1 -0
  168. package/dist/style/declarationToStyle.js +167 -0
  169. package/dist/style/declarationToStyle.js.map +1 -0
  170. package/dist/style/styleFunction.d.ts +21 -0
  171. package/dist/style/styleFunction.d.ts.map +1 -0
  172. package/dist/style/styleFunction.js +13 -0
  173. package/dist/style/styleFunction.js.map +1 -0
  174. package/dist/tileGrid/getTileUrlsForExtent.d.ts +4 -0
  175. package/dist/tileGrid/getTileUrlsForExtent.d.ts.map +1 -0
  176. package/dist/tileGrid/getTileUrlsForExtent.js +23 -0
  177. package/dist/tileGrid/getTileUrlsForExtent.js.map +1 -0
  178. package/dist/view/centerOnFeature.d.ts +10 -0
  179. package/dist/view/centerOnFeature.d.ts.map +1 -0
  180. package/dist/view/centerOnFeature.js +12 -0
  181. package/dist/view/centerOnFeature.js.map +1 -0
  182. package/dist/view/centerOnFeatures.d.ts +8 -0
  183. package/dist/view/centerOnFeatures.d.ts.map +1 -0
  184. package/dist/view/centerOnFeatures.js +19 -0
  185. package/dist/view/centerOnFeatures.js.map +1 -0
  186. package/dist/view/getMinZoomFittingContentInView.d.ts +15 -0
  187. package/dist/view/getMinZoomFittingContentInView.d.ts.map +1 -0
  188. package/dist/view/getMinZoomFittingContentInView.js +29 -0
  189. package/dist/view/getMinZoomFittingContentInView.js.map +1 -0
  190. package/package.json +36 -0
  191. package/src/js/coordinate/add.ts +13 -0
  192. package/src/js/coordinate/addPixelPadding.ts +21 -0
  193. package/src/js/coordinate/fromPixel.ts +10 -0
  194. package/src/js/coordinate/scale.ts +7 -0
  195. package/src/js/coordinate/toPixel.ts +13 -0
  196. package/src/js/coordinates/equals.ts +6 -0
  197. package/src/js/coordinates/middleCoordinate.ts +7 -0
  198. package/src/js/events/condition/clickOnFeature.ts +13 -0
  199. package/src/js/extent/getCentroid.ts +14 -0
  200. package/src/js/extent/isFiniteExtent.ts +7 -0
  201. package/src/js/extents/combineExtents.ts +11 -0
  202. package/src/js/feature/animator.ts +91 -0
  203. package/src/js/feature/cluster.ts +86 -0
  204. package/src/js/feature/detectFeatureHits.ts +57 -0
  205. package/src/js/feature/ensureId.ts +9 -0
  206. package/src/js/feature/getCentroid.ts +18 -0
  207. package/src/js/feature/getExtent.ts +10 -0
  208. package/src/js/feature/getLayer.ts +39 -0
  209. package/src/js/feature/getUid.ts +6 -0
  210. package/src/js/features/getCentroidForFeatures.ts +10 -0
  211. package/src/js/features/getExtentForFeatures.ts +10 -0
  212. package/src/js/geometry/deriveGeometriesFromBase.ts +122 -0
  213. package/src/js/geometry/getDominantGeometryType.ts +40 -0
  214. package/src/js/geometry/getLineStringSegmentVerticesWithRotation.ts +48 -0
  215. package/src/js/geometry/getPolygonRingSegmentVerticesWithRotation.ts +90 -0
  216. package/src/js/index.ts +62 -0
  217. package/src/js/map/animateDuringTransition.ts +58 -0
  218. package/src/js/map/canvasSizeFixer.ts +46 -0
  219. package/src/js/map/containsExtentWithPadding.ts +17 -0
  220. package/src/js/map/fitToExtent.ts +45 -0
  221. package/src/js/map/fitToFeature.ts +29 -0
  222. package/src/js/map/fitToFeatures.ts +21 -0
  223. package/src/js/map/getPaddedViewExtent.ts +42 -0
  224. package/src/js/map/getVisibleLayersFromFramestate.ts +14 -0
  225. package/src/js/map/updateSizeDuringTransition.ts +9 -0
  226. package/src/js/map/updateSizeOnTransitionEnd.ts +28 -0
  227. package/src/js/points/findClosestPoint.ts +51 -0
  228. package/src/js/points/spreadPointClusterInRadius.ts +84 -0
  229. package/src/js/style/bindStyleToGeometry.ts +11 -0
  230. package/src/js/style/createCachedStyleFunction.ts +344 -0
  231. package/src/js/style/declarationToGeometry.ts +7 -0
  232. package/src/js/style/declarationToStyle.ts +277 -0
  233. package/src/js/style/styleFunction.ts +42 -0
  234. package/src/js/tileGrid/getTileUrlsForExtent.ts +41 -0
  235. package/src/js/view/centerOnFeature.ts +23 -0
  236. package/src/js/view/centerOnFeatures.ts +30 -0
  237. package/src/js/view/getMinZoomFittingContentInView.ts +50 -0
@@ -0,0 +1,11 @@
1
+ import getExtent from "../features/getExtentForFeatures";
2
+ import fitToExtent from "./fitToExtent";
3
+ import { DEFAULT_OPTIONS as SINGLE_FEATURE_DEFAULT_OPTIONS } from "./fitToFeature";
4
+ export const DEFAULT_OPTIONS = { ...SINGLE_FEATURE_DEFAULT_OPTIONS };
5
+ export default function fitToFeatures(map, features, options = DEFAULT_OPTIONS) {
6
+ if (!features.length) {
7
+ return;
8
+ }
9
+ fitToExtent(map, getExtent(features), options);
10
+ }
11
+ //# sourceMappingURL=fitToFeatures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fitToFeatures.js","sourceRoot":"","sources":["../../src/js/map/fitToFeatures.ts"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,kCAAkC,CAAC;AAEzD,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,eAAe,IAAI,8BAA8B,EAAC,MAAM,gBAAgB,CAAC;AAEjF,MAAM,CAAC,MAAM,eAAe,GAAG,EAAC,GAAG,8BAA8B,EAAC,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,aAAa,CACpC,GAAU,EACV,QAAwB,EACxB,UAA8B,eAAe;IAE7C,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtB,OAAO;IACR,CAAC;IAED,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AAChD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type OlMap from "ol/Map";
2
+ import * as olExtent from "ol/extent";
3
+ import type { Padding } from "../index";
4
+ export default function getPaddedViewExtent(map: OlMap, padding: Padding): olExtent.Extent | null;
5
+ //# sourceMappingURL=getPaddedViewExtent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPaddedViewExtent.d.ts","sourceRoot":"","sources":["../../src/js/map/getPaddedViewExtent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAItC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEtC,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,0BAkCvE"}
@@ -0,0 +1,28 @@
1
+ import * as olExtent from "ol/extent";
2
+ import { ensureNonNullable } from "@mapsight/lib-js/nonNullable";
3
+ export default function getPaddedViewExtent(map, padding) {
4
+ const size = map.getSize();
5
+ if (size === undefined) {
6
+ return null;
7
+ }
8
+ // remove padding from size (pixels)
9
+ const [mapWidth, mapHeight] = size;
10
+ const [top, right, bottom, left] = padding;
11
+ const innerMapWith = ensureNonNullable(mapWidth) - left - right;
12
+ const innerMapHeight = ensureNonNullable(mapHeight) - top - bottom;
13
+ const innerMapSize = [innerMapWith, innerMapHeight];
14
+ // pixels -> coondinate
15
+ const paddedCenterPixel = [
16
+ left + innerMapWith / 2,
17
+ top + innerMapHeight / 2,
18
+ ];
19
+ const innerCenterCoordinate = map.getCoordinateFromPixel(paddedCenterPixel);
20
+ const view = map.getView();
21
+ const resolution = view.getResolution();
22
+ const rotation = view.getRotation();
23
+ if (!resolution) {
24
+ return null;
25
+ }
26
+ return olExtent.getForViewAndSize(innerCenterCoordinate, resolution, rotation, innerMapSize);
27
+ }
28
+ //# sourceMappingURL=getPaddedViewExtent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPaddedViewExtent.js","sourceRoot":"","sources":["../../src/js/map/getPaddedViewExtent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAI/D,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,GAAU,EAAE,OAAgB;IACvE,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,oCAAoC;IACpC,MAAM,CAAC,QAAQ,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;IACnC,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC;IAC3C,MAAM,YAAY,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;IAChE,MAAM,cAAc,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC;IACnE,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IAEpD,uBAAuB;IACvB,MAAM,iBAAiB,GAAG;QACzB,IAAI,GAAG,YAAY,GAAG,CAAC;QACvB,GAAG,GAAG,cAAc,GAAG,CAAC;KACxB,CAAC;IACF,MAAM,qBAAqB,GAAG,GAAG,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAE5E,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAEpC,IAAI,CAAC,UAAU,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,OAAO,QAAQ,CAAC,iBAAiB,CAChC,qBAAqB,EACrB,UAAU,EACV,QAAQ,EACR,YAAY,CACZ,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { FrameState } from "ol/Map";
2
+ export default function getVisibleLayersFromFramestate(frameState: FrameState): import("ol/layer/Layer").default<import("ol/source").Source, import("ol/renderer/Layer").default<any>, {
3
+ [x: string]: any;
4
+ }>[];
5
+ //# sourceMappingURL=getVisibleLayersFromFramestate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVisibleLayersFromFramestate.d.ts","sourceRoot":"","sources":["../../src/js/map/getVisibleLayersFromFramestate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAKvC,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAAC,UAAU,EAAE,UAAU;;KAQ5E"}
@@ -0,0 +1,8 @@
1
+ import { inView as layerInView } from "ol/layer/Layer";
2
+ import unique from "lodash/uniq";
3
+ export default function getVisibleLayersFromFramestate(frameState) {
4
+ return unique(frameState.layerStatesArray
5
+ .filter((layerState) => layerInView(layerState, frameState.viewState))
6
+ .map(({ layer }) => layer));
7
+ }
8
+ //# sourceMappingURL=getVisibleLayersFromFramestate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getVisibleLayersFromFramestate.js","sourceRoot":"","sources":["../../src/js/map/getVisibleLayersFromFramestate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,IAAI,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAErD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,MAAM,CAAC,OAAO,UAAU,8BAA8B,CAAC,UAAsB;IAC5E,OAAO,MAAM,CACZ,UAAU,CAAC,gBAAgB;SACzB,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CACtB,WAAW,CAAC,UAAU,EAAE,UAAU,CAAC,SAAS,CAAC,CAC7C;SACA,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CACzB,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type OlMap from "ol/Map";
2
+ export default function updateSizeDuringTransition(map: OlMap): boolean;
3
+ //# sourceMappingURL=updateSizeDuringTransition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeDuringTransition.d.ts","sourceRoot":"","sources":["../../src/js/map/updateSizeDuringTransition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAIhC,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,GAAG,EAAE,KAAK,WAI5D"}
@@ -0,0 +1,7 @@
1
+ import animateDuringTransition from "./animateDuringTransition";
2
+ export default function updateSizeDuringTransition(map) {
3
+ return animateDuringTransition(map, () => {
4
+ map.updateSize();
5
+ });
6
+ }
7
+ //# sourceMappingURL=updateSizeDuringTransition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeDuringTransition.js","sourceRoot":"","sources":["../../src/js/map/updateSizeDuringTransition.ts"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,GAAU;IAC5D,OAAO,uBAAuB,CAAC,GAAG,EAAE,GAAG,EAAE;QACxC,GAAG,CAAC,UAAU,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type OlMap from "ol/Map";
2
+ export default function updateSizeOnTransitionEnd(map: OlMap): void;
3
+ //# sourceMappingURL=updateSizeOnTransitionEnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeOnTransitionEnd.d.ts","sourceRoot":"","sources":["../../src/js/map/updateSizeOnTransitionEnd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,GAAG,EAAE,KAAK,QAyB3D"}
@@ -0,0 +1,19 @@
1
+ export default function updateSizeOnTransitionEnd(map) {
2
+ let previousTargetElement;
3
+ function updateSize() {
4
+ map.updateSize();
5
+ }
6
+ function addEventListener() {
7
+ const targetElement = map.getTargetElement();
8
+ if (previousTargetElement) {
9
+ previousTargetElement.removeEventListener("transitionend", updateSize);
10
+ }
11
+ if (targetElement) {
12
+ targetElement.addEventListener("transitionend", updateSize);
13
+ }
14
+ previousTargetElement = targetElement;
15
+ }
16
+ map.on("change:target", addEventListener);
17
+ addEventListener();
18
+ }
19
+ //# sourceMappingURL=updateSizeOnTransitionEnd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateSizeOnTransitionEnd.js","sourceRoot":"","sources":["../../src/js/map/updateSizeOnTransitionEnd.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAAC,GAAU;IAC3D,IAAI,qBAA8C,CAAC;IAEnD,SAAS,UAAU;QAClB,GAAG,CAAC,UAAU,EAAE,CAAC;IAClB,CAAC;IAED,SAAS,gBAAgB;QACxB,MAAM,aAAa,GAAG,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAE7C,IAAI,qBAAqB,EAAE,CAAC;YAC3B,qBAAqB,CAAC,mBAAmB,CACxC,eAAe,EACf,UAAU,CACV,CAAC;QACH,CAAC;QAED,IAAI,aAAa,EAAE,CAAC;YACnB,aAAa,CAAC,gBAAgB,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;QAC7D,CAAC;QACD,qBAAqB,GAAG,aAAa,CAAC;IACvC,CAAC;IAED,GAAG,CAAC,EAAE,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAC1C,gBAAgB,EAAE,CAAC;AACpB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Coordinate } from "ol/coordinate";
2
+ export type PointsMap = Record<string, Coordinate>;
3
+ /**
4
+ * Finds the closest point to given basePoint [x, y] in map. Returns the key.
5
+ *
6
+ * @param basePoint base point
7
+ * @param pointsMap map of
8
+ * @returns key of the closest point in given pointsMap
9
+ */
10
+ export default function findClosestPoint(basePoint: Coordinate, pointsMap: PointsMap): string | null;
11
+ //# sourceMappingURL=findClosestPoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findClosestPoint.d.ts","sourceRoot":"","sources":["../../src/js/points/findClosestPoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAqB9C,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AAInD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,SAAS,GAClB,MAAM,GAAG,IAAI,CAef"}
@@ -0,0 +1,32 @@
1
+ import { ensureNonNullable } from "@mapsight/lib-js/nonNullable";
2
+ /**
3
+ * Gets distance between points
4
+ *
5
+ * @param a point a
6
+ * @param b point b
7
+ * @returns distance
8
+ */
9
+ function getDistance(a, b) {
10
+ const [aX, aY] = a;
11
+ const [bX, bY] = b;
12
+ return (Math.abs(ensureNonNullable(aX) - ensureNonNullable(bX)) +
13
+ Math.abs(ensureNonNullable(aY) - ensureNonNullable(bY)));
14
+ }
15
+ /**
16
+ * Finds the closest point to given basePoint [x, y] in map. Returns the key.
17
+ *
18
+ * @param basePoint base point
19
+ * @param pointsMap map of
20
+ * @returns key of the closest point in given pointsMap
21
+ */
22
+ export default function findClosestPoint(basePoint, pointsMap) {
23
+ const keys = Object.keys(pointsMap);
24
+ const keyDistances = keys.map((key) => [
25
+ key,
26
+ getDistance(basePoint, ensureNonNullable(pointsMap[key])),
27
+ ]);
28
+ const reduceToSmallestDistance = (a, b) => (a !== null && a[1] > b[1] ? a : b);
29
+ const smallest = keyDistances.reduce(reduceToSmallestDistance, null);
30
+ return smallest === null ? null : smallest[0];
31
+ }
32
+ //# sourceMappingURL=findClosestPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findClosestPoint.js","sourceRoot":"","sources":["../../src/js/points/findClosestPoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAE/D;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,CAAa,EAAE,CAAa;IAChD,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IACnB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;IAEnB,OAAO,CACN,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,CAAC,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC,CACvD,CAAC;AACH,CAAC;AAMD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACvC,SAAqB,EACrB,SAAoB;IAEpB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAC5B,CAAC,GAAG,EAAiB,EAAE,CAAC;QACvB,GAAG;QACH,WAAW,CAAC,SAAS,EAAE,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;KACzD,CACD,CAAC;IACF,MAAM,wBAAwB,GAAG,CAChC,CAAuB,EACvB,CAAgB,EACf,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,YAAY,CAAC,MAAM,CAAC,wBAAwB,EAAE,IAAI,CAAC,CAAC;IAErE,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Coordinate } from "ol/coordinate";
2
+ import type { Resolution } from "../index";
3
+ import type { PointsMap } from "./findClosestPoint";
4
+ /**
5
+ * Spreads points around coords in circle around radius
6
+ *
7
+ * @param coords center of the cluster
8
+ * @param resolution current resolution
9
+ * @param radius radius to spread in
10
+ * @param points points to spread
11
+ * @returns spread points
12
+ */
13
+ export default function spreadPointClusterInRadius(coords: Coordinate, resolution: Resolution, radius: number, points: Array<Coordinate>): PointsMap;
14
+ //# sourceMappingURL=spreadPointClusterInRadius.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spreadPointClusterInRadius.d.ts","sourceRoot":"","sources":["../../src/js/points/spreadPointClusterInRadius.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAM9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAgClD;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CACjD,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,GACvB,SAAS,CA8BX"}
@@ -0,0 +1,53 @@
1
+ import range from "lodash/range";
2
+ import { ensureNonNullable } from "@mapsight/lib-js/nonNullable";
3
+ import findClosestPoint from "./findClosestPoint";
4
+ const FULL_CIRCLE_ANGLE = 2 * Math.PI; // 360 degrees
5
+ /**
6
+ * Calculates points evenly spread on circle around center [x, y] on the given radius.
7
+ *
8
+ * @todo consider exporting / moving into separate file
9
+ *
10
+ * @param center center coordinates
11
+ * @param resolution resolution
12
+ * @param radius radius
13
+ * @param number number of points
14
+ * @returns points on circle
15
+ */
16
+ function calcPointsOnCircle(center, resolution, radius, number) {
17
+ const [x, y] = center;
18
+ const spreadRadius = resolution * radius;
19
+ const spreadAngle = FULL_CIRCLE_ANGLE / number;
20
+ return range(number).map((j) => [
21
+ ensureNonNullable(x) + spreadRadius * Math.cos(j * spreadAngle),
22
+ ensureNonNullable(y) + spreadRadius * Math.sin(j * spreadAngle),
23
+ ]);
24
+ }
25
+ /**
26
+ * Spreads points around coords in circle around radius
27
+ *
28
+ * @param coords center of the cluster
29
+ * @param resolution current resolution
30
+ * @param radius radius to spread in
31
+ * @param points points to spread
32
+ * @returns spread points
33
+ */
34
+ export default function spreadPointClusterInRadius(coords, resolution, radius, points) {
35
+ // Check if too close/too many icons?
36
+ //const sehnenLaenge = 2 * spreadRadius * Math.sin(spreadAngle / 2);
37
+ //console.log({sehnenLaenge: sehnenLaenge});
38
+ // We calculate ideal points on the circle with the given radius
39
+ const targetPoints = calcPointsOnCircle(coords, resolution, radius, points.length);
40
+ // Copy real points to object
41
+ const realPoints = points.reduce((a, v, k) => ({ ...a, [String(k)]: v }), {});
42
+ // Find the closest real point for each point on the circle, save in object keeping the key of the real point
43
+ const spreadPoints = {};
44
+ for (const targetPoint of targetPoints) {
45
+ const key = findClosestPoint(targetPoint, realPoints);
46
+ if (key) {
47
+ delete realPoints[key];
48
+ spreadPoints[key] = targetPoint;
49
+ }
50
+ }
51
+ return spreadPoints;
52
+ }
53
+ //# sourceMappingURL=spreadPointClusterInRadius.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spreadPointClusterInRadius.js","sourceRoot":"","sources":["../../src/js/points/spreadPointClusterInRadius.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAI/D,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAElD,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,cAAc;AAErD;;;;;;;;;;GAUG;AACH,SAAS,kBAAkB,CAC1B,MAAkB,EAClB,UAAsB,EACtB,MAAc,EACd,MAAc;IAEd,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC;IACtB,MAAM,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IACzC,MAAM,WAAW,GAAG,iBAAiB,GAAG,MAAM,CAAC;IAE/C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC;QACvC,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;QAC/D,iBAAiB,CAAC,CAAC,CAAC,GAAG,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC;KAC/D,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CACjD,MAAkB,EAClB,UAAsB,EACtB,MAAc,EACd,MAAyB;IAEzB,qCAAqC;IACrC,oEAAoE;IACpE,4CAA4C;IAE5C,gEAAgE;IAChE,MAAM,YAAY,GAAG,kBAAkB,CACtC,MAAM,EACN,UAAU,EACV,MAAM,EACN,MAAM,CAAC,MAAM,CACb,CAAC;IAEF,6BAA6B;IAC7B,MAAM,UAAU,GAAc,MAAM,CAAC,MAAM,CAC1C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAC,CAAC,EACrC,EAAE,CACF,CAAC;IAEF,6GAA6G;IAC7G,MAAM,YAAY,GAAc,EAAE,CAAC;IACnC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACxC,MAAM,GAAG,GAAG,gBAAgB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACtD,IAAI,GAAG,EAAE,CAAC;YACT,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;YACvB,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC;QACjC,CAAC;IACF,CAAC;IAED,OAAO,YAAY,CAAC;AACrB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type Geometry from "ol/geom/Geometry";
2
+ import type Style from "ol/style/Style";
3
+ export default function bindStyleToGeometry(baseStyle: Style, geometry: Geometry): Style;
4
+ //# sourceMappingURL=bindStyleToGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindStyleToGeometry.d.ts","sourceRoot":"","sources":["../../src/js/style/bindStyleToGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAC1C,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,QAAQ,SAKlB"}
@@ -0,0 +1,6 @@
1
+ export default function bindStyleToGeometry(baseStyle, geometry) {
2
+ const style = baseStyle.clone();
3
+ style.setGeometry(geometry);
4
+ return style;
5
+ }
6
+ //# sourceMappingURL=bindStyleToGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindStyleToGeometry.js","sourceRoot":"","sources":["../../src/js/style/bindStyleToGeometry.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAC1C,SAAgB,EAChB,QAAkB;IAElB,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;IAChC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { Type as GeometryType } from "ol/geom/Geometry";
2
+ import type { MapsightStyleFunction, MapsightStyleFunctionEnv, MapsightStyleFunctionProps } from "./styleFunction.ts";
3
+ export type StyleFunctionMetrics = {
4
+ envHashMs: number;
5
+ propsHashMs: number;
6
+ level1Hits: number;
7
+ level1Misses: number;
8
+ level2Hits: number;
9
+ level2Misses: number;
10
+ declarationMs: number;
11
+ styleMaterializationMs: number;
12
+ inputStylesCount: number;
13
+ outputStylesCount: number;
14
+ geometryCollectionsTraversed: number;
15
+ totalMs: number;
16
+ };
17
+ export type StyleFunctionMetricsCollector = (metrics: StyleFunctionMetrics) => void;
18
+ export type StyleFunctionOptions = {
19
+ constructorsMap: Record<string, unknown>;
20
+ metricsCollector?: StyleFunctionMetricsCollector;
21
+ declarationHashFunction: (env: MapsightStyleFunctionEnv, props: MapsightStyleFunctionProps, envHash: string, geometryType: GeometryType, styleName: string) => string;
22
+ declarationFunction: (env: MapsightStyleFunctionEnv, props: MapsightStyleFunctionProps, geometryType: GeometryType, styleName: string) => unknown;
23
+ allowedProps?: Array<string> | false;
24
+ allowedStyles?: Array<string> | false;
25
+ cacheLevel1Size?: number;
26
+ cacheLevel2Size?: number;
27
+ cacheLevel3Size?: number;
28
+ };
29
+ /**
30
+ * Creates a cached mapsight style function for openlayers
31
+ *
32
+ * @param constructorsMap map of style constructors
33
+ * @param [metricsCollector] optional callback receiving per-invocation runtime metrics (hash timing, cache hit/miss, and declaration/style timings)
34
+ * @param declarationHashFunction style declaration hash function
35
+ * @param declarationFunction style declaration function
36
+ * @param [allowedProps=false] list of props allowed, false = all allowed
37
+ * @param [allowedStyles=false] list of styles allowed, false = all allowed
38
+ * @param [cacheLevel1Size=100] size of first level cache that caches feature geometry styles based on feature and environment state
39
+ * @param [cacheLevel2Size=100] size of second level cache that caches style objects based on the rules that apply and the environment state
40
+ * @param [cacheLevel3Size=100] size of third level cache that caches style objects based on the rules that apply and the environment state
41
+ *
42
+ * @returns style function
43
+ */
44
+ export default function createCachedStyleFunction({ constructorsMap, metricsCollector, declarationHashFunction, declarationFunction, allowedProps, allowedStyles, cacheLevel1Size, cacheLevel2Size, cacheLevel3Size, }: StyleFunctionOptions): MapsightStyleFunction;
45
+ //# sourceMappingURL=createCachedStyleFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCachedStyleFunction.d.ts","sourceRoot":"","sources":["../../src/js/style/createCachedStyleFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,IAAI,IAAI,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAa3D,OAAO,KAAK,EACX,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,oBAAoB,CAAC;AAmB5B,MAAM,MAAM,oBAAoB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC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+ import deriveGeometriesFromBase from "../geometry/deriveGeometriesFromBase.js";
4
+ import declarationToGeometry from "./declarationToGeometry.js";
5
+ import declarationToStyle from "./declarationToStyle.js";
6
+ import { STYLE_ENV_FIELD_NAME, createPropsFilter } from "./styleFunction.js";
7
+ const TYPE_GEOMETRY_COLLECTION = "GeometryCollection";
8
+ const DEFAULT_STYLE = "default";
9
+ const HASH_STRING_DELIMITER = "|";
10
+ const DEFAULT_ROOT_STYLE_TYPE = "style";
11
+ const DEFAULT_CACHE_LEVEL_1_SIZE = 100;
12
+ const DEFAULT_CACHE_LEVEL_2_SIZE = 100;
13
+ const DEFAULT_CACHE_LEVEL_3_SIZE = 100;
14
+ /**
15
+ * Creates a cached mapsight style function for openlayers
16
+ *
17
+ * @param constructorsMap map of style constructors
18
+ * @param [metricsCollector] optional callback receiving per-invocation runtime metrics (hash timing, cache hit/miss, and declaration/style timings)
19
+ * @param declarationHashFunction style declaration hash function
20
+ * @param declarationFunction style declaration function
21
+ * @param [allowedProps=false] list of props allowed, false = all allowed
22
+ * @param [allowedStyles=false] list of styles allowed, false = all allowed
23
+ * @param [cacheLevel1Size=100] size of first level cache that caches feature geometry styles based on feature and environment state
24
+ * @param [cacheLevel2Size=100] size of second level cache that caches style objects based on the rules that apply and the environment state
25
+ * @param [cacheLevel3Size=100] size of third level cache that caches style objects based on the rules that apply and the environment state
26
+ *
27
+ * @returns style function
28
+ */
29
+ export default function createCachedStyleFunction({ constructorsMap, metricsCollector, declarationHashFunction, declarationFunction, allowedProps = false, allowedStyles = false, cacheLevel1Size = DEFAULT_CACHE_LEVEL_1_SIZE, cacheLevel2Size = DEFAULT_CACHE_LEVEL_2_SIZE, cacheLevel3Size = DEFAULT_CACHE_LEVEL_3_SIZE, }) {
30
+ const hasMetricsCollector = typeof metricsCollector === "function";
31
+ const filterProps = createPropsFilter(allowedProps);
32
+ const createHash = (value) => JSON.stringify(value);
33
+ const cacheLevel1 = new LRUCache(cacheLevel1Size); // the first level cache caches feature geometry styles based on feature and environment state
34
+ const cacheLevel2 = new LRUCache(cacheLevel2Size); // the second level cache caches style objects based on the rules that apply and the environment state
35
+ const cacheLevel3 = new LRUCache(cacheLevel3Size); // the third level cache caches style objects based on the rules that apply and the environment state
36
+ function level1(env, props, envHash, propsHash, geometryType, metrics) {
37
+ const cacheHashL1 = envHash +
38
+ HASH_STRING_DELIMITER +
39
+ geometryType +
40
+ HASH_STRING_DELIMITER +
41
+ propsHash;
42
+ const hasLevel1 = cacheLevel1.containsKey(cacheHashL1);
43
+ if (metrics) {
44
+ if (hasLevel1) {
45
+ metrics.level1Hits += 1;
46
+ }
47
+ else {
48
+ metrics.level1Misses += 1;
49
+ }
50
+ }
51
+ if (!hasLevel1) {
52
+ cacheLevel1.set(cacheHashL1, level2(env, props, envHash, propsHash, geometryType, metrics));
53
+ }
54
+ return cacheLevel1.get(cacheHashL1);
55
+ }
56
+ function level2(env, props, envHash, propsHash, geometryType, metrics) {
57
+ let styleName = DEFAULT_STYLE;
58
+ const envStyle = env[STYLE_ENV_FIELD_NAME];
59
+ if (typeof envStyle === "string") {
60
+ if (allowedStyles === false) {
61
+ styleName = envStyle;
62
+ }
63
+ else {
64
+ styleName =
65
+ allowedStyles.indexOf(envStyle) > -1
66
+ ? envStyle
67
+ : DEFAULT_STYLE;
68
+ }
69
+ }
70
+ const cacheHashL2 = declarationHashFunction(env, props, envHash, geometryType, styleName);
71
+ if (cacheLevel2.containsKey(cacheHashL2)) {
72
+ if (metrics) {
73
+ metrics.level2Hits += 1;
74
+ }
75
+ return cacheLevel2.get(cacheHashL2);
76
+ }
77
+ if (metrics) {
78
+ metrics.level2Misses += 1;
79
+ }
80
+ const declarationStart = metrics ? performance.now() : 0;
81
+ const declarations = declarationFunction(env, props, geometryType, styleName); // Having to cast here because of the tsc bug noted above
82
+ if (metrics) {
83
+ metrics.declarationMs += performance.now() - declarationStart;
84
+ }
85
+ const styleMaterializationStart = metrics ? performance.now() : 0;
86
+ const values = Object.keys(declarations).map((group) => ({
87
+ style: declarationToStyle(constructorsMap, ensureNonNullable(declarations[group]), DEFAULT_ROOT_STYLE_TYPE, group + "," + cacheHashL2, cacheLevel3),
88
+ geometryTypeOrDerivation: declarationToGeometry(declarations[group]),
89
+ }));
90
+ if (metrics) {
91
+ metrics.styleMaterializationMs +=
92
+ performance.now() - styleMaterializationStart;
93
+ metrics.inputStylesCount += values.length;
94
+ }
95
+ cacheLevel2.set(cacheHashL2, values);
96
+ return values;
97
+ }
98
+ function styleGeometryOrGeometryCollectionCached(env, props, envHash, propsHash, geometryOrGeometryCollection, metrics, i = 0) {
99
+ if (!geometryOrGeometryCollection) {
100
+ return [];
101
+ }
102
+ const geometryType = geometryOrGeometryCollection.getType();
103
+ // recurse through collections
104
+ if (geometryType === TYPE_GEOMETRY_COLLECTION) {
105
+ if (metrics) {
106
+ metrics.geometryCollectionsTraversed += 1;
107
+ }
108
+ const collection = geometryOrGeometryCollection;
109
+ return collection
110
+ .getGeometries()
111
+ .flatMap((geometry) => styleGeometryOrGeometryCollectionCached(env, props, envHash, propsHash, geometry, metrics, i + 1));
112
+ }
113
+ return level1(env, props, envHash, propsHash, geometryType, metrics)
114
+ .filter(({ style }) => style != null)
115
+ .flatMap(function bindStyleToBaseGeometry({ style: baseStyle, geometryTypeOrDerivation: geometryDerivation, }) {
116
+ if (baseStyle === null) {
117
+ return [];
118
+ }
119
+ const derivedGeometries = deriveGeometriesFromBase(geometryOrGeometryCollection, geometryDerivation);
120
+ return derivedGeometries.map(function bindDerivedGeometryToStyle(geometryWithMeta) {
121
+ const [geometry, meta] = geometryWithMeta;
122
+ const style = baseStyle.clone();
123
+ style.setGeometry(geometry);
124
+ const baseImageStyle = style.getImage();
125
+ if (meta?.rotation != null && baseImageStyle) {
126
+ const imageStyle = baseImageStyle.clone();
127
+ const baseRotation = imageStyle.getRotation();
128
+ imageStyle.setRotation(baseRotation + meta.rotation);
129
+ style.setImage(imageStyle);
130
+ }
131
+ return style;
132
+ });
133
+ });
134
+ }
135
+ const cachedStyleFunction = (env = {}, feature) => {
136
+ const totalStart = hasMetricsCollector ? performance.now() : 0;
137
+ const metrics = hasMetricsCollector
138
+ ? {
139
+ envHashMs: 0,
140
+ propsHashMs: 0,
141
+ level1Hits: 0,
142
+ level1Misses: 0,
143
+ level2Hits: 0,
144
+ level2Misses: 0,
145
+ declarationMs: 0,
146
+ styleMaterializationMs: 0,
147
+ inputStylesCount: 0,
148
+ outputStylesCount: 0,
149
+ geometryCollectionsTraversed: 0,
150
+ totalMs: 0,
151
+ }
152
+ : undefined;
153
+ // subset of feature properties that are relevant for styling (also used for caching decisions)
154
+ const filteredProps = filterProps(feature.getProperties());
155
+ const envHashStart = hasMetricsCollector ? performance.now() : 0;
156
+ const envHash = createHash(env);
157
+ if (metrics) {
158
+ metrics.envHashMs = performance.now() - envHashStart;
159
+ }
160
+ const propsHashStart = hasMetricsCollector ? performance.now() : 0;
161
+ const propsHash = createHash(filteredProps);
162
+ if (metrics) {
163
+ metrics.propsHashMs = performance.now() - propsHashStart;
164
+ }
165
+ const styles = styleGeometryOrGeometryCollectionCached(env, filteredProps, envHash, propsHash, feature.getGeometry(), metrics);
166
+ if (metrics && metricsCollector) {
167
+ metrics.outputStylesCount = styles.length;
168
+ metrics.totalMs = performance.now() - totalStart;
169
+ metricsCollector(metrics);
170
+ }
171
+ return styles;
172
+ };
173
+ return cachedStyleFunction;
174
+ }
175
+ //# sourceMappingURL=createCachedStyleFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCachedStyleFunction.js","sourceRoot":"","sources":["../../src/js/style/createCachedStyleFunction.ts"],"names":[],"mappings":"AAGA,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAG3C,OAAO,EAAC,iBAAiB,EAAC,MAAM,8BAA8B,CAAC;AAG/D,OAAO,wBAAwB,MAAM,yCAAyC,CAAC;AAE/E,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AAMzD,OA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AC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;QACtD,CAAC;QACD,MAAM,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACnE,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;QAC5C,IAAI,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,cAAc,CAAC;QAC1D,CAAC;QAED,MAAM,MAAM,GAAG,uCAAuC,CACrD,GAAG,EACH,aAAa,EACb,OAAO,EACP,SAAS,EACT,OAAO,CAAC,WAAW,EAAc,EACjC,OAAO,CACP,CAAC;QAEF,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAAC;YACjC,OAAO,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;YAC1C,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;YACjD,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,mBAAmB,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { RootStyleDeclaration } from "../index";
2
+ export default function declarationToGeometry(declaration?: RootStyleDeclaration): import("../geometry/deriveGeometriesFromBase").Derivation | import("ol/geom/Geometry").Type | null;
3
+ //# sourceMappingURL=declarationToGeometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarationToGeometry.d.ts","sourceRoot":"","sources":["../../src/js/style/declarationToGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAEnD,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC5C,WAAW,CAAC,EAAE,oBAAoB,sGAGlC"}
@@ -0,0 +1,4 @@
1
+ export default function declarationToGeometry(declaration) {
2
+ return declaration?.geometry?.value || null;
3
+ }
4
+ //# sourceMappingURL=declarationToGeometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarationToGeometry.js","sourceRoot":"","sources":["../../src/js/style/declarationToGeometry.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAC5C,WAAkC;IAElC,OAAO,WAAW,EAAE,QAAQ,EAAE,KAAK,IAAI,IAAI,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import LRUCache from "ol/structs/LRUCache";
2
+ import type Style from "ol/style/Style";
3
+ import type { RootStyleDeclaration, StyleDeclaration } from "../index";
4
+ export declare const DEFAULT_CACHE_SIZE = 100;
5
+ export default function declarationToStyle<StyleKey extends string = string>(constructorsMap: Record<StyleKey, unknown>, declaration: Readonly<RootStyleDeclaration | StyleDeclaration>, type: StyleKey, hash?: string, cache?: LRUCache<Style | null>, root?: boolean): null | Style;
6
+ //# sourceMappingURL=declarationToStyle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"declarationToStyle.d.ts","sourceRoot":"","sources":["../../src/js/style/declarationToStyle.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAE3C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAGX,oBAAoB,EACpB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AA6BlB,eAAO,MAAM,kBAAkB,MAAM,CAAC;AA8MtC,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,QAAQ,SAAS,MAAM,GAAG,MAAM,EAC1E,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC1C,WAAW,EAAE,QAAQ,CAAC,oBAAoB,GAAG,gBAAgB,CAAC,EAC9D,IAAI,EAAE,QAAQ,EACd,IAAI,CAAC,EAAE,MAAM,EACb,KAAK,GAAE,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAqB,EACjD,IAAI,UAAO,GACT,IAAI,GAAG,KAAK,CAsBd"}