@artstesh/maps 5.1.8 → 6.0.2

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 (338) hide show
  1. package/README.md +13 -13
  2. package/dist/README.md +24 -24
  3. package/dist/esm2022/map/common/destructible.component.mjs +18 -18
  4. package/dist/esm2022/map/common/id.generator.mjs +14 -14
  5. package/dist/esm2022/map/helpers/index.mjs +4 -4
  6. package/dist/esm2022/map/helpers/marker-style.helper.mjs +54 -54
  7. package/dist/esm2022/map/helpers/polygon-style.helper.mjs +53 -53
  8. package/dist/esm2022/map/helpers/stringify-feature.helper.mjs +61 -61
  9. package/dist/esm2022/map/helpers/text-style.helper.mjs +24 -24
  10. package/dist/esm2022/map/map-plate/controls/index.mjs +2 -2
  11. package/dist/esm2022/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +69 -69
  12. package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +12 -12
  13. package/dist/esm2022/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +115 -115
  14. package/dist/esm2022/map/map-plate/features/index.mjs +2 -2
  15. package/dist/esm2022/map/map-plate/features/markers/markers.component.mjs +52 -52
  16. package/dist/esm2022/map/map-plate/features/polygons/polygons.component.mjs +52 -52
  17. package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -59
  18. package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +60 -60
  19. package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +38 -38
  20. package/dist/esm2022/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +144 -144
  21. package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -52
  22. package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +28 -28
  23. package/dist/esm2022/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +111 -111
  24. package/dist/esm2022/map/map-plate/layers/index.mjs +7 -7
  25. package/dist/esm2022/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -57
  26. package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.component.mjs +52 -52
  27. package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +50 -50
  28. package/dist/esm2022/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +119 -119
  29. package/dist/esm2022/map/map-plate/map-plate.component.mjs +102 -102
  30. package/dist/esm2022/map/map-plate/map-plate.factory.service.mjs +27 -27
  31. package/dist/esm2022/map/map-plate/tooltips/index.mjs +2 -2
  32. package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.component.mjs +81 -81
  33. package/dist/esm2022/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +30 -30
  34. package/dist/esm2022/map/map.module.mjs +63 -63
  35. package/dist/esm2022/map/messages/commands/add-control.command.mjs +12 -12
  36. package/dist/esm2022/map/messages/commands/add-layer.command.mjs +12 -12
  37. package/dist/esm2022/map/messages/commands/add-tile.command.mjs +12 -12
  38. package/dist/esm2022/map/messages/commands/cancel-drawing.command.mjs +7 -7
  39. package/dist/esm2022/map/messages/commands/cancel-feature-modification.command.mjs +7 -7
  40. package/dist/esm2022/map/messages/commands/close-tooltip.command.mjs +12 -12
  41. package/dist/esm2022/map/messages/commands/draw-selection-area.command.mjs +16 -16
  42. package/dist/esm2022/map/messages/commands/fit-to-features.command.mjs +14 -14
  43. package/dist/esm2022/map/messages/commands/fit-to-polygons.command.mjs +14 -14
  44. package/dist/esm2022/map/messages/commands/modify-feature.command.mjs +17 -17
  45. package/dist/esm2022/map/messages/commands/place-layer-features.command.mjs +14 -14
  46. package/dist/esm2022/map/messages/commands/remove-control.command.mjs +12 -12
  47. package/dist/esm2022/map/messages/commands/remove-layer.command.mjs +12 -12
  48. package/dist/esm2022/map/messages/commands/remove-tile.command.mjs +12 -12
  49. package/dist/esm2022/map/messages/commands/set-map-center.command.mjs +25 -25
  50. package/dist/esm2022/map/messages/commands/start-drawing.command.mjs +17 -17
  51. package/dist/esm2022/map/messages/events/drawing-finished.event.mjs +10 -10
  52. package/dist/esm2022/map/messages/events/map-click.event.mjs +16 -16
  53. package/dist/esm2022/map/messages/events/map-move-end.event.mjs +14 -14
  54. package/dist/esm2022/map/messages/events/map-rendered.event.mjs +12 -12
  55. package/dist/esm2022/map/messages/executors/calculate-area.executor.mjs +12 -12
  56. package/dist/esm2022/map/messages/executors/filter-features-in-area.executor.mjs +14 -14
  57. package/dist/esm2022/map/messages/executors/generate-draw.executor.mjs +16 -16
  58. package/dist/esm2022/map/messages/executors/generate-zoom-control.executor.mjs +12 -12
  59. package/dist/esm2022/map/messages/index.mjs +14 -14
  60. package/dist/esm2022/map/messages/queries/get-features-in-area.query.mjs +14 -14
  61. package/dist/esm2022/map/messages/queries/get-layer.query.mjs +12 -12
  62. package/dist/esm2022/map/models/drawing-type.enum.mjs +7 -7
  63. package/dist/esm2022/map/models/feature-format.enum.mjs +5 -5
  64. package/dist/esm2022/map/models/i-identified.mjs +1 -1
  65. package/dist/esm2022/map/models/index.mjs +7 -7
  66. package/dist/esm2022/map/models/map-control.mjs +14 -14
  67. package/dist/esm2022/map/models/map-lyrs.enum.mjs +18 -18
  68. package/dist/esm2022/map/models/map-settings.mjs +50 -50
  69. package/dist/esm2022/map/models/map.constants.mjs +4 -4
  70. package/dist/esm2022/map/models/marker-model.mjs +28 -28
  71. package/dist/esm2022/map/models/polygon.model.mjs +32 -32
  72. package/dist/esm2022/map/public-api.mjs +15 -15
  73. package/dist/esm2022/map/services/controls/controls.service.mjs +39 -39
  74. package/dist/esm2022/map/services/drawing/drawing-generation.service.mjs +25 -25
  75. package/dist/esm2022/map/services/drawing/drawing.service.mjs +101 -101
  76. package/dist/esm2022/map/services/drawing/feature-modification.service.mjs +103 -103
  77. package/dist/esm2022/map/services/feature.service.mjs +21 -21
  78. package/dist/esm2022/map/services/map-click.service.mjs +55 -55
  79. package/dist/esm2022/map/services/map-feature.service.mjs +55 -55
  80. package/dist/esm2022/map/services/map-management.service.mjs +103 -103
  81. package/dist/esm2022/map/services/map-postboy.service.mjs +18 -18
  82. package/dist/esm2022/map/services/map-state.service.mjs +42 -42
  83. package/dist/esm2022/map/services/message-registrator.service.mjs +82 -82
  84. package/dist/esm2022/maps-components.mjs +4 -4
  85. package/dist/esm2022/public-api.mjs +4 -4
  86. package/dist/esm2022/src/map/common/destructible.component.mjs +18 -18
  87. package/dist/esm2022/src/map/common/id.generator.mjs +14 -14
  88. package/dist/esm2022/src/map/helpers/index.mjs +4 -4
  89. package/dist/esm2022/src/map/helpers/marker-style.helper.mjs +54 -54
  90. package/dist/esm2022/src/map/helpers/polygon-style.helper.mjs +53 -53
  91. package/dist/esm2022/src/map/helpers/stringify-feature.helper.mjs +61 -61
  92. package/dist/esm2022/src/map/helpers/text-style.helper.mjs +24 -24
  93. package/dist/esm2022/src/map/map-plate/controls/index.mjs +2 -2
  94. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.mjs +69 -69
  95. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.mjs +12 -12
  96. package/dist/esm2022/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.mjs +115 -115
  97. package/dist/esm2022/src/map/map-plate/features/index.mjs +2 -2
  98. package/dist/esm2022/src/map/map-plate/features/markers/markers.component.mjs +52 -52
  99. package/dist/esm2022/src/map/map-plate/features/polygons/polygons.component.mjs +52 -52
  100. package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.mjs +59 -59
  101. package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.component.mjs +60 -60
  102. package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.mjs +38 -38
  103. package/dist/esm2022/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.mjs +144 -144
  104. package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.component.mjs +52 -52
  105. package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.factory.mjs +28 -28
  106. package/dist/esm2022/src/map/map-plate/layers/feature-layer/feature-layer.settings.mjs +111 -111
  107. package/dist/esm2022/src/map/map-plate/layers/index.mjs +7 -7
  108. package/dist/esm2022/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.mjs +57 -57
  109. package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.component.mjs +52 -52
  110. package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.factory.mjs +50 -50
  111. package/dist/esm2022/src/map/map-plate/layers/tile-layer/tile-layer.settings.mjs +119 -119
  112. package/dist/esm2022/src/map/map-plate/map-plate.component.mjs +102 -102
  113. package/dist/esm2022/src/map/map-plate/map-plate.factory.service.mjs +27 -27
  114. package/dist/esm2022/src/map/map-plate/tooltips/index.mjs +2 -2
  115. package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.component.mjs +81 -81
  116. package/dist/esm2022/src/map/map-plate/tooltips/tooltip/tooltip.settings.mjs +30 -30
  117. package/dist/esm2022/src/map/map.module.mjs +63 -63
  118. package/dist/esm2022/src/map/maps-components-src-map.mjs +4 -4
  119. package/dist/esm2022/src/map/messages/commands/add-control.command.mjs +12 -12
  120. package/dist/esm2022/src/map/messages/commands/add-layer.command.mjs +12 -12
  121. package/dist/esm2022/src/map/messages/commands/add-tile.command.mjs +12 -12
  122. package/dist/esm2022/src/map/messages/commands/cancel-drawing.command.mjs +7 -7
  123. package/dist/esm2022/src/map/messages/commands/cancel-feature-modification.command.mjs +7 -7
  124. package/dist/esm2022/src/map/messages/commands/close-tooltip.command.mjs +12 -12
  125. package/dist/esm2022/src/map/messages/commands/draw-selection-area.command.mjs +16 -16
  126. package/dist/esm2022/src/map/messages/commands/fit-to-features.command.mjs +14 -14
  127. package/dist/esm2022/src/map/messages/commands/fit-to-polygons.command.mjs +14 -14
  128. package/dist/esm2022/src/map/messages/commands/modify-feature.command.mjs +17 -17
  129. package/dist/esm2022/src/map/messages/commands/place-layer-features.command.mjs +14 -14
  130. package/dist/esm2022/src/map/messages/commands/remove-control.command.mjs +12 -12
  131. package/dist/esm2022/src/map/messages/commands/remove-layer.command.mjs +12 -12
  132. package/dist/esm2022/src/map/messages/commands/remove-tile.command.mjs +12 -12
  133. package/dist/esm2022/src/map/messages/commands/set-map-center.command.mjs +25 -25
  134. package/dist/esm2022/src/map/messages/commands/start-drawing.command.mjs +17 -17
  135. package/dist/esm2022/src/map/messages/events/drawing-finished.event.mjs +10 -10
  136. package/dist/esm2022/src/map/messages/events/map-click.event.mjs +16 -16
  137. package/dist/esm2022/src/map/messages/events/map-move-end.event.mjs +14 -14
  138. package/dist/esm2022/src/map/messages/events/map-rendered.event.mjs +12 -12
  139. package/dist/esm2022/src/map/messages/executors/calculate-area.executor.mjs +12 -12
  140. package/dist/esm2022/src/map/messages/executors/filter-features-in-area.executor.mjs +14 -14
  141. package/dist/esm2022/src/map/messages/executors/generate-draw.executor.mjs +16 -16
  142. package/dist/esm2022/src/map/messages/executors/generate-zoom-control.executor.mjs +12 -12
  143. package/dist/esm2022/src/map/messages/index.mjs +14 -14
  144. package/dist/esm2022/src/map/messages/queries/get-features-in-area.query.mjs +14 -14
  145. package/dist/esm2022/src/map/messages/queries/get-layer.query.mjs +12 -12
  146. package/dist/esm2022/src/map/models/drawing-type.enum.mjs +7 -7
  147. package/dist/esm2022/src/map/models/feature-format.enum.mjs +5 -5
  148. package/dist/esm2022/src/map/models/i-identified.mjs +1 -1
  149. package/dist/esm2022/src/map/models/index.mjs +7 -7
  150. package/dist/esm2022/src/map/models/map-control.mjs +14 -14
  151. package/dist/esm2022/src/map/models/map-lyrs.enum.mjs +18 -18
  152. package/dist/esm2022/src/map/models/map-settings.mjs +50 -50
  153. package/dist/esm2022/src/map/models/map.constants.mjs +4 -4
  154. package/dist/esm2022/src/map/models/marker-model.mjs +28 -28
  155. package/dist/esm2022/src/map/models/polygon.model.mjs +32 -32
  156. package/dist/esm2022/src/map/public-api.mjs +15 -15
  157. package/dist/esm2022/src/map/services/controls/controls.service.mjs +39 -39
  158. package/dist/esm2022/src/map/services/drawing/drawing-generation.service.mjs +25 -25
  159. package/dist/esm2022/src/map/services/drawing/drawing.service.mjs +101 -101
  160. package/dist/esm2022/src/map/services/drawing/feature-modification.service.mjs +103 -103
  161. package/dist/esm2022/src/map/services/feature.service.mjs +21 -21
  162. package/dist/esm2022/src/map/services/map-click.service.mjs +55 -55
  163. package/dist/esm2022/src/map/services/map-feature.service.mjs +55 -55
  164. package/dist/esm2022/src/map/services/map-management.service.mjs +103 -103
  165. package/dist/esm2022/src/map/services/map-postboy.service.mjs +18 -18
  166. package/dist/esm2022/src/map/services/map-state.service.mjs +42 -42
  167. package/dist/esm2022/src/map/services/message-registrator.service.mjs +82 -82
  168. package/dist/fesm2022/maps-components-src-map.mjs +2460 -2460
  169. package/dist/fesm2022/maps-components-src-map.mjs.map +1 -1
  170. package/dist/fesm2022/maps-components.mjs +2462 -2462
  171. package/dist/fesm2022/maps-components.mjs.map +1 -1
  172. package/dist/index.d.ts +5 -5
  173. package/dist/map/common/destructible.component.d.ts +10 -10
  174. package/dist/map/common/id.generator.d.ts +4 -4
  175. package/dist/map/helpers/index.d.ts +4 -4
  176. package/dist/map/helpers/marker-style.helper.d.ts +33 -33
  177. package/dist/map/helpers/polygon-style.helper.d.ts +26 -26
  178. package/dist/map/helpers/stringify-feature.helper.d.ts +26 -26
  179. package/dist/map/helpers/text-style.helper.d.ts +15 -15
  180. package/dist/map/map-plate/controls/index.d.ts +2 -2
  181. package/dist/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +36 -36
  182. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -5
  183. package/dist/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +85 -85
  184. package/dist/map/map-plate/features/index.d.ts +2 -2
  185. package/dist/map/map-plate/features/markers/markers.component.d.ts +26 -26
  186. package/dist/map/map-plate/features/polygons/polygons.component.d.ts +26 -26
  187. package/dist/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -11
  188. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +29 -29
  189. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +13 -13
  190. package/dist/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +100 -100
  191. package/dist/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +22 -22
  192. package/dist/map/map-plate/layers/feature-layer/feature-layer.factory.d.ts +9 -9
  193. package/dist/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +81 -81
  194. package/dist/map/map-plate/layers/index.d.ts +7 -7
  195. package/dist/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +19 -19
  196. package/dist/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +21 -21
  197. package/dist/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -11
  198. package/dist/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +89 -89
  199. package/dist/map/map-plate/map-plate.component.d.ts +27 -27
  200. package/dist/map/map-plate/map-plate.factory.service.d.ts +8 -8
  201. package/dist/map/map-plate/tooltips/index.d.ts +2 -2
  202. package/dist/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -26
  203. package/dist/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -11
  204. package/dist/map/map.module.d.ts +17 -17
  205. package/dist/map/messages/commands/add-control.command.d.ts +8 -8
  206. package/dist/map/messages/commands/add-layer.command.d.ts +10 -10
  207. package/dist/map/messages/commands/add-tile.command.d.ts +9 -9
  208. package/dist/map/messages/commands/cancel-drawing.command.d.ts +5 -5
  209. package/dist/map/messages/commands/cancel-feature-modification.command.d.ts +5 -5
  210. package/dist/map/messages/commands/close-tooltip.command.d.ts +7 -7
  211. package/dist/map/messages/commands/draw-selection-area.command.d.ts +13 -13
  212. package/dist/map/messages/commands/fit-to-features.command.d.ts +10 -10
  213. package/dist/map/messages/commands/fit-to-polygons.command.d.ts +9 -9
  214. package/dist/map/messages/commands/modify-feature.command.d.ts +11 -11
  215. package/dist/map/messages/commands/place-layer-features.command.d.ts +10 -10
  216. package/dist/map/messages/commands/remove-control.command.d.ts +8 -8
  217. package/dist/map/messages/commands/remove-layer.command.d.ts +8 -8
  218. package/dist/map/messages/commands/remove-tile.command.d.ts +9 -9
  219. package/dist/map/messages/commands/set-map-center.command.d.ts +18 -18
  220. package/dist/map/messages/commands/start-drawing.command.d.ts +11 -11
  221. package/dist/map/messages/events/drawing-finished.event.d.ts +6 -6
  222. package/dist/map/messages/events/map-click.event.d.ts +20 -20
  223. package/dist/map/messages/events/map-move-end.event.d.ts +8 -8
  224. package/dist/map/messages/events/map-rendered.event.d.ts +8 -8
  225. package/dist/map/messages/executors/calculate-area.executor.d.ts +10 -10
  226. package/dist/map/messages/executors/filter-features-in-area.executor.d.ts +10 -10
  227. package/dist/map/messages/executors/generate-draw.executor.d.ts +14 -14
  228. package/dist/map/messages/executors/generate-zoom-control.executor.d.ts +9 -9
  229. package/dist/map/messages/index.d.ts +14 -14
  230. package/dist/map/messages/queries/get-features-in-area.query.d.ts +11 -11
  231. package/dist/map/messages/queries/get-layer.query.d.ts +10 -10
  232. package/dist/map/models/drawing-type.enum.d.ts +6 -6
  233. package/dist/map/models/feature-format.enum.d.ts +4 -4
  234. package/dist/map/models/i-identified.d.ts +3 -3
  235. package/dist/map/models/index.d.ts +7 -7
  236. package/dist/map/models/map-control.d.ts +13 -13
  237. package/dist/map/models/map-lyrs.enum.d.ts +10 -10
  238. package/dist/map/models/map-settings.d.ts +17 -17
  239. package/dist/map/models/map.constants.d.ts +4 -4
  240. package/dist/map/models/marker-model.d.ts +16 -16
  241. package/dist/map/models/polygon.model.d.ts +19 -19
  242. package/dist/map/public-api.d.ts +12 -12
  243. package/dist/map/services/controls/controls.service.d.ts +14 -14
  244. package/dist/map/services/drawing/drawing-generation.service.d.ts +6 -6
  245. package/dist/map/services/drawing/drawing.service.d.ts +19 -19
  246. package/dist/map/services/drawing/feature-modification.service.d.ts +22 -22
  247. package/dist/map/services/feature.service.d.ts +9 -9
  248. package/dist/map/services/map-click.service.d.ts +16 -16
  249. package/dist/map/services/map-feature.service.d.ts +16 -16
  250. package/dist/map/services/map-management.service.d.ts +20 -20
  251. package/dist/map/services/map-postboy.service.d.ts +7 -7
  252. package/dist/map/services/map-state.service.d.ts +13 -13
  253. package/dist/map/services/message-registrator.service.d.ts +17 -17
  254. package/dist/public-api.d.ts +1 -1
  255. package/dist/src/map/common/destructible.component.d.ts +10 -10
  256. package/dist/src/map/common/id.generator.d.ts +4 -4
  257. package/dist/src/map/helpers/index.d.ts +4 -4
  258. package/dist/src/map/helpers/marker-style.helper.d.ts +33 -33
  259. package/dist/src/map/helpers/polygon-style.helper.d.ts +26 -26
  260. package/dist/src/map/helpers/stringify-feature.helper.d.ts +26 -26
  261. package/dist/src/map/helpers/text-style.helper.d.ts +15 -15
  262. package/dist/src/map/index.d.ts +5 -5
  263. package/dist/src/map/map-plate/controls/index.d.ts +2 -2
  264. package/dist/src/map/map-plate/controls/map-control-zoom/map-control-zoom.component.d.ts +36 -36
  265. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.factory.d.ts +5 -5
  266. package/dist/src/map/map-plate/controls/map-control-zoom/zoom-control.settings.d.ts +85 -85
  267. package/dist/src/map/map-plate/features/index.d.ts +2 -2
  268. package/dist/src/map/map-plate/features/markers/markers.component.d.ts +26 -26
  269. package/dist/src/map/map-plate/features/polygons/polygons.component.d.ts +26 -26
  270. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer-factory.service.d.ts +11 -11
  271. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.component.d.ts +29 -29
  272. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.manager.d.ts +13 -13
  273. package/dist/src/map/map-plate/layers/cluster-layer/cluster-layer.settings.d.ts +100 -100
  274. package/dist/src/map/map-plate/layers/feature-layer/feature-layer.component.d.ts +22 -22
  275. package/dist/src/map/map-plate/layers/feature-layer/feature-layer.factory.d.ts +9 -9
  276. package/dist/src/map/map-plate/layers/feature-layer/feature-layer.settings.d.ts +81 -81
  277. package/dist/src/map/map-plate/layers/index.d.ts +7 -7
  278. package/dist/src/map/map-plate/layers/osm-tile-layer/osm-tile-layer.component.d.ts +19 -19
  279. package/dist/src/map/map-plate/layers/tile-layer/tile-layer.component.d.ts +21 -21
  280. package/dist/src/map/map-plate/layers/tile-layer/tile-layer.factory.d.ts +11 -11
  281. package/dist/src/map/map-plate/layers/tile-layer/tile-layer.settings.d.ts +89 -89
  282. package/dist/src/map/map-plate/map-plate.component.d.ts +27 -27
  283. package/dist/src/map/map-plate/map-plate.factory.service.d.ts +8 -8
  284. package/dist/src/map/map-plate/tooltips/index.d.ts +2 -2
  285. package/dist/src/map/map-plate/tooltips/tooltip/tooltip.component.d.ts +26 -26
  286. package/dist/src/map/map-plate/tooltips/tooltip/tooltip.settings.d.ts +11 -11
  287. package/dist/src/map/map.module.d.ts +17 -17
  288. package/dist/src/map/messages/commands/add-control.command.d.ts +8 -8
  289. package/dist/src/map/messages/commands/add-layer.command.d.ts +10 -10
  290. package/dist/src/map/messages/commands/add-tile.command.d.ts +9 -9
  291. package/dist/src/map/messages/commands/cancel-drawing.command.d.ts +5 -5
  292. package/dist/src/map/messages/commands/cancel-feature-modification.command.d.ts +5 -5
  293. package/dist/src/map/messages/commands/close-tooltip.command.d.ts +7 -7
  294. package/dist/src/map/messages/commands/draw-selection-area.command.d.ts +13 -13
  295. package/dist/src/map/messages/commands/fit-to-features.command.d.ts +10 -10
  296. package/dist/src/map/messages/commands/fit-to-polygons.command.d.ts +9 -9
  297. package/dist/src/map/messages/commands/modify-feature.command.d.ts +11 -11
  298. package/dist/src/map/messages/commands/place-layer-features.command.d.ts +10 -10
  299. package/dist/src/map/messages/commands/remove-control.command.d.ts +8 -8
  300. package/dist/src/map/messages/commands/remove-layer.command.d.ts +8 -8
  301. package/dist/src/map/messages/commands/remove-tile.command.d.ts +9 -9
  302. package/dist/src/map/messages/commands/set-map-center.command.d.ts +18 -18
  303. package/dist/src/map/messages/commands/start-drawing.command.d.ts +11 -11
  304. package/dist/src/map/messages/events/drawing-finished.event.d.ts +6 -6
  305. package/dist/src/map/messages/events/map-click.event.d.ts +20 -20
  306. package/dist/src/map/messages/events/map-move-end.event.d.ts +8 -8
  307. package/dist/src/map/messages/events/map-rendered.event.d.ts +8 -8
  308. package/dist/src/map/messages/executors/calculate-area.executor.d.ts +10 -10
  309. package/dist/src/map/messages/executors/filter-features-in-area.executor.d.ts +10 -10
  310. package/dist/src/map/messages/executors/generate-draw.executor.d.ts +14 -14
  311. package/dist/src/map/messages/executors/generate-zoom-control.executor.d.ts +9 -9
  312. package/dist/src/map/messages/index.d.ts +14 -14
  313. package/dist/src/map/messages/queries/get-features-in-area.query.d.ts +11 -11
  314. package/dist/src/map/messages/queries/get-layer.query.d.ts +10 -10
  315. package/dist/src/map/models/drawing-type.enum.d.ts +6 -6
  316. package/dist/src/map/models/feature-format.enum.d.ts +4 -4
  317. package/dist/src/map/models/i-identified.d.ts +3 -3
  318. package/dist/src/map/models/index.d.ts +7 -7
  319. package/dist/src/map/models/map-control.d.ts +13 -13
  320. package/dist/src/map/models/map-lyrs.enum.d.ts +10 -10
  321. package/dist/src/map/models/map-settings.d.ts +17 -17
  322. package/dist/src/map/models/map.constants.d.ts +4 -4
  323. package/dist/src/map/models/marker-model.d.ts +16 -16
  324. package/dist/src/map/models/polygon.model.d.ts +19 -19
  325. package/dist/src/map/public-api.d.ts +12 -12
  326. package/dist/src/map/services/controls/controls.service.d.ts +14 -14
  327. package/dist/src/map/services/drawing/drawing-generation.service.d.ts +6 -6
  328. package/dist/src/map/services/drawing/drawing.service.d.ts +19 -19
  329. package/dist/src/map/services/drawing/feature-modification.service.d.ts +22 -22
  330. package/dist/src/map/services/feature.service.d.ts +9 -9
  331. package/dist/src/map/services/map-click.service.d.ts +16 -16
  332. package/dist/src/map/services/map-feature.service.d.ts +16 -16
  333. package/dist/src/map/services/map-management.service.d.ts +20 -20
  334. package/dist/src/map/services/map-postboy.service.d.ts +7 -7
  335. package/dist/src/map/services/map-state.service.d.ts +13 -13
  336. package/dist/src/map/services/message-registrator.service.d.ts +17 -17
  337. package/package.json +23 -24
  338. package/dist/package.json +0 -35
@@ -29,2506 +29,2506 @@ import Style from 'ol/style/Style';
29
29
  import { Icon, Circle, Fill, Stroke, Text } from 'ol/style';
30
30
  import { METERS_PER_UNIT } from 'ol/proj/epsg4326';
31
31
 
32
- class DestructibleComponent {
33
- subs = [];
34
- onDestroy;
35
- ngOnDestroy() {
36
- this.subs.forEach((s) => s.unsubscribe());
37
- if (this.onDestroy)
38
- this.onDestroy();
39
- }
40
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DestructibleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
41
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DestructibleComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
42
- }
43
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DestructibleComponent, decorators: [{
44
- type: Component,
45
- args: [{ template: '' }]
32
+ class DestructibleComponent {
33
+ subs = [];
34
+ onDestroy;
35
+ ngOnDestroy() {
36
+ this.subs.forEach((s) => s.unsubscribe());
37
+ if (this.onDestroy)
38
+ this.onDestroy();
39
+ }
40
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DestructibleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
41
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: DestructibleComponent, selector: "ng-component", ngImport: i0, template: '', isInline: true });
42
+ }
43
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DestructibleComponent, decorators: [{
44
+ type: Component,
45
+ args: [{ template: '' }]
46
46
  }] });
47
47
 
48
- var MapLyrs;
49
- (function (MapLyrs) {
50
- MapLyrs[MapLyrs["Hybrid"] = 1] = "Hybrid";
51
- MapLyrs[MapLyrs["Satellite"] = 2] = "Satellite";
52
- MapLyrs[MapLyrs["Streets"] = 3] = "Streets";
53
- MapLyrs[MapLyrs["Terrain"] = 4] = "Terrain";
54
- })(MapLyrs || (MapLyrs = {}));
55
- class MapLyrsLabel {
56
- static lyrs = {
57
- [MapLyrs.Hybrid]: 's,h',
58
- [MapLyrs.Satellite]: 's',
59
- [MapLyrs.Streets]: 'm',
60
- [MapLyrs.Terrain]: 'p',
61
- };
62
- static get(lyrs) {
63
- return MapLyrsLabel.lyrs[lyrs];
64
- }
65
- }
66
-
67
- class MapSettings {
68
- center = [0, 0];
69
- maxZoom = 19;
70
- minZoom = 0;
71
- zoom = 4;
72
- lyrs = MapLyrs.Hybrid;
73
- language = 'en';
74
- static copy(model) {
75
- const result = new MapSettings();
76
- result.center = model.center;
77
- result.maxZoom = model.maxZoom;
78
- result.minZoom = model.minZoom;
79
- result.zoom = model.zoom;
80
- result.lyrs = model.lyrs;
81
- result.language = model.language;
82
- return result;
83
- }
84
- setCenter(center) {
85
- return MapSettings.copy({ ...this, center });
86
- }
87
- setMaxZoom(maxZoom) {
88
- return MapSettings.copy({ ...this, maxZoom });
89
- }
90
- setMinZoom(minZoom) {
91
- return MapSettings.copy({ ...this, minZoom });
92
- }
93
- setZoom(zoom) {
94
- return MapSettings.copy({ ...this, zoom });
95
- }
96
- setLyrs(lyrs) {
97
- return MapSettings.copy({ ...this, lyrs });
98
- }
99
- setLanguage(language) {
100
- return MapSettings.copy({ ...this, language });
101
- }
102
- isSame(model) {
103
- if (this.maxZoom !== model.maxZoom)
104
- return false;
105
- if (this.minZoom !== model.minZoom)
106
- return false;
107
- if (this.zoom !== model.zoom)
108
- return false;
109
- if (this.lyrs !== model.lyrs)
110
- return false;
111
- if (this.language !== model.language)
112
- return false;
113
- return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
114
- }
115
- }
116
-
117
- class IdGenerator {
118
- static collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
119
- static get() {
120
- let result = [];
121
- for (let i = 0; i < 7; i++) {
122
- result.push(IdGenerator.collection
123
- .sort(() => 0.5 - Math.random())
124
- .slice(0, 5)
125
- .join(''));
126
- }
127
- return result.join('-');
128
- }
129
- }
130
-
131
- class MapConstants {
132
- static FeatureInfo = 'f-info';
133
- static DrawingLayerId = '93a981756ec7';
134
- }
135
-
136
- class MarkerModel {
137
- lat;
138
- lng;
139
- info;
140
- id;
141
- constructor(lat, lng, id, info) {
142
- this.lat = lat;
143
- this.lng = lng;
144
- this.info = info;
145
- this.id = id == null ? IdGenerator.get() : id;
146
- this._feature = this.getFeature();
147
- }
148
- _feature;
149
- get feature() {
150
- return this._feature;
151
- }
152
- getFeature() {
153
- const feature = new Feature(new Point([this.lng, this.lat]));
154
- feature.setId(this.id);
155
- if (this.info)
156
- feature.set(MapConstants.FeatureInfo, this.info);
157
- return feature;
158
- }
159
- }
160
-
161
- class PolygonModel {
162
- info;
163
- id;
164
- lat;
165
- lng;
166
- constructor(feature, id, info) {
167
- this.info = info;
168
- this.id = id == null ? IdGenerator.get() : id;
169
- this._feature = feature;
170
- if (this.info)
171
- this._feature?.set(MapConstants.FeatureInfo, this.info);
172
- [this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
173
- }
174
- _feature;
175
- get feature() {
176
- return this._feature;
177
- }
178
- static fromGeoJson(id, json, info) {
179
- let feature = new GeoJSON().readFeature(json);
180
- feature.setId(id);
181
- return new PolygonModel(feature, id, info);
182
- }
183
- static fromWKT(id, wkt, info) {
184
- let feature = new WKT().readFeature(wkt);
185
- feature.setId(id);
186
- return new PolygonModel(feature, id, info);
187
- }
188
- }
189
-
190
- var DrawingType;
191
- (function (DrawingType) {
192
- DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
193
- DrawingType[DrawingType["Circle"] = 2] = "Circle";
194
- DrawingType[DrawingType["Square"] = 3] = "Square";
195
- DrawingType[DrawingType["Box"] = 4] = "Box";
48
+ var MapLyrs;
49
+ (function (MapLyrs) {
50
+ MapLyrs[MapLyrs["Hybrid"] = 1] = "Hybrid";
51
+ MapLyrs[MapLyrs["Satellite"] = 2] = "Satellite";
52
+ MapLyrs[MapLyrs["Streets"] = 3] = "Streets";
53
+ MapLyrs[MapLyrs["Terrain"] = 4] = "Terrain";
54
+ })(MapLyrs || (MapLyrs = {}));
55
+ class MapLyrsLabel {
56
+ static lyrs = {
57
+ [MapLyrs.Hybrid]: 's,h',
58
+ [MapLyrs.Satellite]: 's',
59
+ [MapLyrs.Streets]: 'm',
60
+ [MapLyrs.Terrain]: 'p',
61
+ };
62
+ static get(lyrs) {
63
+ return MapLyrsLabel.lyrs[lyrs];
64
+ }
65
+ }
66
+
67
+ class MapSettings {
68
+ center = [0, 0];
69
+ maxZoom = 19;
70
+ minZoom = 0;
71
+ zoom = 4;
72
+ lyrs = MapLyrs.Hybrid;
73
+ language = 'en';
74
+ static copy(model) {
75
+ const result = new MapSettings();
76
+ result.center = model.center;
77
+ result.maxZoom = model.maxZoom;
78
+ result.minZoom = model.minZoom;
79
+ result.zoom = model.zoom;
80
+ result.lyrs = model.lyrs;
81
+ result.language = model.language;
82
+ return result;
83
+ }
84
+ setCenter(center) {
85
+ return MapSettings.copy({ ...this, center });
86
+ }
87
+ setMaxZoom(maxZoom) {
88
+ return MapSettings.copy({ ...this, maxZoom });
89
+ }
90
+ setMinZoom(minZoom) {
91
+ return MapSettings.copy({ ...this, minZoom });
92
+ }
93
+ setZoom(zoom) {
94
+ return MapSettings.copy({ ...this, zoom });
95
+ }
96
+ setLyrs(lyrs) {
97
+ return MapSettings.copy({ ...this, lyrs });
98
+ }
99
+ setLanguage(language) {
100
+ return MapSettings.copy({ ...this, language });
101
+ }
102
+ isSame(model) {
103
+ if (this.maxZoom !== model.maxZoom)
104
+ return false;
105
+ if (this.minZoom !== model.minZoom)
106
+ return false;
107
+ if (this.zoom !== model.zoom)
108
+ return false;
109
+ if (this.lyrs !== model.lyrs)
110
+ return false;
111
+ if (this.language !== model.language)
112
+ return false;
113
+ return this.center.length === model.center.length && !this.center.filter((c, i) => c !== model.center[i]).length;
114
+ }
115
+ }
116
+
117
+ class IdGenerator {
118
+ static collection = 'ABCDEFGHIJKLMNOPQRSTUVWXTZ0123456789'.split('');
119
+ static get() {
120
+ let result = [];
121
+ for (let i = 0; i < 7; i++) {
122
+ result.push(IdGenerator.collection
123
+ .sort(() => 0.5 - Math.random())
124
+ .slice(0, 5)
125
+ .join(''));
126
+ }
127
+ return result.join('-');
128
+ }
129
+ }
130
+
131
+ class MapConstants {
132
+ static FeatureInfo = 'f-info';
133
+ static DrawingLayerId = '93a981756ec7';
134
+ }
135
+
136
+ class MarkerModel {
137
+ lat;
138
+ lng;
139
+ info;
140
+ id;
141
+ constructor(lat, lng, id, info) {
142
+ this.lat = lat;
143
+ this.lng = lng;
144
+ this.info = info;
145
+ this.id = id == null ? IdGenerator.get() : id;
146
+ this._feature = this.getFeature();
147
+ }
148
+ _feature;
149
+ get feature() {
150
+ return this._feature;
151
+ }
152
+ getFeature() {
153
+ const feature = new Feature(new Point([this.lng, this.lat]));
154
+ feature.setId(this.id);
155
+ if (this.info)
156
+ feature.set(MapConstants.FeatureInfo, this.info);
157
+ return feature;
158
+ }
159
+ }
160
+
161
+ class PolygonModel {
162
+ info;
163
+ id;
164
+ lat;
165
+ lng;
166
+ constructor(feature, id, info) {
167
+ this.info = info;
168
+ this.id = id == null ? IdGenerator.get() : id;
169
+ this._feature = feature;
170
+ if (this.info)
171
+ this._feature?.set(MapConstants.FeatureInfo, this.info);
172
+ [this.lng, this.lat] = getCenter(this._feature.getGeometry()?.getExtent());
173
+ }
174
+ _feature;
175
+ get feature() {
176
+ return this._feature;
177
+ }
178
+ static fromGeoJson(id, json, info) {
179
+ let feature = new GeoJSON().readFeature(json);
180
+ feature.setId(id);
181
+ return new PolygonModel(feature, id, info);
182
+ }
183
+ static fromWKT(id, wkt, info) {
184
+ let feature = new WKT().readFeature(wkt);
185
+ feature.setId(id);
186
+ return new PolygonModel(feature, id, info);
187
+ }
188
+ }
189
+
190
+ var DrawingType;
191
+ (function (DrawingType) {
192
+ DrawingType[DrawingType["Polygon"] = 1] = "Polygon";
193
+ DrawingType[DrawingType["Circle"] = 2] = "Circle";
194
+ DrawingType[DrawingType["Square"] = 3] = "Square";
195
+ DrawingType[DrawingType["Box"] = 4] = "Box";
196
196
  })(DrawingType || (DrawingType = {}));
197
197
 
198
- var FeatureOutputFormat;
199
- (function (FeatureOutputFormat) {
200
- FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
201
- FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
198
+ var FeatureOutputFormat;
199
+ (function (FeatureOutputFormat) {
200
+ FeatureOutputFormat[FeatureOutputFormat["GeoJson"] = 1] = "GeoJson";
201
+ FeatureOutputFormat[FeatureOutputFormat["WKT"] = 2] = "WKT";
202
202
  })(FeatureOutputFormat || (FeatureOutputFormat = {}));
203
203
 
204
- /**
205
- *
206
- * A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default, these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
207
- * This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
208
- * var myControl = new Control({element: myElement}); and then adding this to the map.
209
- * The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
210
- * You can also extend this base for your own control class. See examples/custom-controls for an example of how to do this.
211
- */
212
- class MapControl extends Control {
213
- constructor(options) {
214
- super(options);
215
- }
216
- }
217
-
218
- class MapRenderedEvent extends PostboyGenericMessage {
219
- map;
220
- static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
221
- constructor(map) {
222
- super();
223
- this.map = map;
224
- }
225
- get id() {
226
- return MapRenderedEvent.ID;
227
- }
228
- }
229
-
230
- class MapClickEvent extends PostboyGenericMessage {
231
- coordinates;
232
- entities;
233
- features;
234
- static ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
235
- constructor(coordinates, entities, features) {
236
- super();
237
- this.coordinates = coordinates;
238
- this.entities = entities;
239
- this.features = features;
240
- }
241
- get id() {
242
- return MapClickEvent.ID;
243
- }
244
- }
245
-
246
- class MapMoveEndEvent extends PostboyGenericMessage {
247
- zoom;
248
- extent;
249
- static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
250
- constructor(zoom, extent) {
251
- super();
252
- this.zoom = zoom;
253
- this.extent = extent;
254
- }
255
- get id() {
256
- return MapMoveEndEvent.ID;
257
- }
258
- }
259
-
260
- class CloseTooltipCommand extends PostboyGenericMessage {
261
- tooltipId;
262
- static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
263
- constructor(tooltipId) {
264
- super();
265
- this.tooltipId = tooltipId;
266
- }
267
- get id() {
268
- return CloseTooltipCommand.ID;
269
- }
270
- }
271
-
272
- class StartDrawingCommand extends PostboyCallbackMessage {
273
- type;
274
- style;
275
- format;
276
- static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
277
- constructor(type, style, format = FeatureOutputFormat.GeoJson) {
278
- super();
279
- this.type = type;
280
- this.style = style;
281
- this.format = format;
282
- }
283
- get id() {
284
- return StartDrawingCommand.ID;
285
- }
286
- }
287
-
288
- class CancelDrawingCommand extends PostboyGenericMessage {
289
- static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
290
- get id() {
291
- return CancelDrawingCommand.ID;
292
- }
293
- }
294
-
295
- class DrawSelectionAreaCommand extends PostboyCallbackMessage {
296
- type;
297
- style;
298
- ignore;
299
- static ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
300
- constructor(type, style, ignore = new Set()) {
301
- super();
302
- this.type = type;
303
- this.style = style;
304
- this.ignore = ignore;
305
- }
306
- get id() {
307
- return DrawSelectionAreaCommand.ID;
308
- }
309
- }
310
-
311
- class ModifyFeatureCommand extends PostboyCallbackMessage {
312
- model;
313
- style;
314
- format;
315
- static ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
316
- constructor(model, style, format = FeatureOutputFormat.GeoJson) {
317
- super();
318
- this.model = model;
319
- this.style = style;
320
- this.format = format;
321
- }
322
- get id() {
323
- return ModifyFeatureCommand.ID;
324
- }
325
- }
326
-
327
- class CancelFeatureModificationCommand extends PostboyGenericMessage {
328
- static ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
329
- get id() {
330
- return CancelFeatureModificationCommand.ID;
331
- }
332
- }
333
-
334
- class AddControlCommand extends PostboyGenericMessage {
335
- item;
336
- static ID = '8e1c06eb-b395-4fe1-929c-ebf0805eeb49';
337
- constructor(item) {
338
- super();
339
- this.item = item;
340
- }
341
- get id() {
342
- return AddControlCommand.ID;
343
- }
344
- }
345
-
346
- class RemoveControlCommand extends PostboyGenericMessage {
347
- item;
348
- static ID = '361641e0-804a-4930-8c27-0cea6330dbfc';
349
- constructor(item) {
350
- super();
351
- this.item = item;
352
- }
353
- get id() {
354
- return RemoveControlCommand.ID;
355
- }
356
- }
357
-
358
- /**
359
- * Forces map to move to a specific point
360
- */
361
- class SetMapCenterCommand extends PostboyGenericMessage {
362
- lat;
363
- lng;
364
- zoom;
365
- static ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
366
- /**
367
- *
368
- * @param lat - the desired latitude
369
- * @param lng - the desired longitude
370
- * @param zoom - the desired zoom; doesn't change zoom if undefined
371
- */
372
- constructor(lat, lng, zoom) {
373
- super();
374
- this.lat = lat;
375
- this.lng = lng;
376
- this.zoom = zoom;
377
- }
378
- get id() {
379
- return SetMapCenterCommand.ID;
380
- }
381
- }
382
-
383
- class CalculateAreaExecutor extends PostboyExecutor {
384
- polygon;
385
- static ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
386
- constructor(polygon) {
387
- super();
388
- this.polygon = polygon;
389
- }
390
- get id() {
391
- return CalculateAreaExecutor.ID;
392
- }
393
- }
394
-
395
- class FitToPolygonsCommand extends PostboyGenericMessage {
396
- features;
397
- zoomAfter;
398
- static ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
399
- constructor(features, zoomAfter = 0) {
400
- super();
401
- this.features = features;
402
- this.zoomAfter = zoomAfter;
403
- }
404
- get id() {
405
- return FitToPolygonsCommand.ID;
406
- }
407
- }
408
-
409
- class AddLayerCommand extends PostboyGenericMessage {
410
- layer;
411
- static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
412
- constructor(layer) {
413
- super();
414
- this.layer = layer;
415
- }
416
- get id() {
417
- return AddLayerCommand.ID;
418
- }
419
- }
420
-
421
- class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
422
- layer;
423
- features;
424
- static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
425
- constructor(layer, features) {
426
- super();
427
- this.layer = layer;
428
- this.features = features;
429
- }
430
- get id() {
431
- return PlaceLayerFeaturesCommand.ID;
432
- }
433
- }
434
-
435
- class RemoveLayerCommand extends PostboyGenericMessage {
436
- layer;
437
- static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
438
- constructor(layer) {
439
- super();
440
- this.layer = layer;
441
- }
442
- get id() {
443
- return RemoveLayerCommand.ID;
444
- }
445
- }
446
-
447
- class AddTileCommand extends PostboyGenericMessage {
448
- layer;
449
- static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
450
- constructor(layer) {
451
- super();
452
- this.layer = layer;
453
- }
454
- get id() {
455
- return AddTileCommand.ID;
456
- }
457
- }
458
-
459
- class RemoveTileCommand extends PostboyGenericMessage {
460
- layer;
461
- static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
462
- constructor(layer) {
463
- super();
464
- this.layer = layer;
465
- }
466
- get id() {
467
- return RemoveTileCommand.ID;
468
- }
469
- }
470
-
471
- class FitToFeaturesCommand extends PostboyGenericMessage {
472
- features;
473
- zoomAfter;
474
- static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
475
- constructor(features, zoomAfter = 0) {
476
- super();
477
- this.features = features;
478
- this.zoomAfter = zoomAfter;
479
- }
480
- get id() {
481
- return FitToFeaturesCommand.ID;
482
- }
483
- }
484
-
485
- class GetLayerQuery extends PostboyCallbackMessage {
486
- name;
487
- static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
488
- constructor(name) {
489
- super();
490
- this.name = name;
491
- }
492
- get id() {
493
- return GetLayerQuery.ID;
494
- }
495
- }
496
-
497
- class DrawingFinishedEvent extends PostboyGenericMessage {
498
- static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
499
- constructor() {
500
- super();
501
- }
502
- get id() {
503
- return DrawingFinishedEvent.ID;
504
- }
505
- }
506
-
507
- class DrawingGenerationService {
508
- static getDraw(ev) {
509
- return new Draw({
510
- source: ev.layer.getSource(),
511
- type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
512
- style: ev.style,
513
- geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
514
- });
515
- }
516
- static geometryFunc(type) {
517
- switch (type) {
518
- case DrawingType.Circle:
519
- return createRegularPolygon(32);
520
- case DrawingType.Box:
521
- return createBox();
522
- case DrawingType.Square:
523
- return createRegularPolygon(4);
524
- }
525
- return undefined;
526
- }
527
- }
528
-
529
- class FeatureService {
530
- constructor() { }
531
- static filterFeaturesInArea(query) {
532
- return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
533
- }
534
- static calculateArea(g) {
535
- if (!g)
536
- return 0;
537
- return Sphere.getArea(g, { projection: 'EPSG:4326' });
538
- }
539
- static booleanIntersects(g1, g2) {
540
- if (g2.getType() === 'Point')
541
- return g1.intersectsCoordinate(g2.getCoordinates());
542
- if (g2.getType() === 'Circle')
543
- return g1.intersectsCoordinate(g2.getCenter());
544
- if (g2.getType() === 'Polygon')
545
- return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
546
- return false;
547
- }
548
- }
549
-
550
- class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
551
- area;
552
- ignore;
553
- static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
554
- constructor(area, ignore = new Set()) {
555
- super();
556
- this.area = area;
557
- this.ignore = ignore;
558
- }
559
- get id() {
560
- return GetFeaturesInAreaQuery.ID;
561
- }
562
- }
563
-
564
- class FilterFeaturesInAreaExecutor extends PostboyExecutor {
565
- area;
566
- features;
567
- static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
568
- constructor(area, features) {
569
- super();
570
- this.area = area;
571
- this.features = features;
572
- }
573
- get id() {
574
- return FilterFeaturesInAreaExecutor.ID;
575
- }
576
- }
577
-
578
- class GenerateDrawExecutor extends PostboyExecutor {
579
- layer;
580
- style;
581
- type;
582
- static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
583
- constructor(layer, style, type) {
584
- super();
585
- this.layer = layer;
586
- this.style = style;
587
- this.type = type;
588
- }
589
- get id() {
590
- return GenerateDrawExecutor.ID;
591
- }
592
- }
593
-
594
- class GenerateZoomControlExecutor extends PostboyExecutor {
595
- settings;
596
- static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
597
- constructor(settings) {
598
- super();
599
- this.settings = settings;
600
- }
601
- get id() {
602
- return GenerateZoomControlExecutor.ID;
603
- }
604
- }
605
-
606
- class ZoomControlFactory {
607
- static build(settings) {
608
- return new Zoom({
609
- zoomInTipLabel: settings.zoomInLabel,
610
- zoomOutTipLabel: settings.zoomOutLabel,
611
- zoomInClassName: settings.zoomInClass,
612
- zoomOutClassName: settings.zoomOutClass,
613
- className: settings.controlClass,
614
- });
615
- }
616
- }
617
-
618
- class MapPostboyService extends PostboyService {
619
- constructor() {
620
- super();
621
- this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
622
- }
623
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
624
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService });
625
- }
626
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPostboyService, decorators: [{
627
- type: Injectable
628
- }], ctorParameters: function () { return []; } });
629
-
630
- class MapManagementService {
631
- postboy;
632
- map;
633
- layers = new Dictionary();
634
- constructor(postboy) {
635
- this.postboy = postboy;
636
- }
637
- up() {
638
- this.observeMapRender();
639
- this.observeAddLayer();
640
- this.observeRemoveLayer();
641
- this.observePlaceFeatures();
642
- this.observeAddTile();
643
- this.observeRemoveTile();
644
- this.observeLayerQuery();
645
- this.observeFeaturesInArea();
646
- }
647
- observeRemoveTile() {
648
- this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
649
- if (!this.map)
650
- return;
651
- this.map.removeLayer(c.layer);
652
- });
653
- }
654
- observeLayerQuery() {
655
- this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
656
- }
657
- observeAddTile() {
658
- this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
659
- if (!this.map)
660
- return;
661
- this.map.addLayer(c.layer);
662
- });
663
- }
664
- observeMapRender() {
665
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
666
- this.map = m.map;
667
- });
668
- }
669
- observeAddLayer() {
670
- this.postboy.subscribe(AddLayerCommand.ID).subscribe((c) => {
671
- if (!this.map)
672
- return;
673
- this.layers.put(c.layer.get('name'), c.layer);
674
- this.map.addLayer(c.layer);
675
- });
676
- }
677
- observePlaceFeatures() {
678
- this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
679
- if (!this.layers.has(c.layer))
680
- return;
681
- let source = this.layers.take(c.layer).getSource();
682
- if (!!source['getSource'])
683
- source = source?.getSource();
684
- source?.clear();
685
- !!c.features?.length && source?.addFeatures(c.features);
686
- });
687
- }
688
- observeRemoveLayer() {
689
- this.postboy.subscribe(RemoveLayerCommand.ID).subscribe((c) => {
690
- if (!this.map)
691
- return;
692
- this.layers.rmv(c.layer.get('name'));
693
- this.map.removeLayer(c.layer);
694
- });
695
- }
696
- observeFeaturesInArea() {
697
- this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
698
- let result = new Dictionary();
699
- this.layers.forEach((l) => {
700
- let layerName = l.get('name');
701
- if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
702
- return;
703
- let source = l.getSource();
704
- if (!!source['getSource'])
705
- source = source?.getSource();
706
- let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
707
- result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
708
- });
709
- qr.finish(result);
710
- });
711
- }
712
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
713
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapManagementService });
714
- }
715
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapManagementService, decorators: [{
716
- type: Injectable
717
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
718
-
719
- class MapStateService {
720
- postboy;
721
- map;
722
- constructor(postboy) {
723
- this.postboy = postboy;
724
- }
725
- up() {
726
- this.observeMapRendering();
727
- this.observeCenter();
728
- }
729
- observeMapRendering() {
730
- this.postboy
731
- .subscribe(MapRenderedEvent.ID)
732
- .pipe(first())
733
- .subscribe((ev) => {
734
- this.map = ev.map;
735
- this.map?.on('moveend', () => {
736
- const zoom = Math.floor(this.map?.getView().getZoom() || -1);
737
- const extent = this.map?.getView().calculateExtent() || [];
738
- this.postboy.fire(new MapMoveEndEvent(zoom, extent));
739
- });
740
- });
741
- }
742
- observeCenter() {
743
- this.postboy.subscribe(SetMapCenterCommand.ID).subscribe((c) => {
744
- this.map?.getView().setCenter([c.lng, c.lat]);
745
- if (c.zoom)
746
- this.map?.getView().setZoom(c.zoom);
747
- });
748
- }
749
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
750
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService });
751
- }
752
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapStateService, decorators: [{
753
- type: Injectable
754
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
755
-
756
- class MapFeatureService {
757
- postboy;
758
- map;
759
- fitPolygonsWaiting;
760
- constructor(postboy) {
761
- this.postboy = postboy;
762
- }
763
- up() {
764
- this.observeMapRender();
765
- this.observeFitToFeatures();
766
- this.observeFitToPolygons();
767
- }
768
- observeMapRender() {
769
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
770
- this.map = m.map;
771
- if (this.fitPolygonsWaiting)
772
- this.postboy.fire(this.fitPolygonsWaiting);
773
- });
774
- }
775
- observeFitToFeatures() {
776
- this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
777
- this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
778
- });
779
- }
780
- observeFitToPolygons() {
781
- this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
782
- if (!this.map) {
783
- this.fitPolygonsWaiting = cmd;
784
- return;
785
- }
786
- this.fitPolygonsWaiting = undefined;
787
- this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
788
- });
789
- }
790
- fitToGeometries(geometries, zoomAfter) {
791
- if (!geometries?.length || !this.map)
792
- return;
793
- const extent = createEmpty();
794
- geometries.forEach((g) => extend(extent, g.getExtent()));
795
- this.map.getView().fit(extent);
796
- this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
797
- }
798
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapFeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
799
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapFeatureService });
800
- }
801
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapFeatureService, decorators: [{
802
- type: Injectable
803
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
804
-
805
- class MapClickService {
806
- postboy;
807
- map;
808
- constructor(postboy) {
809
- this.postboy = postboy;
810
- }
811
- up() {
812
- this.observeMapRender();
813
- }
814
- onClick(ev) {
815
- const model = new MapClickEvent(ev.coordinate, {}, {});
816
- this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
817
- this.getFeatureCollectionWithInner([f])
818
- .filter((f) => f.getId() != null)
819
- .forEach((fs) => {
820
- let layerName = l.get('name');
821
- if (!model.entities[layerName])
822
- model.entities[layerName] = [];
823
- if (!model.features[layerName])
824
- model.features[layerName] = [];
825
- model.entities[layerName].push({ id: fs.getId(), ...fs.get(MapConstants.FeatureInfo) });
826
- model.features[layerName].push(fs);
827
- });
828
- });
829
- return model;
830
- }
831
- observeMapRender() {
832
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
833
- this.map = m.map;
834
- this.map?.on('singleclick', (e) => {
835
- this.postboy.fire(this.onClick(e));
836
- });
837
- });
838
- }
839
- getFeatureCollectionWithInner(features) {
840
- const result = [];
841
- features?.forEach((f) => {
842
- const innerFeatures = f.get('features');
843
- innerFeatures?.length ? result.push(...innerFeatures) : result.push(f);
844
- });
845
- return result;
846
- }
847
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapClickService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
848
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapClickService });
849
- }
850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapClickService, decorators: [{
851
- type: Injectable
852
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
853
-
854
- class DrawingService {
855
- postboy;
856
- drawInteraction;
857
- map;
858
- constructor(postboy) {
859
- this.postboy = postboy;
860
- }
861
- up() {
862
- this.observeDrawing();
863
- this.observeSelectArea();
864
- this.observeMapRender();
865
- }
866
- observeSelectArea() {
867
- this.postboy.subscribe(DrawSelectionAreaCommand.ID).subscribe((ev) => {
868
- const drawingCommand = new StartDrawingCommand(ev.type, ev.style);
869
- drawingCommand.result.subscribe((r) => {
870
- if (!r) {
871
- ev.finish(new Dictionary());
872
- return;
873
- }
874
- const area = PolygonModel.fromGeoJson(1, r).feature.getGeometry();
875
- const getFeaturesCommand = new GetFeaturesInAreaQuery(area, ev.ignore);
876
- getFeaturesCommand.result.subscribe((result) => ev.finish(result));
877
- this.postboy.fire(getFeaturesCommand);
878
- });
879
- this.postboy.fire(drawingCommand);
880
- });
881
- }
882
- observeDrawing() {
883
- this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
884
- this.draw((l) => {
885
- if (!l || !this.map) {
886
- this.clearInteraction(l);
887
- return;
888
- }
889
- const cancelSub = this.observeCancelation(ev, l);
890
- this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
891
- this.map?.addInteraction(this.drawInteraction);
892
- this.drawInteraction.on('drawend', (evt) => {
893
- cancelSub.unsubscribe();
894
- this.onEnd(evt, ev, l);
895
- });
896
- });
897
- });
898
- }
899
- onEnd(evt, command, layer) {
900
- command.finish(command.format === FeatureOutputFormat.GeoJson
901
- ? new GeoJSON().writeFeature(evt.feature)
902
- : new WKT().writeFeature(evt.feature));
903
- this.clearInteraction(layer);
904
- }
905
- observeMapRender() {
906
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
907
- this.map = m.map;
908
- });
909
- }
910
- draw(action) {
911
- const query = new GetLayerQuery(MapConstants.DrawingLayerId);
912
- query.result.subscribe((l) => action(l));
913
- this.postboy.fire(query);
914
- }
915
- observeCancelation(ev, layer) {
916
- return this.postboy
917
- .subscribe(CancelDrawingCommand.ID)
918
- .pipe(first())
919
- .subscribe(() => {
920
- ev.finish(null);
921
- this.clearInteraction(layer);
922
- });
923
- }
924
- clearInteraction(layer) {
925
- if (!!this.drawInteraction) {
926
- this.map?.removeInteraction(this.drawInteraction);
927
- layer?.setSource(new Vector({}));
928
- }
929
- setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
930
- }
931
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
932
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService });
933
- }
934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DrawingService, decorators: [{
935
- type: Injectable
936
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
937
-
938
- class FeatureModificationService {
939
- postboy;
940
- modify;
941
- translate;
942
- map;
943
- constructor(postboy) {
944
- this.postboy = postboy;
945
- }
946
- up() {
947
- this.observeModification();
948
- this.observeMapRender();
949
- }
950
- observeModification() {
951
- this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
952
- this.defineLayer((l) => {
953
- if (!l || !this.map) {
954
- this.clearInteraction(l);
955
- return;
956
- }
957
- this.observeCancelation(ev, l);
958
- this.initFeature(l, ev.model.feature);
959
- this.addModify(ev);
960
- this.addDragging(ev);
961
- });
962
- });
963
- }
964
- initFeature(layer, feature) {
965
- layer.getSource()?.clear();
966
- layer.getSource()?.addFeature(feature);
967
- }
968
- addModify(command) {
969
- this.modify = new Modify({
970
- features: new Collection([command.model.feature]),
971
- style: command.style,
972
- });
973
- this.modify.on('modifyend', () => {
974
- this.onModified(command);
975
- command.model.feature.changed();
976
- });
977
- this.map?.addInteraction(this.modify);
978
- }
979
- addDragging(command) {
980
- this.translate = new Translate({
981
- features: new Collection([command.model.feature]),
982
- condition: (ev) => {
983
- const clone = command.model.feature.clone();
984
- clone.getGeometry()?.scale(0.999);
985
- return clone.getGeometry().intersectsCoordinate(ev.coordinate);
986
- },
987
- });
988
- this.translate.on('translateend', () => this.onModified(command));
989
- this.map?.addInteraction(this.translate);
990
- }
991
- onModified(command) {
992
- command.next(command.format === FeatureOutputFormat.GeoJson
993
- ? new GeoJSON().writeFeature(command.model.feature)
994
- : new WKT().writeFeature(command.model.feature));
995
- }
996
- observeMapRender() {
997
- this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
998
- this.map = m.map;
999
- });
1000
- }
1001
- defineLayer(action) {
1002
- const query = new GetLayerQuery(MapConstants.DrawingLayerId);
1003
- query.result.subscribe((l) => action(l));
1004
- this.postboy.fire(query);
1005
- }
1006
- observeCancelation(ev, layer) {
1007
- return this.postboy
1008
- .subscribe(CancelFeatureModificationCommand.ID)
1009
- .pipe(first())
1010
- .subscribe(() => {
1011
- ev.finish(null);
1012
- this.clearInteraction(layer);
1013
- });
1014
- }
1015
- clearInteraction(layer) {
1016
- if (this.modify)
1017
- this.map?.removeInteraction(this.modify);
1018
- if (this.translate)
1019
- this.map?.removeInteraction(this.translate);
1020
- }
1021
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
1022
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService });
1023
- }
1024
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureModificationService, decorators: [{
1025
- type: Injectable
1026
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
1027
-
1028
- class ControlsService {
1029
- postboy;
1030
- map;
1031
- constructor(postboy) {
1032
- this.postboy = postboy;
1033
- }
1034
- up() {
1035
- this.observeMapRender();
1036
- }
1037
- observeMapRender() {
1038
- this.postboy
1039
- .subscribe(MapRenderedEvent.ID)
1040
- .pipe(first())
1041
- .subscribe((m) => {
1042
- this.map = m.map;
1043
- this.observeAdding();
1044
- this.observeRemoving();
1045
- });
1046
- }
1047
- observeAdding() {
1048
- this.postboy.subscribe(AddControlCommand.ID).subscribe((c) => this.map?.addControl(c.item));
1049
- }
1050
- observeRemoving() {
1051
- this.postboy
1052
- .subscribe(RemoveControlCommand.ID)
1053
- .subscribe((c) => this.map?.removeControl(c.item));
1054
- }
1055
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
1056
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsService });
1057
- }
1058
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ControlsService, decorators: [{
1059
- type: Injectable
1060
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; } });
1061
-
1062
- class MessageRegistratorService extends PostboyAbstractRegistrator {
1063
- constructor(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
1064
- super(service);
1065
- this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
1066
- }
1067
- _up() {
1068
- this.registerReplay(MapRenderedEvent.ID);
1069
- this.registerReplay(PlaceLayerFeaturesCommand.ID);
1070
- this.registerReplay(RemoveControlCommand.ID);
1071
- this.registerReplay(AddControlCommand.ID);
1072
- this.registerReplay(SetMapCenterCommand.ID);
1073
- this.registerSubject(AddLayerCommand.ID);
1074
- this.registerSubject(RemoveLayerCommand.ID);
1075
- this.registerSubject(AddTileCommand.ID);
1076
- this.registerSubject(RemoveTileCommand.ID);
1077
- this.registerSubject(MapClickEvent.ID);
1078
- this.registerSubject(CloseTooltipCommand.ID);
1079
- this.registerSubject(FitToFeaturesCommand.ID);
1080
- this.registerSubject(FitToPolygonsCommand.ID);
1081
- this.registerSubject(MapMoveEndEvent.ID);
1082
- this.registerSubject(CancelDrawingCommand.ID);
1083
- this.registerSubject(StartDrawingCommand.ID);
1084
- this.registerSubject(GetLayerQuery.ID);
1085
- this.registerSubject(DrawingFinishedEvent.ID);
1086
- this.registerSubject(GetFeaturesInAreaQuery.ID);
1087
- this.registerSubject(DrawSelectionAreaCommand.ID);
1088
- this.registerSubject(CancelFeatureModificationCommand.ID);
1089
- this.registerSubject(ModifyFeatureCommand.ID);
1090
- this.setExecutors();
1091
- }
1092
- setExecutors() {
1093
- this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
1094
- this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
1095
- this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
1096
- this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
1097
- }
1098
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }, { token: ControlsService }], target: i0.ɵɵFactoryTarget.Injectable });
1099
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService });
1100
- }
1101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MessageRegistratorService, decorators: [{
1102
- type: Injectable
1103
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }]; } });
1104
-
1105
- /**
1106
- * Class representing settings for a tile layer.
1107
- */
1108
- class TileLayerSettings {
1109
- /**
1110
- * The maximum zoom level for a map view.
1111
- *
1112
- * @type {number}
1113
- * @default 19
1114
- */
1115
- maxZoom = 19;
1116
- /**
1117
- * The minimum zoom level allowed.
1118
- *
1119
- * @type {number}
1120
- */
1121
- minZoom = 0;
1122
- /**
1123
- * The opacity of an element.
1124
- *
1125
- * @type {number}
1126
- * @default 0.6
1127
- */
1128
- opacity = 0.6;
1129
- /**
1130
- * Represents the tiles URL.
1131
- * @typedef {string} url
1132
- *
1133
- * @example
1134
- * 'https://example.ex/{z}/{x}/{y}.png'
1135
- */
1136
- url = '';
1137
- /**
1138
- * The projection of the coordinate system.
1139
- *
1140
- * @type {string}
1141
- * @default 'EPSG:3857'
1142
- */
1143
- projection = 'EPSG:3857';
1144
- /**
1145
- * Creates a copy of the given tile layer settings.
1146
- *
1147
- * @param {TileLayerSettings} model - The tile layer settings to be copied.
1148
- * @return {TileLayerSettings} - A new instance of TileLayerSettings with the same properties as the model.
1149
- */
1150
- static copy(model) {
1151
- const result = new TileLayerSettings();
1152
- result.maxZoom = model.maxZoom;
1153
- result.minZoom = model.minZoom;
1154
- result.projection = model.projection;
1155
- result.opacity = model.opacity;
1156
- result.url = model.url;
1157
- return result;
1158
- }
1159
- /**
1160
- * Sets the URL of the TileLayerSettings object.
1161
- *
1162
- * @param {string} url - The URL to be set.
1163
- * @return {TileLayerSettings} - The updated TileLayerSettings object.
1164
- */
1165
- setUrl(url) {
1166
- return TileLayerSettings.copy({ ...this, url });
1167
- }
1168
- /**
1169
- * Sets the maximum zoom level for the tile layer.
1170
- *
1171
- * @param {number} maxZoom - The maximum zoom level.
1172
- * @returns {TileLayerSettings} - The updated tile layer settings object.
1173
- */
1174
- setMaxZoom(maxZoom) {
1175
- return TileLayerSettings.copy({ ...this, maxZoom });
1176
- }
1177
- /**
1178
- * Sets the minimum zoom level for the Tile Layer.
1179
- *
1180
- * @param {number} minZoom - The minimum zoom level to be set.
1181
- * @return {TileLayerSettings} The modified TileLayerSettings object with the updated minimum zoom level.
1182
- */
1183
- setMinZoom(minZoom) {
1184
- return TileLayerSettings.copy({ ...this, minZoom });
1185
- }
1186
- /**
1187
- * Sets the opacity of the TileLayerSettings.
1188
- *
1189
- * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
1190
- * @return {TileLayerSettings} - A new instance of TileLayerSettings with the opacity set.
1191
- */
1192
- setOpacity(opacity) {
1193
- return TileLayerSettings.copy({ ...this, opacity });
1194
- }
1195
- /**
1196
- * Sets the projection for the tile layer settings.
1197
- *
1198
- * @param {string} projection - The desired projection for the tile layer settings.
1199
- * @return {TileLayerSettings} - The updated tile layer settings with the new projection.
1200
- */
1201
- setProjection(projection) {
1202
- return TileLayerSettings.copy({ ...this, projection });
1203
- }
1204
- /**
1205
- * Checks if the current instance of TileLayerSettings is equal to the given model.
1206
- * @param {TileLayerSettings} model - The model to compare against.
1207
- * @return {boolean} - True if all properties of the current instance matches the properties of the model;
1208
- * otherwise, false.
1209
- */
1210
- isSame(model) {
1211
- if (this.maxZoom !== model.maxZoom)
1212
- return false;
1213
- if (this.minZoom !== model.minZoom)
1214
- return false;
1215
- if (this.url !== model.url)
1216
- return false;
1217
- if (this.projection !== model.projection)
1218
- return false;
1219
- if (this.opacity !== model.opacity)
1220
- return false;
1221
- return true;
1222
- }
1223
- }
1224
-
1225
- class TileLayerFactory {
1226
- build(settings) {
1227
- const source = new XYZ({
1228
- tileSize: 256,
1229
- maxZoom: settings.maxZoom || 14,
1230
- minZoom: settings.minZoom || 1,
1231
- projection: get(settings.projection),
1232
- tileUrlFunction: this.getTileFunc(settings),
1233
- crossOrigin: 'Anonymous',
1234
- });
1235
- return new TileLayer({ source, opacity: settings.opacity });
1236
- }
1237
- getTileFunc(settings) {
1238
- return (tileCoord) => {
1239
- const zoom = tileCoord[0];
1240
- const x = tileCoord[1];
1241
- const y = tileCoord[2];
1242
- const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
1243
- const bound = 1 << zoom;
1244
- return settings.url
1245
- .replace('{x}', String(normalizedCoord?.x || x))
1246
- .replace('{z}', String(zoom))
1247
- .replace('{y}', String(bound - (normalizedCoord?.y || y) - 1));
1248
- };
1249
- }
1250
- getNormalizedCoord(coord, zoom) {
1251
- const y = coord.y;
1252
- let x = coord.x;
1253
- const tileRange = 1 << zoom;
1254
- if (y < 0 || y >= tileRange)
1255
- return null;
1256
- if (x < 0 || x >= tileRange)
1257
- x = ((x % tileRange) + tileRange) % tileRange;
1258
- return { x: x, y: y };
1259
- }
1260
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1261
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayerFactory, providedIn: 'root' });
1262
- }
1263
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayerFactory, decorators: [{
1264
- type: Injectable,
1265
- args: [{
1266
- providedIn: 'root',
1267
- }]
204
+ /**
205
+ *
206
+ * A control is a visible widget with a DOM element in a fixed position on the screen. They can involve user input (buttons), or be informational only; the position is determined using CSS. By default, these are placed in the container with CSS class name ol-overlaycontainer-stopevent, but can use any outside DOM element.
207
+ * This is the base class for controls. You can use it for simple custom controls by creating the element with listeners, creating an instance:
208
+ * var myControl = new Control({element: myElement}); and then adding this to the map.
209
+ * The main advantage of having this as a control rather than a simple separate DOM element is that preventing propagation is handled for you. Controls will also be objects in a module:ol/Collection~Collection, so you can use their methods.
210
+ * You can also extend this base for your own control class. See examples/custom-controls for an example of how to do this.
211
+ */
212
+ class MapControl extends Control {
213
+ constructor(options) {
214
+ super(options);
215
+ }
216
+ }
217
+
218
+ class MapRenderedEvent extends PostboyGenericMessage {
219
+ map;
220
+ static ID = 'b6121807-3b89-4cd3-82cf-089d2cefdc4f';
221
+ constructor(map) {
222
+ super();
223
+ this.map = map;
224
+ }
225
+ get id() {
226
+ return MapRenderedEvent.ID;
227
+ }
228
+ }
229
+
230
+ class MapClickEvent extends PostboyGenericMessage {
231
+ coordinates;
232
+ entities;
233
+ features;
234
+ static ID = '323df526-8d9c-49c6-83e8-6e9a1e7762f7';
235
+ constructor(coordinates, entities, features) {
236
+ super();
237
+ this.coordinates = coordinates;
238
+ this.entities = entities;
239
+ this.features = features;
240
+ }
241
+ get id() {
242
+ return MapClickEvent.ID;
243
+ }
244
+ }
245
+
246
+ class MapMoveEndEvent extends PostboyGenericMessage {
247
+ zoom;
248
+ extent;
249
+ static ID = 'f21f783e-b5af-4489-9fec-8027fd07a8ad';
250
+ constructor(zoom, extent) {
251
+ super();
252
+ this.zoom = zoom;
253
+ this.extent = extent;
254
+ }
255
+ get id() {
256
+ return MapMoveEndEvent.ID;
257
+ }
258
+ }
259
+
260
+ class CloseTooltipCommand extends PostboyGenericMessage {
261
+ tooltipId;
262
+ static ID = '4896d52c-e34f-4994-bcfd-32832d12dbe4';
263
+ constructor(tooltipId) {
264
+ super();
265
+ this.tooltipId = tooltipId;
266
+ }
267
+ get id() {
268
+ return CloseTooltipCommand.ID;
269
+ }
270
+ }
271
+
272
+ class StartDrawingCommand extends PostboyCallbackMessage {
273
+ type;
274
+ style;
275
+ format;
276
+ static ID = 'da904f4b-a1c8-4db7-a6af-14d9ee18ec8c';
277
+ constructor(type, style, format = FeatureOutputFormat.GeoJson) {
278
+ super();
279
+ this.type = type;
280
+ this.style = style;
281
+ this.format = format;
282
+ }
283
+ get id() {
284
+ return StartDrawingCommand.ID;
285
+ }
286
+ }
287
+
288
+ class CancelDrawingCommand extends PostboyGenericMessage {
289
+ static ID = '7d38d983-feba-4176-a66b-18175e5ecd6b';
290
+ get id() {
291
+ return CancelDrawingCommand.ID;
292
+ }
293
+ }
294
+
295
+ class DrawSelectionAreaCommand extends PostboyCallbackMessage {
296
+ type;
297
+ style;
298
+ ignore;
299
+ static ID = '573d8a0d-f25b-42b7-9ad7-0ac6d86ac362';
300
+ constructor(type, style, ignore = new Set()) {
301
+ super();
302
+ this.type = type;
303
+ this.style = style;
304
+ this.ignore = ignore;
305
+ }
306
+ get id() {
307
+ return DrawSelectionAreaCommand.ID;
308
+ }
309
+ }
310
+
311
+ class ModifyFeatureCommand extends PostboyCallbackMessage {
312
+ model;
313
+ style;
314
+ format;
315
+ static ID = 'ead85caa-24c6-4844-a68c-2cea91774c8c';
316
+ constructor(model, style, format = FeatureOutputFormat.GeoJson) {
317
+ super();
318
+ this.model = model;
319
+ this.style = style;
320
+ this.format = format;
321
+ }
322
+ get id() {
323
+ return ModifyFeatureCommand.ID;
324
+ }
325
+ }
326
+
327
+ class CancelFeatureModificationCommand extends PostboyGenericMessage {
328
+ static ID = '9c9fb40f-ea95-4704-8177-0e9ecabf36fa';
329
+ get id() {
330
+ return CancelFeatureModificationCommand.ID;
331
+ }
332
+ }
333
+
334
+ class AddControlCommand extends PostboyGenericMessage {
335
+ item;
336
+ static ID = '8e1c06eb-b395-4fe1-929c-ebf0805eeb49';
337
+ constructor(item) {
338
+ super();
339
+ this.item = item;
340
+ }
341
+ get id() {
342
+ return AddControlCommand.ID;
343
+ }
344
+ }
345
+
346
+ class RemoveControlCommand extends PostboyGenericMessage {
347
+ item;
348
+ static ID = '361641e0-804a-4930-8c27-0cea6330dbfc';
349
+ constructor(item) {
350
+ super();
351
+ this.item = item;
352
+ }
353
+ get id() {
354
+ return RemoveControlCommand.ID;
355
+ }
356
+ }
357
+
358
+ /**
359
+ * Forces map to move to a specific point
360
+ */
361
+ class SetMapCenterCommand extends PostboyGenericMessage {
362
+ lat;
363
+ lng;
364
+ zoom;
365
+ static ID = 'd50e89c9-6707-4f8c-ab57-65fcef232182';
366
+ /**
367
+ *
368
+ * @param lat - the desired latitude
369
+ * @param lng - the desired longitude
370
+ * @param zoom - the desired zoom; doesn't change zoom if undefined
371
+ */
372
+ constructor(lat, lng, zoom) {
373
+ super();
374
+ this.lat = lat;
375
+ this.lng = lng;
376
+ this.zoom = zoom;
377
+ }
378
+ get id() {
379
+ return SetMapCenterCommand.ID;
380
+ }
381
+ }
382
+
383
+ class CalculateAreaExecutor extends PostboyExecutor {
384
+ polygon;
385
+ static ID = '172ecf46-86b5-4f46-a5f1-96ba2cbb1694';
386
+ constructor(polygon) {
387
+ super();
388
+ this.polygon = polygon;
389
+ }
390
+ get id() {
391
+ return CalculateAreaExecutor.ID;
392
+ }
393
+ }
394
+
395
+ class FitToPolygonsCommand extends PostboyGenericMessage {
396
+ features;
397
+ zoomAfter;
398
+ static ID = 'a9e42b23-ffaf-4c46-8370-e0432cd14d60';
399
+ constructor(features, zoomAfter = 0) {
400
+ super();
401
+ this.features = features;
402
+ this.zoomAfter = zoomAfter;
403
+ }
404
+ get id() {
405
+ return FitToPolygonsCommand.ID;
406
+ }
407
+ }
408
+
409
+ class AddLayerCommand extends PostboyGenericMessage {
410
+ layer;
411
+ static ID = 'd93e250f-92bc-43ac-9c6a-46c521a1aaa5';
412
+ constructor(layer) {
413
+ super();
414
+ this.layer = layer;
415
+ }
416
+ get id() {
417
+ return AddLayerCommand.ID;
418
+ }
419
+ }
420
+
421
+ class PlaceLayerFeaturesCommand extends PostboyGenericMessage {
422
+ layer;
423
+ features;
424
+ static ID = '8caf86bc-869b-426f-b36d-4642f6b8aab0';
425
+ constructor(layer, features) {
426
+ super();
427
+ this.layer = layer;
428
+ this.features = features;
429
+ }
430
+ get id() {
431
+ return PlaceLayerFeaturesCommand.ID;
432
+ }
433
+ }
434
+
435
+ class RemoveLayerCommand extends PostboyGenericMessage {
436
+ layer;
437
+ static ID = 'ab484e0e-e185-45cd-8434-12101f3c7eb1';
438
+ constructor(layer) {
439
+ super();
440
+ this.layer = layer;
441
+ }
442
+ get id() {
443
+ return RemoveLayerCommand.ID;
444
+ }
445
+ }
446
+
447
+ class AddTileCommand extends PostboyGenericMessage {
448
+ layer;
449
+ static ID = '25b7df28-72ce-4453-9fe6-54285a2fdc57';
450
+ constructor(layer) {
451
+ super();
452
+ this.layer = layer;
453
+ }
454
+ get id() {
455
+ return AddTileCommand.ID;
456
+ }
457
+ }
458
+
459
+ class RemoveTileCommand extends PostboyGenericMessage {
460
+ layer;
461
+ static ID = 'c36ccc0b-5638-4819-b148-2de57a59a5b7';
462
+ constructor(layer) {
463
+ super();
464
+ this.layer = layer;
465
+ }
466
+ get id() {
467
+ return RemoveTileCommand.ID;
468
+ }
469
+ }
470
+
471
+ class FitToFeaturesCommand extends PostboyGenericMessage {
472
+ features;
473
+ zoomAfter;
474
+ static ID = '76cdc091-3793-4b6c-82f7-1e0334cf08a8';
475
+ constructor(features, zoomAfter = 0) {
476
+ super();
477
+ this.features = features;
478
+ this.zoomAfter = zoomAfter;
479
+ }
480
+ get id() {
481
+ return FitToFeaturesCommand.ID;
482
+ }
483
+ }
484
+
485
+ class GetLayerQuery extends PostboyCallbackMessage {
486
+ name;
487
+ static ID = '5c04c87b-8a93-4c2a-979e-d1e313d860ed';
488
+ constructor(name) {
489
+ super();
490
+ this.name = name;
491
+ }
492
+ get id() {
493
+ return GetLayerQuery.ID;
494
+ }
495
+ }
496
+
497
+ class DrawingFinishedEvent extends PostboyGenericMessage {
498
+ static ID = 'c724b68e-b4eb-4783-90f1-a8e31973fd36';
499
+ constructor() {
500
+ super();
501
+ }
502
+ get id() {
503
+ return DrawingFinishedEvent.ID;
504
+ }
505
+ }
506
+
507
+ class DrawingGenerationService {
508
+ static getDraw(ev) {
509
+ return new Draw({
510
+ source: ev.layer.getSource(),
511
+ type: ev.type === DrawingType.Polygon ? 'Polygon' : 'Circle',
512
+ style: ev.style,
513
+ geometryFunction: DrawingGenerationService.geometryFunc(ev.type),
514
+ });
515
+ }
516
+ static geometryFunc(type) {
517
+ switch (type) {
518
+ case DrawingType.Circle:
519
+ return createRegularPolygon(32);
520
+ case DrawingType.Box:
521
+ return createBox();
522
+ case DrawingType.Square:
523
+ return createRegularPolygon(4);
524
+ }
525
+ return undefined;
526
+ }
527
+ }
528
+
529
+ class FeatureService {
530
+ constructor() { }
531
+ static filterFeaturesInArea(query) {
532
+ return query.features.filter((f) => FeatureService.booleanIntersects(query.area, f.getGeometry()));
533
+ }
534
+ static calculateArea(g) {
535
+ if (!g)
536
+ return 0;
537
+ return Sphere.getArea(g, { projection: 'EPSG:4326' });
538
+ }
539
+ static booleanIntersects(g1, g2) {
540
+ if (g2.getType() === 'Point')
541
+ return g1.intersectsCoordinate(g2.getCoordinates());
542
+ if (g2.getType() === 'Circle')
543
+ return g1.intersectsCoordinate(g2.getCenter());
544
+ if (g2.getType() === 'Polygon')
545
+ return g1.intersectsCoordinate(g2.getInteriorPoint().getCoordinates());
546
+ return false;
547
+ }
548
+ }
549
+
550
+ class GetFeaturesInAreaQuery extends PostboyCallbackMessage {
551
+ area;
552
+ ignore;
553
+ static ID = 'efcf4271-a07a-40e0-9f02-d4dade40b8ac';
554
+ constructor(area, ignore = new Set()) {
555
+ super();
556
+ this.area = area;
557
+ this.ignore = ignore;
558
+ }
559
+ get id() {
560
+ return GetFeaturesInAreaQuery.ID;
561
+ }
562
+ }
563
+
564
+ class FilterFeaturesInAreaExecutor extends PostboyExecutor {
565
+ area;
566
+ features;
567
+ static ID = '36bb2d94-8028-4512-90dd-2386af3fc67c';
568
+ constructor(area, features) {
569
+ super();
570
+ this.area = area;
571
+ this.features = features;
572
+ }
573
+ get id() {
574
+ return FilterFeaturesInAreaExecutor.ID;
575
+ }
576
+ }
577
+
578
+ class GenerateDrawExecutor extends PostboyExecutor {
579
+ layer;
580
+ style;
581
+ type;
582
+ static ID = 'f01c99ba-0953-4ab5-82f9-04e6fbb678c1';
583
+ constructor(layer, style, type) {
584
+ super();
585
+ this.layer = layer;
586
+ this.style = style;
587
+ this.type = type;
588
+ }
589
+ get id() {
590
+ return GenerateDrawExecutor.ID;
591
+ }
592
+ }
593
+
594
+ class GenerateZoomControlExecutor extends PostboyExecutor {
595
+ settings;
596
+ static ID = 'ff16a833-c68e-4b1a-bc23-c0d16b002810';
597
+ constructor(settings) {
598
+ super();
599
+ this.settings = settings;
600
+ }
601
+ get id() {
602
+ return GenerateZoomControlExecutor.ID;
603
+ }
604
+ }
605
+
606
+ class ZoomControlFactory {
607
+ static build(settings) {
608
+ return new Zoom({
609
+ zoomInTipLabel: settings.zoomInLabel,
610
+ zoomOutTipLabel: settings.zoomOutLabel,
611
+ zoomInClassName: settings.zoomInClass,
612
+ zoomOutClassName: settings.zoomOutClass,
613
+ className: settings.controlClass,
614
+ });
615
+ }
616
+ }
617
+
618
+ class MapPostboyService extends PostboyService {
619
+ constructor() {
620
+ super();
621
+ this.addLocker({ locker: StartDrawingCommand.ID, unlocker: DrawingFinishedEvent.ID, locking: [MapClickEvent.ID] });
622
+ }
623
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
624
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService });
625
+ }
626
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPostboyService, decorators: [{
627
+ type: Injectable
628
+ }], ctorParameters: () => [] });
629
+
630
+ class MapManagementService {
631
+ postboy;
632
+ map;
633
+ layers = new Dictionary();
634
+ constructor(postboy) {
635
+ this.postboy = postboy;
636
+ }
637
+ up() {
638
+ this.observeMapRender();
639
+ this.observeAddLayer();
640
+ this.observeRemoveLayer();
641
+ this.observePlaceFeatures();
642
+ this.observeAddTile();
643
+ this.observeRemoveTile();
644
+ this.observeLayerQuery();
645
+ this.observeFeaturesInArea();
646
+ }
647
+ observeRemoveTile() {
648
+ this.postboy.subscribe(RemoveTileCommand.ID).subscribe((c) => {
649
+ if (!this.map)
650
+ return;
651
+ this.map.removeLayer(c.layer);
652
+ });
653
+ }
654
+ observeLayerQuery() {
655
+ this.postboy.subscribe(GetLayerQuery.ID).subscribe((ev) => ev.finish(this.layers.take(ev.name)));
656
+ }
657
+ observeAddTile() {
658
+ this.postboy.subscribe(AddTileCommand.ID).subscribe((c) => {
659
+ if (!this.map)
660
+ return;
661
+ this.map.addLayer(c.layer);
662
+ });
663
+ }
664
+ observeMapRender() {
665
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
666
+ this.map = m.map;
667
+ });
668
+ }
669
+ observeAddLayer() {
670
+ this.postboy.subscribe(AddLayerCommand.ID).subscribe((c) => {
671
+ if (!this.map)
672
+ return;
673
+ this.layers.put(c.layer.get('name'), c.layer);
674
+ this.map.addLayer(c.layer);
675
+ });
676
+ }
677
+ observePlaceFeatures() {
678
+ this.postboy.subscribe(PlaceLayerFeaturesCommand.ID).subscribe((c) => {
679
+ if (!this.layers.has(c.layer))
680
+ return;
681
+ let source = this.layers.take(c.layer).getSource();
682
+ if (!!source['getSource'])
683
+ source = source?.getSource();
684
+ source?.clear();
685
+ !!c.features?.length && source?.addFeatures(c.features);
686
+ });
687
+ }
688
+ observeRemoveLayer() {
689
+ this.postboy.subscribe(RemoveLayerCommand.ID).subscribe((c) => {
690
+ if (!this.map)
691
+ return;
692
+ this.layers.rmv(c.layer.get('name'));
693
+ this.map.removeLayer(c.layer);
694
+ });
695
+ }
696
+ observeFeaturesInArea() {
697
+ this.postboy.subscribe(GetFeaturesInAreaQuery.ID).subscribe((qr) => {
698
+ let result = new Dictionary();
699
+ this.layers.forEach((l) => {
700
+ let layerName = l.get('name');
701
+ if (qr.ignore.has(layerName) || layerName === MapConstants.DrawingLayerId)
702
+ return;
703
+ let source = l.getSource();
704
+ if (!!source['getSource'])
705
+ source = source?.getSource();
706
+ let features = this.postboy.execute(new FilterFeaturesInAreaExecutor(qr.area, source?.getFeatures() ?? []));
707
+ result.put(layerName, features.map((e) => ({ id: e.getId(), ...e.get(MapConstants.FeatureInfo) })));
708
+ });
709
+ qr.finish(result);
710
+ });
711
+ }
712
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
713
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService });
714
+ }
715
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapManagementService, decorators: [{
716
+ type: Injectable
717
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
718
+
719
+ class MapStateService {
720
+ postboy;
721
+ map;
722
+ constructor(postboy) {
723
+ this.postboy = postboy;
724
+ }
725
+ up() {
726
+ this.observeMapRendering();
727
+ this.observeCenter();
728
+ }
729
+ observeMapRendering() {
730
+ this.postboy
731
+ .subscribe(MapRenderedEvent.ID)
732
+ .pipe(first())
733
+ .subscribe((ev) => {
734
+ this.map = ev.map;
735
+ this.map?.on('moveend', () => {
736
+ const zoom = Math.floor(this.map?.getView().getZoom() || -1);
737
+ const extent = this.map?.getView().calculateExtent() || [];
738
+ this.postboy.fire(new MapMoveEndEvent(zoom, extent));
739
+ });
740
+ });
741
+ }
742
+ observeCenter() {
743
+ this.postboy.subscribe(SetMapCenterCommand.ID).subscribe((c) => {
744
+ this.map?.getView().setCenter([c.lng, c.lat]);
745
+ if (c.zoom)
746
+ this.map?.getView().setZoom(c.zoom);
747
+ });
748
+ }
749
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
750
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService });
751
+ }
752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapStateService, decorators: [{
753
+ type: Injectable
754
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
755
+
756
+ class MapFeatureService {
757
+ postboy;
758
+ map;
759
+ fitPolygonsWaiting;
760
+ constructor(postboy) {
761
+ this.postboy = postboy;
762
+ }
763
+ up() {
764
+ this.observeMapRender();
765
+ this.observeFitToFeatures();
766
+ this.observeFitToPolygons();
767
+ }
768
+ observeMapRender() {
769
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
770
+ this.map = m.map;
771
+ if (this.fitPolygonsWaiting)
772
+ this.postboy.fire(this.fitPolygonsWaiting);
773
+ });
774
+ }
775
+ observeFitToFeatures() {
776
+ this.postboy.subscribe(FitToFeaturesCommand.ID).subscribe((cmd) => {
777
+ this.fitToGeometries(cmd.features.map((f) => f.getGeometry()), cmd.zoomAfter);
778
+ });
779
+ }
780
+ observeFitToPolygons() {
781
+ this.postboy.subscribe(FitToPolygonsCommand.ID).subscribe((cmd) => {
782
+ if (!this.map) {
783
+ this.fitPolygonsWaiting = cmd;
784
+ return;
785
+ }
786
+ this.fitPolygonsWaiting = undefined;
787
+ this.fitToGeometries(cmd.features.map((f) => f.feature.getGeometry()), cmd.zoomAfter);
788
+ });
789
+ }
790
+ fitToGeometries(geometries, zoomAfter) {
791
+ if (!geometries?.length || !this.map)
792
+ return;
793
+ const extent = createEmpty();
794
+ geometries.forEach((g) => extend(extent, g.getExtent()));
795
+ this.map.getView().fit(extent);
796
+ this.map.getView().setZoom(this.map.getView().getZoom() + zoomAfter);
797
+ }
798
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
799
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService });
800
+ }
801
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapFeatureService, decorators: [{
802
+ type: Injectable
803
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
804
+
805
+ class MapClickService {
806
+ postboy;
807
+ map;
808
+ constructor(postboy) {
809
+ this.postboy = postboy;
810
+ }
811
+ up() {
812
+ this.observeMapRender();
813
+ }
814
+ onClick(ev) {
815
+ const model = new MapClickEvent(ev.coordinate, {}, {});
816
+ this.map?.forEachFeatureAtPixel(ev.pixel, (f, l) => {
817
+ this.getFeatureCollectionWithInner([f])
818
+ .filter((f) => f.getId() != null)
819
+ .forEach((fs) => {
820
+ let layerName = l.get('name');
821
+ if (!model.entities[layerName])
822
+ model.entities[layerName] = [];
823
+ if (!model.features[layerName])
824
+ model.features[layerName] = [];
825
+ model.entities[layerName].push({ id: fs.getId(), ...fs.get(MapConstants.FeatureInfo) });
826
+ model.features[layerName].push(fs);
827
+ });
828
+ });
829
+ return model;
830
+ }
831
+ observeMapRender() {
832
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
833
+ this.map = m.map;
834
+ this.map?.on('singleclick', (e) => {
835
+ this.postboy.fire(this.onClick(e));
836
+ });
837
+ });
838
+ }
839
+ getFeatureCollectionWithInner(features) {
840
+ const result = [];
841
+ features?.forEach((f) => {
842
+ const innerFeatures = f.get('features');
843
+ innerFeatures?.length ? result.push(...innerFeatures) : result.push(f);
844
+ });
845
+ return result;
846
+ }
847
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
848
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService });
849
+ }
850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapClickService, decorators: [{
851
+ type: Injectable
852
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
853
+
854
+ class DrawingService {
855
+ postboy;
856
+ drawInteraction;
857
+ map;
858
+ constructor(postboy) {
859
+ this.postboy = postboy;
860
+ }
861
+ up() {
862
+ this.observeDrawing();
863
+ this.observeSelectArea();
864
+ this.observeMapRender();
865
+ }
866
+ observeSelectArea() {
867
+ this.postboy.subscribe(DrawSelectionAreaCommand.ID).subscribe((ev) => {
868
+ const drawingCommand = new StartDrawingCommand(ev.type, ev.style);
869
+ drawingCommand.result.subscribe((r) => {
870
+ if (!r) {
871
+ ev.finish(new Dictionary());
872
+ return;
873
+ }
874
+ const area = PolygonModel.fromGeoJson(1, r).feature.getGeometry();
875
+ const getFeaturesCommand = new GetFeaturesInAreaQuery(area, ev.ignore);
876
+ getFeaturesCommand.result.subscribe((result) => ev.finish(result));
877
+ this.postboy.fire(getFeaturesCommand);
878
+ });
879
+ this.postboy.fire(drawingCommand);
880
+ });
881
+ }
882
+ observeDrawing() {
883
+ this.postboy.subscribe(StartDrawingCommand.ID).subscribe((ev) => {
884
+ this.draw((l) => {
885
+ if (!l || !this.map) {
886
+ this.clearInteraction(l);
887
+ return;
888
+ }
889
+ const cancelSub = this.observeCancelation(ev, l);
890
+ this.drawInteraction = this.postboy.execute(new GenerateDrawExecutor(l, ev.style, ev.type));
891
+ this.map?.addInteraction(this.drawInteraction);
892
+ this.drawInteraction.on('drawend', (evt) => {
893
+ cancelSub.unsubscribe();
894
+ this.onEnd(evt, ev, l);
895
+ });
896
+ });
897
+ });
898
+ }
899
+ onEnd(evt, command, layer) {
900
+ command.finish(command.format === FeatureOutputFormat.GeoJson
901
+ ? new GeoJSON().writeFeature(evt.feature)
902
+ : new WKT().writeFeature(evt.feature));
903
+ this.clearInteraction(layer);
904
+ }
905
+ observeMapRender() {
906
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
907
+ this.map = m.map;
908
+ });
909
+ }
910
+ draw(action) {
911
+ const query = new GetLayerQuery(MapConstants.DrawingLayerId);
912
+ query.result.subscribe((l) => action(l));
913
+ this.postboy.fire(query);
914
+ }
915
+ observeCancelation(ev, layer) {
916
+ return this.postboy
917
+ .subscribe(CancelDrawingCommand.ID)
918
+ .pipe(first())
919
+ .subscribe(() => {
920
+ ev.finish(null);
921
+ this.clearInteraction(layer);
922
+ });
923
+ }
924
+ clearInteraction(layer) {
925
+ if (!!this.drawInteraction) {
926
+ this.map?.removeInteraction(this.drawInteraction);
927
+ layer?.setSource(new Vector({}));
928
+ }
929
+ setTimeout(() => this.postboy.fire(new DrawingFinishedEvent()), 300);
930
+ }
931
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
932
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService });
933
+ }
934
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DrawingService, decorators: [{
935
+ type: Injectable
936
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
937
+
938
+ class FeatureModificationService {
939
+ postboy;
940
+ modify;
941
+ translate;
942
+ map;
943
+ constructor(postboy) {
944
+ this.postboy = postboy;
945
+ }
946
+ up() {
947
+ this.observeModification();
948
+ this.observeMapRender();
949
+ }
950
+ observeModification() {
951
+ this.postboy.subscribe(ModifyFeatureCommand.ID).subscribe((ev) => {
952
+ this.defineLayer((l) => {
953
+ if (!l || !this.map) {
954
+ this.clearInteraction(l);
955
+ return;
956
+ }
957
+ this.observeCancelation(ev, l);
958
+ this.initFeature(l, ev.model.feature);
959
+ this.addModify(ev);
960
+ this.addDragging(ev);
961
+ });
962
+ });
963
+ }
964
+ initFeature(layer, feature) {
965
+ layer.getSource()?.clear();
966
+ layer.getSource()?.addFeature(feature);
967
+ }
968
+ addModify(command) {
969
+ this.modify = new Modify({
970
+ features: new Collection([command.model.feature]),
971
+ style: command.style,
972
+ });
973
+ this.modify.on('modifyend', () => {
974
+ this.onModified(command);
975
+ command.model.feature.changed();
976
+ });
977
+ this.map?.addInteraction(this.modify);
978
+ }
979
+ addDragging(command) {
980
+ this.translate = new Translate({
981
+ features: new Collection([command.model.feature]),
982
+ condition: (ev) => {
983
+ const clone = command.model.feature.clone();
984
+ clone.getGeometry()?.scale(0.999);
985
+ return clone.getGeometry().intersectsCoordinate(ev.coordinate);
986
+ },
987
+ });
988
+ this.translate.on('translateend', () => this.onModified(command));
989
+ this.map?.addInteraction(this.translate);
990
+ }
991
+ onModified(command) {
992
+ command.next(command.format === FeatureOutputFormat.GeoJson
993
+ ? new GeoJSON().writeFeature(command.model.feature)
994
+ : new WKT().writeFeature(command.model.feature));
995
+ }
996
+ observeMapRender() {
997
+ this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
998
+ this.map = m.map;
999
+ });
1000
+ }
1001
+ defineLayer(action) {
1002
+ const query = new GetLayerQuery(MapConstants.DrawingLayerId);
1003
+ query.result.subscribe((l) => action(l));
1004
+ this.postboy.fire(query);
1005
+ }
1006
+ observeCancelation(ev, layer) {
1007
+ return this.postboy
1008
+ .subscribe(CancelFeatureModificationCommand.ID)
1009
+ .pipe(first())
1010
+ .subscribe(() => {
1011
+ ev.finish(null);
1012
+ this.clearInteraction(layer);
1013
+ });
1014
+ }
1015
+ clearInteraction(layer) {
1016
+ if (this.modify)
1017
+ this.map?.removeInteraction(this.modify);
1018
+ if (this.translate)
1019
+ this.map?.removeInteraction(this.translate);
1020
+ }
1021
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
1022
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService });
1023
+ }
1024
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureModificationService, decorators: [{
1025
+ type: Injectable
1026
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
1027
+
1028
+ class ControlsService {
1029
+ postboy;
1030
+ map;
1031
+ constructor(postboy) {
1032
+ this.postboy = postboy;
1033
+ }
1034
+ up() {
1035
+ this.observeMapRender();
1036
+ }
1037
+ observeMapRender() {
1038
+ this.postboy
1039
+ .subscribe(MapRenderedEvent.ID)
1040
+ .pipe(first())
1041
+ .subscribe((m) => {
1042
+ this.map = m.map;
1043
+ this.observeAdding();
1044
+ this.observeRemoving();
1045
+ });
1046
+ }
1047
+ observeAdding() {
1048
+ this.postboy.subscribe(AddControlCommand.ID).subscribe((c) => this.map?.addControl(c.item));
1049
+ }
1050
+ observeRemoving() {
1051
+ this.postboy
1052
+ .subscribe(RemoveControlCommand.ID)
1053
+ .subscribe((c) => this.map?.removeControl(c.item));
1054
+ }
1055
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Injectable });
1056
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService });
1057
+ }
1058
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ControlsService, decorators: [{
1059
+ type: Injectable
1060
+ }], ctorParameters: () => [{ type: MapPostboyService }] });
1061
+
1062
+ class MessageRegistratorService extends PostboyAbstractRegistrator {
1063
+ constructor(service, management, state, mapFeature, interaction, drawing, featureModification, controls) {
1064
+ super(service);
1065
+ this.registerServices([management, state, interaction, mapFeature, drawing, featureModification, controls]);
1066
+ }
1067
+ _up() {
1068
+ this.registerReplay(MapRenderedEvent.ID);
1069
+ this.registerReplay(PlaceLayerFeaturesCommand.ID);
1070
+ this.registerReplay(RemoveControlCommand.ID);
1071
+ this.registerReplay(AddControlCommand.ID);
1072
+ this.registerReplay(SetMapCenterCommand.ID);
1073
+ this.registerSubject(AddLayerCommand.ID);
1074
+ this.registerSubject(RemoveLayerCommand.ID);
1075
+ this.registerSubject(AddTileCommand.ID);
1076
+ this.registerSubject(RemoveTileCommand.ID);
1077
+ this.registerSubject(MapClickEvent.ID);
1078
+ this.registerSubject(CloseTooltipCommand.ID);
1079
+ this.registerSubject(FitToFeaturesCommand.ID);
1080
+ this.registerSubject(FitToPolygonsCommand.ID);
1081
+ this.registerSubject(MapMoveEndEvent.ID);
1082
+ this.registerSubject(CancelDrawingCommand.ID);
1083
+ this.registerSubject(StartDrawingCommand.ID);
1084
+ this.registerSubject(GetLayerQuery.ID);
1085
+ this.registerSubject(DrawingFinishedEvent.ID);
1086
+ this.registerSubject(GetFeaturesInAreaQuery.ID);
1087
+ this.registerSubject(DrawSelectionAreaCommand.ID);
1088
+ this.registerSubject(CancelFeatureModificationCommand.ID);
1089
+ this.registerSubject(ModifyFeatureCommand.ID);
1090
+ this.setExecutors();
1091
+ }
1092
+ setExecutors() {
1093
+ this.registerExecutor(FilterFeaturesInAreaExecutor.ID, (e) => FeatureService.filterFeaturesInArea(e));
1094
+ this.registerExecutor(CalculateAreaExecutor.ID, (e) => FeatureService.calculateArea(e.polygon?.feature?.getGeometry()));
1095
+ this.registerExecutor(GenerateDrawExecutor.ID, (e) => DrawingGenerationService.getDraw(e));
1096
+ this.registerExecutor(GenerateZoomControlExecutor.ID, (e) => ZoomControlFactory.build(e.settings));
1097
+ }
1098
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService, deps: [{ token: MapPostboyService }, { token: MapManagementService }, { token: MapStateService }, { token: MapFeatureService }, { token: MapClickService }, { token: DrawingService }, { token: FeatureModificationService }, { token: ControlsService }], target: i0.ɵɵFactoryTarget.Injectable });
1099
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService });
1100
+ }
1101
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MessageRegistratorService, decorators: [{
1102
+ type: Injectable
1103
+ }], ctorParameters: () => [{ type: MapPostboyService }, { type: MapManagementService }, { type: MapStateService }, { type: MapFeatureService }, { type: MapClickService }, { type: DrawingService }, { type: FeatureModificationService }, { type: ControlsService }] });
1104
+
1105
+ /**
1106
+ * Class representing settings for a tile layer.
1107
+ */
1108
+ class TileLayerSettings {
1109
+ /**
1110
+ * The maximum zoom level for a map view.
1111
+ *
1112
+ * @type {number}
1113
+ * @default 19
1114
+ */
1115
+ maxZoom = 19;
1116
+ /**
1117
+ * The minimum zoom level allowed.
1118
+ *
1119
+ * @type {number}
1120
+ */
1121
+ minZoom = 0;
1122
+ /**
1123
+ * The opacity of an element.
1124
+ *
1125
+ * @type {number}
1126
+ * @default 0.6
1127
+ */
1128
+ opacity = 0.6;
1129
+ /**
1130
+ * Represents the tiles URL.
1131
+ * @typedef {string} url
1132
+ *
1133
+ * @example
1134
+ * 'https://example.ex/{z}/{x}/{y}.png'
1135
+ */
1136
+ url = '';
1137
+ /**
1138
+ * The projection of the coordinate system.
1139
+ *
1140
+ * @type {string}
1141
+ * @default 'EPSG:3857'
1142
+ */
1143
+ projection = 'EPSG:3857';
1144
+ /**
1145
+ * Creates a copy of the given tile layer settings.
1146
+ *
1147
+ * @param {TileLayerSettings} model - The tile layer settings to be copied.
1148
+ * @return {TileLayerSettings} - A new instance of TileLayerSettings with the same properties as the model.
1149
+ */
1150
+ static copy(model) {
1151
+ const result = new TileLayerSettings();
1152
+ result.maxZoom = model.maxZoom;
1153
+ result.minZoom = model.minZoom;
1154
+ result.projection = model.projection;
1155
+ result.opacity = model.opacity;
1156
+ result.url = model.url;
1157
+ return result;
1158
+ }
1159
+ /**
1160
+ * Sets the URL of the TileLayerSettings object.
1161
+ *
1162
+ * @param {string} url - The URL to be set.
1163
+ * @return {TileLayerSettings} - The updated TileLayerSettings object.
1164
+ */
1165
+ setUrl(url) {
1166
+ return TileLayerSettings.copy({ ...this, url });
1167
+ }
1168
+ /**
1169
+ * Sets the maximum zoom level for the tile layer.
1170
+ *
1171
+ * @param {number} maxZoom - The maximum zoom level.
1172
+ * @returns {TileLayerSettings} - The updated tile layer settings object.
1173
+ */
1174
+ setMaxZoom(maxZoom) {
1175
+ return TileLayerSettings.copy({ ...this, maxZoom });
1176
+ }
1177
+ /**
1178
+ * Sets the minimum zoom level for the Tile Layer.
1179
+ *
1180
+ * @param {number} minZoom - The minimum zoom level to be set.
1181
+ * @return {TileLayerSettings} The modified TileLayerSettings object with the updated minimum zoom level.
1182
+ */
1183
+ setMinZoom(minZoom) {
1184
+ return TileLayerSettings.copy({ ...this, minZoom });
1185
+ }
1186
+ /**
1187
+ * Sets the opacity of the TileLayerSettings.
1188
+ *
1189
+ * @param {number} opacity - The opacity value to set. Must be a number between 0 and 1.
1190
+ * @return {TileLayerSettings} - A new instance of TileLayerSettings with the opacity set.
1191
+ */
1192
+ setOpacity(opacity) {
1193
+ return TileLayerSettings.copy({ ...this, opacity });
1194
+ }
1195
+ /**
1196
+ * Sets the projection for the tile layer settings.
1197
+ *
1198
+ * @param {string} projection - The desired projection for the tile layer settings.
1199
+ * @return {TileLayerSettings} - The updated tile layer settings with the new projection.
1200
+ */
1201
+ setProjection(projection) {
1202
+ return TileLayerSettings.copy({ ...this, projection });
1203
+ }
1204
+ /**
1205
+ * Checks if the current instance of TileLayerSettings is equal to the given model.
1206
+ * @param {TileLayerSettings} model - The model to compare against.
1207
+ * @return {boolean} - True if all properties of the current instance matches the properties of the model;
1208
+ * otherwise, false.
1209
+ */
1210
+ isSame(model) {
1211
+ if (this.maxZoom !== model.maxZoom)
1212
+ return false;
1213
+ if (this.minZoom !== model.minZoom)
1214
+ return false;
1215
+ if (this.url !== model.url)
1216
+ return false;
1217
+ if (this.projection !== model.projection)
1218
+ return false;
1219
+ if (this.opacity !== model.opacity)
1220
+ return false;
1221
+ return true;
1222
+ }
1223
+ }
1224
+
1225
+ class TileLayerFactory {
1226
+ build(settings) {
1227
+ const source = new XYZ({
1228
+ tileSize: 256,
1229
+ maxZoom: settings.maxZoom || 14,
1230
+ minZoom: settings.minZoom || 1,
1231
+ projection: get(settings.projection),
1232
+ tileUrlFunction: this.getTileFunc(settings),
1233
+ crossOrigin: 'Anonymous',
1234
+ });
1235
+ return new TileLayer({ source, opacity: settings.opacity });
1236
+ }
1237
+ getTileFunc(settings) {
1238
+ return (tileCoord) => {
1239
+ const zoom = tileCoord[0];
1240
+ const x = tileCoord[1];
1241
+ const y = tileCoord[2];
1242
+ const normalizedCoord = this.getNormalizedCoord({ x: x, y: y }, zoom);
1243
+ const bound = 1 << zoom;
1244
+ return settings.url
1245
+ .replace('{x}', String(normalizedCoord?.x || x))
1246
+ .replace('{z}', String(zoom))
1247
+ .replace('{y}', String(bound - (normalizedCoord?.y || y) - 1));
1248
+ };
1249
+ }
1250
+ getNormalizedCoord(coord, zoom) {
1251
+ const y = coord.y;
1252
+ let x = coord.x;
1253
+ const tileRange = 1 << zoom;
1254
+ if (y < 0 || y >= tileRange)
1255
+ return null;
1256
+ if (x < 0 || x >= tileRange)
1257
+ x = ((x % tileRange) + tileRange) % tileRange;
1258
+ return { x: x, y: y };
1259
+ }
1260
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1261
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, providedIn: 'root' });
1262
+ }
1263
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerFactory, decorators: [{
1264
+ type: Injectable,
1265
+ args: [{
1266
+ providedIn: 'root',
1267
+ }]
1268
1268
  }] });
1269
1269
 
1270
- class TileLayerComponent extends DestructibleComponent {
1271
- postboy;
1272
- factory;
1273
- layer;
1274
- constructor(postboy, factory) {
1275
- super();
1276
- this.postboy = postboy;
1277
- this.factory = factory;
1278
- }
1279
- _settings = new TileLayerSettings();
1280
- set settings(value) {
1281
- if (!value || this._settings.isSame(value))
1282
- return;
1283
- this._settings = value;
1284
- this.initLayer();
1285
- }
1286
- ngOnInit() {
1287
- this.postboy
1288
- .subscribe(MapRenderedEvent.ID)
1289
- .pipe(filter((m) => !!m), first())
1290
- .subscribe((m) => this.initLayer());
1291
- }
1292
- onDestroy = () => this.removeLayer();
1293
- initLayer() {
1294
- this.removeLayer();
1295
- this.layer = this.factory.build(this._settings);
1296
- this.postboy.fire(new AddTileCommand(this.layer));
1297
- }
1298
- removeLayer() {
1299
- if (this.layer)
1300
- this.postboy.fire(new RemoveTileCommand(this.layer));
1301
- }
1302
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayerComponent, deps: [{ token: MapPostboyService }, { token: TileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1303
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TileLayerComponent, selector: "art-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1304
- }
1305
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TileLayerComponent, decorators: [{
1306
- type: Component,
1307
- args: [{ selector: 'art-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1308
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: TileLayerFactory }]; }, propDecorators: { settings: [{
1309
- type: Input
1270
+ class TileLayerComponent extends DestructibleComponent {
1271
+ postboy;
1272
+ factory;
1273
+ layer;
1274
+ constructor(postboy, factory) {
1275
+ super();
1276
+ this.postboy = postboy;
1277
+ this.factory = factory;
1278
+ }
1279
+ _settings = new TileLayerSettings();
1280
+ set settings(value) {
1281
+ if (!value || this._settings.isSame(value))
1282
+ return;
1283
+ this._settings = value;
1284
+ this.initLayer();
1285
+ }
1286
+ ngOnInit() {
1287
+ this.postboy
1288
+ .subscribe(MapRenderedEvent.ID)
1289
+ .pipe(filter((m) => !!m), first())
1290
+ .subscribe((m) => this.initLayer());
1291
+ }
1292
+ onDestroy = () => this.removeLayer();
1293
+ initLayer() {
1294
+ this.removeLayer();
1295
+ this.layer = this.factory.build(this._settings);
1296
+ this.postboy.fire(new AddTileCommand(this.layer));
1297
+ }
1298
+ removeLayer() {
1299
+ if (this.layer)
1300
+ this.postboy.fire(new RemoveTileCommand(this.layer));
1301
+ }
1302
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerComponent, deps: [{ token: MapPostboyService }, { token: TileLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1303
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: TileLayerComponent, selector: "art-tile-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1304
+ }
1305
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TileLayerComponent, decorators: [{
1306
+ type: Component,
1307
+ args: [{ selector: 'art-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1308
+ }], ctorParameters: () => [{ type: MapPostboyService }, { type: TileLayerFactory }], propDecorators: { settings: [{
1309
+ type: Input
1310
1310
  }] } });
1311
1311
 
1312
- class OsmTileLayerComponent extends DestructibleComponent {
1313
- layer;
1314
- constructor() {
1315
- super();
1316
- }
1317
- _url = '';
1318
- set url(value) {
1319
- if (!value || this._url === value)
1320
- return;
1321
- this._url = value;
1322
- this.initLayer();
1323
- }
1324
- _map;
1325
- set map(value) {
1326
- if (!value || this._map === value)
1327
- return;
1328
- this._map = value;
1329
- this.initLayer();
1330
- }
1331
- ngOnInit() { }
1332
- ngOnDestroy() {
1333
- if (this.layer) {
1334
- this._map?.removeLayer(this.layer);
1335
- }
1336
- // @ts-ignore
1337
- this.layer?.setMap(null);
1338
- }
1339
- initLayer() {
1340
- if (!this._url || !this._map)
1341
- return;
1342
- if (this.layer)
1343
- this._map.removeLayer(this.layer);
1344
- this.layer = new TileLayer({
1345
- source: new OSM({
1346
- url: this._url,
1347
- }),
1348
- });
1349
- this.layer.set('name', 'osm-tile-layer');
1350
- this._map.addLayer(this.layer);
1351
- }
1352
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1353
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1354
- }
1355
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
1356
- type: Component,
1357
- args: [{ selector: 'art-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1358
- }], ctorParameters: function () { return []; }, propDecorators: { url: [{
1359
- type: Input
1360
- }], map: [{
1361
- type: Input
1312
+ class OsmTileLayerComponent extends DestructibleComponent {
1313
+ layer;
1314
+ constructor() {
1315
+ super();
1316
+ }
1317
+ _url = '';
1318
+ set url(value) {
1319
+ if (!value || this._url === value)
1320
+ return;
1321
+ this._url = value;
1322
+ this.initLayer();
1323
+ }
1324
+ _map;
1325
+ set map(value) {
1326
+ if (!value || this._map === value)
1327
+ return;
1328
+ this._map = value;
1329
+ this.initLayer();
1330
+ }
1331
+ ngOnInit() { }
1332
+ ngOnDestroy() {
1333
+ if (this.layer) {
1334
+ this._map?.removeLayer(this.layer);
1335
+ }
1336
+ // @ts-ignore
1337
+ this.layer?.setMap(null);
1338
+ }
1339
+ initLayer() {
1340
+ if (!this._url || !this._map)
1341
+ return;
1342
+ if (this.layer)
1343
+ this._map.removeLayer(this.layer);
1344
+ this.layer = new TileLayer({
1345
+ source: new OSM({
1346
+ url: this._url,
1347
+ }),
1348
+ });
1349
+ this.layer.set('name', 'osm-tile-layer');
1350
+ this._map.addLayer(this.layer);
1351
+ }
1352
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: OsmTileLayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1353
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: { url: "url", map: "map" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1354
+ }
1355
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: OsmTileLayerComponent, decorators: [{
1356
+ type: Component,
1357
+ args: [{ selector: 'art-osm-tile-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1358
+ }], ctorParameters: () => [], propDecorators: { url: [{
1359
+ type: Input
1360
+ }], map: [{
1361
+ type: Input
1362
1362
  }] } });
1363
1363
 
1364
- /**
1365
- * A layer that is responsible for showing and styling main features on the map, such as markers and polygons
1366
- */
1367
- class FeatureLayerSettings {
1368
- /**
1369
- * The identifier of the field, it is autogenerated by default, but can be set manually
1370
- */
1371
- name = IdGenerator.get();
1372
- /**
1373
- * The priority of showing - layers with higher zIndex cover others in case of collisions
1374
- */
1375
- zIndex = 1;
1376
- /**
1377
- The maximum view zoom level (inclusive) at which this layer will be visible.
1378
-
1379
- @type {number}
1380
- @default 19
1381
- */
1382
- maxZoom = 19;
1383
- /**
1384
- The minimum view zoom level (exclusive) at which this layer will be visible.
1385
-
1386
- @type {number}
1387
- */
1388
- minZoom = 0;
1389
- /**
1390
- * The styling definition of layer's features. The easiest way is to use {@link PolygonStyleHelper},{@link MarkerStyleHelper}
1391
- */
1392
- style;
1393
- /**
1394
- * Copies the given FeatureLayerSettings object
1395
- *
1396
- * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to be copied
1397
- * @returns {FeatureLayerSettings} - A copy of the FeatureLayerSettings object
1398
- */
1399
- static copy(model) {
1400
- const result = new FeatureLayerSettings();
1401
- result.name = model.name;
1402
- result.maxZoom = model.maxZoom;
1403
- result.minZoom = model.minZoom;
1404
- result.zIndex = model.zIndex;
1405
- result.style = model.style;
1406
- return result;
1407
- }
1408
- /**
1409
- * Sets the z-index value for the FeatureLayerSettings object.
1410
- *
1411
- * @param {number} zIndex - The new z-index value.
1412
- * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1413
- */
1414
- setZIndex(zIndex) {
1415
- return FeatureLayerSettings.copy({ ...this, zIndex });
1416
- }
1417
- /**
1418
- * Sets the name of the FeatureLayerSettings.
1419
- *
1420
- * @param {string} name - The name to set for the FeatureLayerSettings.
1421
- *
1422
- * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new name.
1423
- */
1424
- setName(name) {
1425
- return FeatureLayerSettings.copy({ ...this, name });
1426
- }
1427
- /**
1428
- * Sets the maximum zoom level for the FeatureLayerSettings.
1429
- *
1430
- * @param {number} maxZoom - The maximum zoom level.
1431
- * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1432
- */
1433
- setMaxZoom(maxZoom) {
1434
- return FeatureLayerSettings.copy({ ...this, maxZoom });
1435
- }
1436
- /**
1437
- * Sets the minimum zoom level for the feature layer.
1438
- *
1439
- * @param {number} minZoom The minimum zoom level to be set.
1440
- * @returns {FeatureLayerSettings} The updated feature layer settings object.
1441
- */
1442
- setMinZoom(minZoom) {
1443
- return FeatureLayerSettings.copy({ ...this, minZoom });
1444
- }
1445
- /**
1446
- * Sets the style for the FeatureLayerSettings object.
1447
- *
1448
- * @param {Style | StyleFunction} style - The new style to set. It can be either a Style object or a StyleFunction.
1449
- * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new style.
1450
- */
1451
- setStyle(style) {
1452
- return FeatureLayerSettings.copy({ ...this, style });
1453
- }
1454
- /**
1455
- * Checks if the given FeatureLayerSettings object is identical to the current object.
1456
- *
1457
- * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to compare with.
1458
- * @return {boolean} - Returns true if the given object is identical to the current object, otherwise false.
1459
- */
1460
- isSame(model) {
1461
- if (this.maxZoom !== model.maxZoom)
1462
- return false;
1463
- if (this.minZoom !== model.minZoom)
1464
- return false;
1465
- if (this.zIndex !== model.zIndex)
1466
- return false;
1467
- if (this.name !== model.name)
1468
- return false;
1469
- if (this.style !== model.style)
1470
- return false;
1471
- return true;
1472
- }
1473
- }
1474
-
1475
- class FeatureLayerFactory {
1476
- build(settings) {
1477
- const source = new Vector({});
1478
- const layer = new Vector$1({
1479
- source: source,
1480
- maxZoom: settings.maxZoom,
1481
- minZoom: settings.minZoom,
1482
- zIndex: settings.zIndex,
1483
- });
1484
- if (settings.style)
1485
- layer.setStyle(settings.style);
1486
- layer.set('name', settings.name);
1487
- return layer;
1488
- }
1489
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1490
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureLayerFactory, providedIn: 'root' });
1491
- }
1492
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureLayerFactory, decorators: [{
1493
- type: Injectable,
1494
- args: [{
1495
- providedIn: 'root',
1496
- }]
1364
+ /**
1365
+ * A layer that is responsible for showing and styling main features on the map, such as markers and polygons
1366
+ */
1367
+ class FeatureLayerSettings {
1368
+ /**
1369
+ * The identifier of the field, it is autogenerated by default, but can be set manually
1370
+ */
1371
+ name = IdGenerator.get();
1372
+ /**
1373
+ * The priority of showing - layers with higher zIndex cover others in case of collisions
1374
+ */
1375
+ zIndex = 1;
1376
+ /**
1377
+ The maximum view zoom level (inclusive) at which this layer will be visible.
1378
+
1379
+ @type {number}
1380
+ @default 19
1381
+ */
1382
+ maxZoom = 19;
1383
+ /**
1384
+ The minimum view zoom level (exclusive) at which this layer will be visible.
1385
+
1386
+ @type {number}
1387
+ */
1388
+ minZoom = 0;
1389
+ /**
1390
+ * The styling definition of layer's features. The easiest way is to use {@link PolygonStyleHelper},{@link MarkerStyleHelper}
1391
+ */
1392
+ style;
1393
+ /**
1394
+ * Copies the given FeatureLayerSettings object
1395
+ *
1396
+ * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to be copied
1397
+ * @returns {FeatureLayerSettings} - A copy of the FeatureLayerSettings object
1398
+ */
1399
+ static copy(model) {
1400
+ const result = new FeatureLayerSettings();
1401
+ result.name = model.name;
1402
+ result.maxZoom = model.maxZoom;
1403
+ result.minZoom = model.minZoom;
1404
+ result.zIndex = model.zIndex;
1405
+ result.style = model.style;
1406
+ return result;
1407
+ }
1408
+ /**
1409
+ * Sets the z-index value for the FeatureLayerSettings object.
1410
+ *
1411
+ * @param {number} zIndex - The new z-index value.
1412
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1413
+ */
1414
+ setZIndex(zIndex) {
1415
+ return FeatureLayerSettings.copy({ ...this, zIndex });
1416
+ }
1417
+ /**
1418
+ * Sets the name of the FeatureLayerSettings.
1419
+ *
1420
+ * @param {string} name - The name to set for the FeatureLayerSettings.
1421
+ *
1422
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new name.
1423
+ */
1424
+ setName(name) {
1425
+ return FeatureLayerSettings.copy({ ...this, name });
1426
+ }
1427
+ /**
1428
+ * Sets the maximum zoom level for the FeatureLayerSettings.
1429
+ *
1430
+ * @param {number} maxZoom - The maximum zoom level.
1431
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object.
1432
+ */
1433
+ setMaxZoom(maxZoom) {
1434
+ return FeatureLayerSettings.copy({ ...this, maxZoom });
1435
+ }
1436
+ /**
1437
+ * Sets the minimum zoom level for the feature layer.
1438
+ *
1439
+ * @param {number} minZoom The minimum zoom level to be set.
1440
+ * @returns {FeatureLayerSettings} The updated feature layer settings object.
1441
+ */
1442
+ setMinZoom(minZoom) {
1443
+ return FeatureLayerSettings.copy({ ...this, minZoom });
1444
+ }
1445
+ /**
1446
+ * Sets the style for the FeatureLayerSettings object.
1447
+ *
1448
+ * @param {Style | StyleFunction} style - The new style to set. It can be either a Style object or a StyleFunction.
1449
+ * @return {FeatureLayerSettings} - The updated FeatureLayerSettings object with the new style.
1450
+ */
1451
+ setStyle(style) {
1452
+ return FeatureLayerSettings.copy({ ...this, style });
1453
+ }
1454
+ /**
1455
+ * Checks if the given FeatureLayerSettings object is identical to the current object.
1456
+ *
1457
+ * @param {FeatureLayerSettings} model - The FeatureLayerSettings object to compare with.
1458
+ * @return {boolean} - Returns true if the given object is identical to the current object, otherwise false.
1459
+ */
1460
+ isSame(model) {
1461
+ if (this.maxZoom !== model.maxZoom)
1462
+ return false;
1463
+ if (this.minZoom !== model.minZoom)
1464
+ return false;
1465
+ if (this.zIndex !== model.zIndex)
1466
+ return false;
1467
+ if (this.name !== model.name)
1468
+ return false;
1469
+ if (this.style !== model.style)
1470
+ return false;
1471
+ return true;
1472
+ }
1473
+ }
1474
+
1475
+ class FeatureLayerFactory {
1476
+ build(settings) {
1477
+ const source = new Vector({});
1478
+ const layer = new Vector$1({
1479
+ source: source,
1480
+ maxZoom: settings.maxZoom,
1481
+ minZoom: settings.minZoom,
1482
+ zIndex: settings.zIndex,
1483
+ });
1484
+ if (settings.style)
1485
+ layer.setStyle(settings.style);
1486
+ layer.set('name', settings.name);
1487
+ return layer;
1488
+ }
1489
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1490
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, providedIn: 'root' });
1491
+ }
1492
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerFactory, decorators: [{
1493
+ type: Injectable,
1494
+ args: [{
1495
+ providedIn: 'root',
1496
+ }]
1497
1497
  }] });
1498
1498
 
1499
- class FeatureLayerComponent extends DestructibleComponent {
1500
- postboy;
1501
- factory;
1502
- layer = null;
1503
- constructor(postboy, factory) {
1504
- super();
1505
- this.postboy = postboy;
1506
- this.factory = factory;
1507
- }
1508
- _settings = new FeatureLayerSettings();
1509
- set settings(value) {
1510
- if (!value || this._settings.isSame(value))
1511
- return;
1512
- this._settings = value;
1513
- this.initLayer();
1514
- }
1515
- ngOnInit() {
1516
- this.postboy
1517
- .subscribe(MapRenderedEvent.ID)
1518
- .pipe(filter((m) => !!m), first())
1519
- .subscribe((m) => this.initLayer());
1520
- }
1521
- onDestroy = () => this.removeLayer();
1522
- initLayer() {
1523
- this.removeLayer();
1524
- this.layer = this.factory.build(this._settings);
1525
- this.postboy.fire(new AddLayerCommand(this.layer));
1526
- }
1527
- removeLayer() {
1528
- if (this.layer)
1529
- this.postboy.fire(new RemoveLayerCommand(this.layer));
1530
- }
1531
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1532
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1533
- }
1534
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FeatureLayerComponent, decorators: [{
1535
- type: Component,
1536
- args: [{ selector: 'art-feature-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1537
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: FeatureLayerFactory }]; }, propDecorators: { settings: [{
1538
- type: Input
1499
+ class FeatureLayerComponent extends DestructibleComponent {
1500
+ postboy;
1501
+ factory;
1502
+ layer = null;
1503
+ constructor(postboy, factory) {
1504
+ super();
1505
+ this.postboy = postboy;
1506
+ this.factory = factory;
1507
+ }
1508
+ _settings = new FeatureLayerSettings();
1509
+ set settings(value) {
1510
+ if (!value || this._settings.isSame(value))
1511
+ return;
1512
+ this._settings = value;
1513
+ this.initLayer();
1514
+ }
1515
+ ngOnInit() {
1516
+ this.postboy
1517
+ .subscribe(MapRenderedEvent.ID)
1518
+ .pipe(filter((m) => !!m), first())
1519
+ .subscribe((m) => this.initLayer());
1520
+ }
1521
+ onDestroy = () => this.removeLayer();
1522
+ initLayer() {
1523
+ this.removeLayer();
1524
+ this.layer = this.factory.build(this._settings);
1525
+ this.postboy.fire(new AddLayerCommand(this.layer));
1526
+ }
1527
+ removeLayer() {
1528
+ if (this.layer)
1529
+ this.postboy.fire(new RemoveLayerCommand(this.layer));
1530
+ }
1531
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerComponent, deps: [{ token: MapPostboyService }, { token: FeatureLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1532
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1533
+ }
1534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: FeatureLayerComponent, decorators: [{
1535
+ type: Component,
1536
+ args: [{ selector: 'art-feature-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1537
+ }], ctorParameters: () => [{ type: MapPostboyService }, { type: FeatureLayerFactory }], propDecorators: { settings: [{
1538
+ type: Input
1539
1539
  }] } });
1540
1540
 
1541
- class ClusterLayerSettings {
1542
- name = IdGenerator.get();
1543
- zIndex = 1;
1544
- /**
1545
- * The maximum view zoom level (inclusive) at which this layer will be visible.
1546
- *
1547
- * @type {number}
1548
- * @default 19
1549
- */
1550
- maxZoom = 19;
1551
- /**
1552
- * The minimum view zoom level (exclusive) at which this layer will be visible.
1553
- *
1554
- * @type {number}
1555
- */
1556
- minZoom = 0;
1557
- /**
1558
- * Distance in pixels within which features will be clustered together.
1559
- *
1560
- * @type {number}
1561
- */
1562
- distance = 20;
1563
- bbox = false;
1564
- clusterCancel = 14;
1565
- style;
1566
- /**
1567
- * Creates a copy of the given ClusterLayerSettings object.
1568
- *
1569
- * @param {ClusterLayerSettings} model - The ClusterLayerSettings object to be copied.
1570
- * @returns {ClusterLayerSettings} - A new ClusterLayerSettings object that is a copy of the original object.
1571
- */
1572
- static copy(model) {
1573
- const result = new ClusterLayerSettings();
1574
- result.name = model.name;
1575
- result.maxZoom = model.maxZoom;
1576
- result.minZoom = model.minZoom;
1577
- result.zIndex = model.zIndex;
1578
- result.bbox = model.bbox;
1579
- result.clusterCancel = model.clusterCancel;
1580
- result.distance = model.distance;
1581
- result.style = model.style;
1582
- return result;
1583
- }
1584
- /**
1585
- * Set the z-index for the ClusterLayer.
1586
- *
1587
- * @param {number} zIndex - The new z-index for the ClusterLayer.
1588
- * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1589
- */
1590
- setZIndex(zIndex) {
1591
- return ClusterLayerSettings.copy({ ...this, zIndex });
1592
- }
1593
- /**
1594
- * Sets the distance value for ClusterLayerSettings.
1595
- *
1596
- * @param {number} distance - The distance value to be set.
1597
- * @return {ClusterLayerSettings} - The modified ClusterLayerSettings object.
1598
- */
1599
- setDistance(distance) {
1600
- return ClusterLayerSettings.copy({ ...this, distance });
1601
- }
1602
- /**
1603
- * Sets the name of the ClusterLayerSettings object.
1604
- *
1605
- * @param {string} name - The name to set for the ClusterLayerSettings.
1606
- * @return {ClusterLayerSettings} - A new ClusterLayerSettings object with the updated name.
1607
- */
1608
- setName(name) {
1609
- return ClusterLayerSettings.copy({ ...this, name });
1610
- }
1611
- /**
1612
- * Sets the maximum zoom level for the Cluster Layer.
1613
- *
1614
- * @param {number} maxZoom - The maximum zoom level to be set.
1615
- * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1616
- */
1617
- setMaxZoom(maxZoom) {
1618
- return ClusterLayerSettings.copy({ ...this, maxZoom });
1619
- }
1620
- /**
1621
- * Sets the minimum zoom level for the ClusterLayerSettings.
1622
- *
1623
- * @param {number} minZoom - The minimum zoom level to set.
1624
- * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1625
- */
1626
- setMinZoom(minZoom) {
1627
- return ClusterLayerSettings.copy({ ...this, minZoom });
1628
- }
1629
- /**
1630
- * Sets the cluster cancel number for the ClusterLayerSettings.
1631
- *
1632
- * @param {number} clusterCancel - The new cluster cancel number.
1633
- * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1634
- */
1635
- setClusterCancel(clusterCancel) {
1636
- return ClusterLayerSettings.copy({ ...this, clusterCancel });
1637
- }
1638
- /**
1639
- * Sets the value of 'bbox' property in the ClusterLayerSettings object.
1640
- *
1641
- * @param {boolean} bbox - A boolean value indicating whether to include bounding box calculation in the cluster layer settings.
1642
- * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object with the newly set 'bbox' value.
1643
- */
1644
- setBbox(bbox) {
1645
- return ClusterLayerSettings.copy({ ...this, bbox });
1646
- }
1647
- /**
1648
- * Sets the style for the ClusterLayerSettings.
1649
- *
1650
- * @param {function} style - A function that takes an array of identified features as input and returns a Style or StyleFunction.
1651
- *
1652
- * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object with the new style applied.
1653
- */
1654
- setStyle(style) {
1655
- return ClusterLayerSettings.copy({ ...this, style });
1656
- }
1657
- /**
1658
- * Checks if the current ClusterLayerSettings object is the same as the specified model.
1659
- *
1660
- * @param {ClusterLayerSettings} model - The model to compare with the current object.
1661
- *
1662
- * @return {boolean} - Returns true if the current ClusterLayerSettings object is the same as the specified model, otherwise false.
1663
- */
1664
- isSame(model) {
1665
- if (this.maxZoom !== model.maxZoom)
1666
- return false;
1667
- if (this.minZoom !== model.minZoom)
1668
- return false;
1669
- if (this.zIndex !== model.zIndex)
1670
- return false;
1671
- if (this.name !== model.name)
1672
- return false;
1673
- if (this.distance !== model.distance)
1674
- return false;
1675
- if (this.clusterCancel !== model.clusterCancel)
1676
- return false;
1677
- if (this.bbox !== model.bbox)
1678
- return false;
1679
- if (this.style !== model.style)
1680
- return false;
1681
- return true;
1682
- }
1683
- }
1684
-
1685
- class ClusterLayerManager {
1686
- settings;
1687
- layer;
1688
- postboy;
1689
- constructor(settings, layer, postboy) {
1690
- this.settings = settings;
1691
- this.layer = layer;
1692
- this.postboy = postboy;
1693
- this.observeClick();
1694
- this.observeMapMovement();
1695
- }
1696
- observeMapMovement() {
1697
- combineLatest([
1698
- this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
1699
- this.postboy.subscribe(MapRenderedEvent.ID),
1700
- ]).subscribe(([movement, renderEvent]) => {
1701
- this.checkClusterNecessity(renderEvent.map);
1702
- });
1703
- }
1704
- observeClick() {
1705
- this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
1706
- if ((m.features[this.settings.name]?.length ?? 0) > 1) {
1707
- this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
1708
- }
1709
- });
1710
- }
1711
- checkClusterNecessity(map) {
1712
- let zoom = map.getView().getZoom() ?? 0;
1713
- const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
1714
- this.layer?.getSource()?.setDistance(distance);
1715
- }
1716
- }
1717
-
1718
- class ClusterLayerFactory {
1719
- build(settings, postboy) {
1720
- const source = new Vector({
1721
- strategy: settings.bbox ? bbox : undefined,
1722
- });
1723
- const cluster = new Cluster({
1724
- distance: settings.distance,
1725
- source: source,
1726
- geometryFunction: (feature) => {
1727
- const geom = feature.getGeometry();
1728
- if (geom?.getType() == 'Point') {
1729
- return geom;
1730
- }
1731
- else if (geom?.getType() == 'Polygon') {
1732
- return geom?.getInteriorPoint();
1733
- }
1734
- else if (geom?.getType() == 'MultiPolygon') {
1735
- return fromExtent(geom.getExtent())?.getInteriorPoint();
1736
- }
1737
- return undefined;
1738
- },
1739
- });
1740
- const layer = new Vector$1({
1741
- source: cluster,
1742
- maxZoom: settings.maxZoom || undefined,
1743
- minZoom: settings.minZoom || undefined,
1744
- zIndex: settings.zIndex || 0,
1745
- });
1746
- layer.setStyle(this.styleFunc(settings));
1747
- layer.set('name', settings.name);
1748
- return new ClusterLayerManager(settings, layer, postboy);
1749
- }
1750
- styleFunc(settings) {
1751
- return (feature) => {
1752
- const features = feature.get('features');
1753
- if (!settings.style)
1754
- return undefined;
1755
- return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
1756
- };
1757
- }
1758
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1759
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
1760
- }
1761
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerFactory, decorators: [{
1762
- type: Injectable,
1763
- args: [{
1764
- providedIn: 'root',
1765
- }]
1541
+ class ClusterLayerSettings {
1542
+ name = IdGenerator.get();
1543
+ zIndex = 1;
1544
+ /**
1545
+ * The maximum view zoom level (inclusive) at which this layer will be visible.
1546
+ *
1547
+ * @type {number}
1548
+ * @default 19
1549
+ */
1550
+ maxZoom = 19;
1551
+ /**
1552
+ * The minimum view zoom level (exclusive) at which this layer will be visible.
1553
+ *
1554
+ * @type {number}
1555
+ */
1556
+ minZoom = 0;
1557
+ /**
1558
+ * Distance in pixels within which features will be clustered together.
1559
+ *
1560
+ * @type {number}
1561
+ */
1562
+ distance = 20;
1563
+ bbox = false;
1564
+ clusterCancel = 14;
1565
+ style;
1566
+ /**
1567
+ * Creates a copy of the given ClusterLayerSettings object.
1568
+ *
1569
+ * @param {ClusterLayerSettings} model - The ClusterLayerSettings object to be copied.
1570
+ * @returns {ClusterLayerSettings} - A new ClusterLayerSettings object that is a copy of the original object.
1571
+ */
1572
+ static copy(model) {
1573
+ const result = new ClusterLayerSettings();
1574
+ result.name = model.name;
1575
+ result.maxZoom = model.maxZoom;
1576
+ result.minZoom = model.minZoom;
1577
+ result.zIndex = model.zIndex;
1578
+ result.bbox = model.bbox;
1579
+ result.clusterCancel = model.clusterCancel;
1580
+ result.distance = model.distance;
1581
+ result.style = model.style;
1582
+ return result;
1583
+ }
1584
+ /**
1585
+ * Set the z-index for the ClusterLayer.
1586
+ *
1587
+ * @param {number} zIndex - The new z-index for the ClusterLayer.
1588
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1589
+ */
1590
+ setZIndex(zIndex) {
1591
+ return ClusterLayerSettings.copy({ ...this, zIndex });
1592
+ }
1593
+ /**
1594
+ * Sets the distance value for ClusterLayerSettings.
1595
+ *
1596
+ * @param {number} distance - The distance value to be set.
1597
+ * @return {ClusterLayerSettings} - The modified ClusterLayerSettings object.
1598
+ */
1599
+ setDistance(distance) {
1600
+ return ClusterLayerSettings.copy({ ...this, distance });
1601
+ }
1602
+ /**
1603
+ * Sets the name of the ClusterLayerSettings object.
1604
+ *
1605
+ * @param {string} name - The name to set for the ClusterLayerSettings.
1606
+ * @return {ClusterLayerSettings} - A new ClusterLayerSettings object with the updated name.
1607
+ */
1608
+ setName(name) {
1609
+ return ClusterLayerSettings.copy({ ...this, name });
1610
+ }
1611
+ /**
1612
+ * Sets the maximum zoom level for the Cluster Layer.
1613
+ *
1614
+ * @param {number} maxZoom - The maximum zoom level to be set.
1615
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1616
+ */
1617
+ setMaxZoom(maxZoom) {
1618
+ return ClusterLayerSettings.copy({ ...this, maxZoom });
1619
+ }
1620
+ /**
1621
+ * Sets the minimum zoom level for the ClusterLayerSettings.
1622
+ *
1623
+ * @param {number} minZoom - The minimum zoom level to set.
1624
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1625
+ */
1626
+ setMinZoom(minZoom) {
1627
+ return ClusterLayerSettings.copy({ ...this, minZoom });
1628
+ }
1629
+ /**
1630
+ * Sets the cluster cancel number for the ClusterLayerSettings.
1631
+ *
1632
+ * @param {number} clusterCancel - The new cluster cancel number.
1633
+ * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object.
1634
+ */
1635
+ setClusterCancel(clusterCancel) {
1636
+ return ClusterLayerSettings.copy({ ...this, clusterCancel });
1637
+ }
1638
+ /**
1639
+ * Sets the value of 'bbox' property in the ClusterLayerSettings object.
1640
+ *
1641
+ * @param {boolean} bbox - A boolean value indicating whether to include bounding box calculation in the cluster layer settings.
1642
+ * @returns {ClusterLayerSettings} - The updated ClusterLayerSettings object with the newly set 'bbox' value.
1643
+ */
1644
+ setBbox(bbox) {
1645
+ return ClusterLayerSettings.copy({ ...this, bbox });
1646
+ }
1647
+ /**
1648
+ * Sets the style for the ClusterLayerSettings.
1649
+ *
1650
+ * @param {function} style - A function that takes an array of identified features as input and returns a Style or StyleFunction.
1651
+ *
1652
+ * @return {ClusterLayerSettings} - The updated ClusterLayerSettings object with the new style applied.
1653
+ */
1654
+ setStyle(style) {
1655
+ return ClusterLayerSettings.copy({ ...this, style });
1656
+ }
1657
+ /**
1658
+ * Checks if the current ClusterLayerSettings object is the same as the specified model.
1659
+ *
1660
+ * @param {ClusterLayerSettings} model - The model to compare with the current object.
1661
+ *
1662
+ * @return {boolean} - Returns true if the current ClusterLayerSettings object is the same as the specified model, otherwise false.
1663
+ */
1664
+ isSame(model) {
1665
+ if (this.maxZoom !== model.maxZoom)
1666
+ return false;
1667
+ if (this.minZoom !== model.minZoom)
1668
+ return false;
1669
+ if (this.zIndex !== model.zIndex)
1670
+ return false;
1671
+ if (this.name !== model.name)
1672
+ return false;
1673
+ if (this.distance !== model.distance)
1674
+ return false;
1675
+ if (this.clusterCancel !== model.clusterCancel)
1676
+ return false;
1677
+ if (this.bbox !== model.bbox)
1678
+ return false;
1679
+ if (this.style !== model.style)
1680
+ return false;
1681
+ return true;
1682
+ }
1683
+ }
1684
+
1685
+ class ClusterLayerManager {
1686
+ settings;
1687
+ layer;
1688
+ postboy;
1689
+ constructor(settings, layer, postboy) {
1690
+ this.settings = settings;
1691
+ this.layer = layer;
1692
+ this.postboy = postboy;
1693
+ this.observeClick();
1694
+ this.observeMapMovement();
1695
+ }
1696
+ observeMapMovement() {
1697
+ combineLatest([
1698
+ this.postboy.subscribe(MapMoveEndEvent.ID).pipe(auditTime(250)),
1699
+ this.postboy.subscribe(MapRenderedEvent.ID),
1700
+ ]).subscribe(([movement, renderEvent]) => {
1701
+ this.checkClusterNecessity(renderEvent.map);
1702
+ });
1703
+ }
1704
+ observeClick() {
1705
+ this.postboy.subscribe(MapClickEvent.ID).subscribe((m) => {
1706
+ if ((m.features[this.settings.name]?.length ?? 0) > 1) {
1707
+ this.postboy.fire(new FitToFeaturesCommand(m.features[this.settings.name], -1));
1708
+ }
1709
+ });
1710
+ }
1711
+ checkClusterNecessity(map) {
1712
+ let zoom = map.getView().getZoom() ?? 0;
1713
+ const distance = zoom > this.settings.clusterCancel ? 0 : this.settings.distance;
1714
+ this.layer?.getSource()?.setDistance(distance);
1715
+ }
1716
+ }
1717
+
1718
+ class ClusterLayerFactory {
1719
+ build(settings, postboy) {
1720
+ const source = new Vector({
1721
+ strategy: settings.bbox ? bbox : undefined,
1722
+ });
1723
+ const cluster = new Cluster({
1724
+ distance: settings.distance,
1725
+ source: source,
1726
+ geometryFunction: (feature) => {
1727
+ const geom = feature.getGeometry();
1728
+ if (geom?.getType() == 'Point') {
1729
+ return geom;
1730
+ }
1731
+ else if (geom?.getType() == 'Polygon') {
1732
+ return geom?.getInteriorPoint();
1733
+ }
1734
+ else if (geom?.getType() == 'MultiPolygon') {
1735
+ return fromExtent(geom.getExtent())?.getInteriorPoint();
1736
+ }
1737
+ return undefined;
1738
+ },
1739
+ });
1740
+ const layer = new Vector$1({
1741
+ source: cluster,
1742
+ maxZoom: settings.maxZoom || undefined,
1743
+ minZoom: settings.minZoom || undefined,
1744
+ zIndex: settings.zIndex || 0,
1745
+ });
1746
+ layer.setStyle(this.styleFunc(settings));
1747
+ layer.set('name', settings.name);
1748
+ return new ClusterLayerManager(settings, layer, postboy);
1749
+ }
1750
+ styleFunc(settings) {
1751
+ return (feature) => {
1752
+ const features = feature.get('features');
1753
+ if (!settings.style)
1754
+ return undefined;
1755
+ return settings.style(features.map((f) => ({ id: f.getId(), ...f.get(MapConstants.FeatureInfo) })));
1756
+ };
1757
+ }
1758
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1759
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, providedIn: 'root' });
1760
+ }
1761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerFactory, decorators: [{
1762
+ type: Injectable,
1763
+ args: [{
1764
+ providedIn: 'root',
1765
+ }]
1766
1766
  }] });
1767
1767
 
1768
- /**
1769
- * Represents a cluster layer component.
1770
- */
1771
- class ClusterLayerComponent extends DestructibleComponent {
1772
- postboy;
1773
- factory;
1774
- manager = null;
1775
- constructor(postboy, factory) {
1776
- super();
1777
- this.postboy = postboy;
1778
- this.factory = factory;
1779
- }
1780
- _settings = new ClusterLayerSettings();
1781
- /**
1782
- * Sets the settings for the cluster layer.
1783
- *
1784
- * @param {ClusterLayerSettings | undefined} value - The settings for the cluster layer.
1785
- */
1786
- set settings(value) {
1787
- if (!value || this._settings.isSame(value))
1788
- return;
1789
- this._settings = value;
1790
- this.initLayer();
1791
- }
1792
- ngOnInit() {
1793
- this.postboy
1794
- .subscribe(MapRenderedEvent.ID)
1795
- .pipe(filter((m) => !!m), first())
1796
- .subscribe((m) => this.initLayer());
1797
- }
1798
- onDestroy = () => this.removeLayer();
1799
- initLayer() {
1800
- this.removeLayer();
1801
- this.manager = this.factory.build(this._settings, this.postboy);
1802
- this.postboy.fire(new AddLayerCommand(this.manager.layer));
1803
- }
1804
- removeLayer() {
1805
- if (this.manager?.layer)
1806
- this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
1807
- }
1808
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1809
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ClusterLayerComponent, selector: "art-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1810
- }
1811
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ClusterLayerComponent, decorators: [{
1812
- type: Component,
1813
- args: [{ selector: 'art-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1814
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: ClusterLayerFactory }]; }, propDecorators: { settings: [{
1815
- type: Input
1768
+ /**
1769
+ * Represents a cluster layer component.
1770
+ */
1771
+ class ClusterLayerComponent extends DestructibleComponent {
1772
+ postboy;
1773
+ factory;
1774
+ manager = null;
1775
+ constructor(postboy, factory) {
1776
+ super();
1777
+ this.postboy = postboy;
1778
+ this.factory = factory;
1779
+ }
1780
+ _settings = new ClusterLayerSettings();
1781
+ /**
1782
+ * Sets the settings for the cluster layer.
1783
+ *
1784
+ * @param {ClusterLayerSettings | undefined} value - The settings for the cluster layer.
1785
+ */
1786
+ set settings(value) {
1787
+ if (!value || this._settings.isSame(value))
1788
+ return;
1789
+ this._settings = value;
1790
+ this.initLayer();
1791
+ }
1792
+ ngOnInit() {
1793
+ this.postboy
1794
+ .subscribe(MapRenderedEvent.ID)
1795
+ .pipe(filter((m) => !!m), first())
1796
+ .subscribe((m) => this.initLayer());
1797
+ }
1798
+ onDestroy = () => this.removeLayer();
1799
+ initLayer() {
1800
+ this.removeLayer();
1801
+ this.manager = this.factory.build(this._settings, this.postboy);
1802
+ this.postboy.fire(new AddLayerCommand(this.manager.layer));
1803
+ }
1804
+ removeLayer() {
1805
+ if (this.manager?.layer)
1806
+ this.postboy.fire(new RemoveLayerCommand(this.manager.layer));
1807
+ }
1808
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerComponent, deps: [{ token: MapPostboyService }, { token: ClusterLayerFactory }], target: i0.ɵɵFactoryTarget.Component });
1809
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: ClusterLayerComponent, selector: "art-cluster-layer", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1810
+ }
1811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: ClusterLayerComponent, decorators: [{
1812
+ type: Component,
1813
+ args: [{ selector: 'art-cluster-layer', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1814
+ }], ctorParameters: () => [{ type: MapPostboyService }, { type: ClusterLayerFactory }], propDecorators: { settings: [{
1815
+ type: Input
1816
1816
  }] } });
1817
1817
 
1818
- class MapPlateFactory {
1819
- build(settings) {
1820
- return new Map({
1821
- controls: [],
1822
- view: new View({
1823
- center: settings?.center || [0, 0],
1824
- zoom: settings?.zoom || 4,
1825
- minZoom: settings?.minZoom || 0,
1826
- maxZoom: settings?.maxZoom || 19,
1827
- }),
1828
- layers: [],
1829
- });
1830
- }
1831
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1832
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
1833
- }
1834
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateFactory, decorators: [{
1835
- type: Injectable,
1836
- args: [{
1837
- providedIn: 'root',
1838
- }]
1818
+ class MapPlateFactory {
1819
+ build(settings) {
1820
+ return new Map({
1821
+ controls: [],
1822
+ view: new View({
1823
+ center: settings?.center || [0, 0],
1824
+ zoom: settings?.zoom || 4,
1825
+ minZoom: settings?.minZoom || 0,
1826
+ maxZoom: settings?.maxZoom || 19,
1827
+ }),
1828
+ layers: [],
1829
+ });
1830
+ }
1831
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1832
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, providedIn: 'root' });
1833
+ }
1834
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateFactory, decorators: [{
1835
+ type: Injectable,
1836
+ args: [{
1837
+ providedIn: 'root',
1838
+ }]
1839
1839
  }] });
1840
1840
 
1841
- class MapPlateComponent extends DestructibleComponent {
1842
- elementRef;
1843
- postboy;
1844
- mapFactory;
1845
- registrator;
1846
- detector;
1847
- map;
1848
- osmUrl = '';
1849
- drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
1850
- constructor(elementRef, postboy, mapFactory, registrator, detector) {
1851
- super();
1852
- this.elementRef = elementRef;
1853
- this.postboy = postboy;
1854
- this.mapFactory = mapFactory;
1855
- this.registrator = registrator;
1856
- this.detector = detector;
1857
- registrator.up();
1858
- }
1859
- _settings = new MapSettings();
1860
- set settings(value) {
1861
- if (!value || this._settings.isSame(value))
1862
- return;
1863
- this._settings = value;
1864
- this.setOsm();
1865
- }
1866
- ngOnInit() {
1867
- useGeographic();
1868
- this.map = this.mapFactory.build(this._settings);
1869
- this.map.setTarget(this.elementRef.nativeElement);
1870
- this.detector.detectChanges();
1871
- this.map.once('postrender', () => {
1872
- this.map.updateSize();
1873
- this.postboy.fire(new MapRenderedEvent(this.map));
1874
- });
1875
- this.setOsm();
1876
- }
1877
- onDestroy = () => {
1878
- this.registrator.down();
1879
- };
1880
- setOsm() {
1881
- if (!this.map)
1882
- return;
1883
- this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
1884
- this.detector.detectChanges();
1885
- this.map.updateSize();
1886
- }
1887
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1888
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapPlateComponent, selector: "art-map-plate", inputs: { settings: "settings" }, providers: [
1889
- MessageRegistratorService,
1890
- MapStateService,
1891
- MapManagementService,
1892
- MapClickService,
1893
- MapFeatureService,
1894
- DrawingService,
1895
- DrawingGenerationService,
1896
- FeatureService,
1897
- FeatureModificationService,
1898
- ControlsService,
1899
- ], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1900
- }
1901
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapPlateComponent, decorators: [{
1902
- type: Component,
1903
- args: [{ selector: 'art-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1904
- MessageRegistratorService,
1905
- MapStateService,
1906
- MapManagementService,
1907
- MapClickService,
1908
- MapFeatureService,
1909
- DrawingService,
1910
- DrawingGenerationService,
1911
- FeatureService,
1912
- FeatureModificationService,
1913
- ControlsService,
1914
- ], template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
1915
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { settings: [{
1916
- type: Input
1841
+ class MapPlateComponent extends DestructibleComponent {
1842
+ elementRef;
1843
+ postboy;
1844
+ mapFactory;
1845
+ registrator;
1846
+ detector;
1847
+ map;
1848
+ osmUrl = '';
1849
+ drawingLayerSettings = new FeatureLayerSettings().setName(MapConstants.DrawingLayerId);
1850
+ constructor(elementRef, postboy, mapFactory, registrator, detector) {
1851
+ super();
1852
+ this.elementRef = elementRef;
1853
+ this.postboy = postboy;
1854
+ this.mapFactory = mapFactory;
1855
+ this.registrator = registrator;
1856
+ this.detector = detector;
1857
+ registrator.up();
1858
+ }
1859
+ _settings = new MapSettings();
1860
+ set settings(value) {
1861
+ if (!value || this._settings.isSame(value))
1862
+ return;
1863
+ this._settings = value;
1864
+ this.setOsm();
1865
+ }
1866
+ ngOnInit() {
1867
+ useGeographic();
1868
+ this.map = this.mapFactory.build(this._settings);
1869
+ this.map.setTarget(this.elementRef.nativeElement);
1870
+ this.detector.detectChanges();
1871
+ this.map.once('postrender', () => {
1872
+ this.map.updateSize();
1873
+ this.postboy.fire(new MapRenderedEvent(this.map));
1874
+ });
1875
+ this.setOsm();
1876
+ }
1877
+ onDestroy = () => {
1878
+ this.registrator.down();
1879
+ };
1880
+ setOsm() {
1881
+ if (!this.map)
1882
+ return;
1883
+ this.osmUrl = `https://mt{0-3}.google.com/vt/lyrs=${MapLyrsLabel.get(this._settings.lyrs)}&hl=${this._settings.language}&x={x}&y={y}&z={z}`;
1884
+ this.detector.detectChanges();
1885
+ this.map.updateSize();
1886
+ }
1887
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateComponent, deps: [{ token: i0.ElementRef }, { token: MapPostboyService }, { token: MapPlateFactory }, { token: MessageRegistratorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1888
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapPlateComponent, selector: "art-map-plate", inputs: { settings: "settings" }, providers: [
1889
+ MessageRegistratorService,
1890
+ MapStateService,
1891
+ MapManagementService,
1892
+ MapClickService,
1893
+ MapFeatureService,
1894
+ DrawingService,
1895
+ DrawingGenerationService,
1896
+ FeatureService,
1897
+ FeatureModificationService,
1898
+ ControlsService,
1899
+ ], usesInheritance: true, ngImport: i0, template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: OsmTileLayerComponent, selector: "art-osm-tile-layer", inputs: ["url", "map"] }, { kind: "component", type: FeatureLayerComponent, selector: "art-feature-layer", inputs: ["settings"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1900
+ }
1901
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapPlateComponent, decorators: [{
1902
+ type: Component,
1903
+ args: [{ selector: 'art-map-plate', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
1904
+ MessageRegistratorService,
1905
+ MapStateService,
1906
+ MapManagementService,
1907
+ MapClickService,
1908
+ MapFeatureService,
1909
+ DrawingService,
1910
+ DrawingGenerationService,
1911
+ FeatureService,
1912
+ FeatureModificationService,
1913
+ ControlsService,
1914
+ ], template: "<ng-content></ng-content>\r\n<art-osm-tile-layer *ngIf=\"osmUrl && map\" [map]=\"map\" [url]=\"osmUrl\"></art-osm-tile-layer>\r\n<art-feature-layer *ngIf=\"map\" [settings]=\"drawingLayerSettings\"></art-feature-layer>\r\n", styles: ["art-map-plate{position:relative;display:flex;flex-direction:column;height:100%}\n"] }]
1915
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: MapPostboyService }, { type: MapPlateFactory }, { type: MessageRegistratorService }, { type: i0.ChangeDetectorRef }], propDecorators: { settings: [{
1916
+ type: Input
1917
1917
  }] } });
1918
1918
 
1919
- /**
1920
- * MarkersComponent is a component that displays markers on a map.
1921
- * It listens for changes in the `markers` input property and
1922
- * automatically puts the markers on the map using the MapPostboyService.
1923
- */
1924
- class MarkersComponent extends DestructibleComponent {
1925
- postboy;
1926
- layerName = '';
1927
- constructor(postboy) {
1928
- super();
1929
- this.postboy = postboy;
1930
- }
1931
- _markers = [];
1932
- /**
1933
- * Sets the markers property.
1934
- *
1935
- * @param {MarkerModel[]} value - The array of MarkerModel objects to set as markers.
1936
- */
1937
- set markers(value) {
1938
- this._markers = value ?? [];
1939
- this.putMarkers();
1940
- }
1941
- ngOnInit() {
1942
- this.postboy
1943
- .subscribe(MapRenderedEvent.ID)
1944
- .pipe(filter((m) => !!m), first())
1945
- .subscribe(() => this.putMarkers());
1946
- }
1947
- putMarkers() {
1948
- if (!this._markers)
1949
- return;
1950
- this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
1951
- }
1952
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
1953
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MarkersComponent, selector: "art-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1954
- }
1955
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MarkersComponent, decorators: [{
1956
- type: Component,
1957
- args: [{ selector: 'art-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1958
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
1959
- type: Input
1960
- }], markers: [{
1961
- type: Input
1919
+ /**
1920
+ * MarkersComponent is a component that displays markers on a map.
1921
+ * It listens for changes in the `markers` input property and
1922
+ * automatically puts the markers on the map using the MapPostboyService.
1923
+ */
1924
+ class MarkersComponent extends DestructibleComponent {
1925
+ postboy;
1926
+ layerName = '';
1927
+ constructor(postboy) {
1928
+ super();
1929
+ this.postboy = postboy;
1930
+ }
1931
+ _markers = [];
1932
+ /**
1933
+ * Sets the markers property.
1934
+ *
1935
+ * @param {MarkerModel[]} value - The array of MarkerModel objects to set as markers.
1936
+ */
1937
+ set markers(value) {
1938
+ this._markers = value ?? [];
1939
+ this.putMarkers();
1940
+ }
1941
+ ngOnInit() {
1942
+ this.postboy
1943
+ .subscribe(MapRenderedEvent.ID)
1944
+ .pipe(filter((m) => !!m), first())
1945
+ .subscribe(() => this.putMarkers());
1946
+ }
1947
+ putMarkers() {
1948
+ if (!this._markers)
1949
+ return;
1950
+ this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._markers.map((m) => m.feature)));
1951
+ }
1952
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MarkersComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
1953
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MarkersComponent, selector: "art-markers", inputs: { layerName: "layerName", markers: "markers" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
1954
+ }
1955
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MarkersComponent, decorators: [{
1956
+ type: Component,
1957
+ args: [{ selector: 'art-markers', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
1958
+ }], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { layerName: [{
1959
+ type: Input
1960
+ }], markers: [{
1961
+ type: Input
1962
1962
  }] } });
1963
1963
 
1964
- class TooltipSettings {
1965
- id;
1966
- containerClass = 'custom-tooltip-class';
1967
- constructor(id) {
1968
- this.id = id ?? IdGenerator.get();
1969
- }
1970
- static copy(model) {
1971
- const result = new TooltipSettings(model.id);
1972
- result.show = model.show;
1973
- result.containerClass = model.containerClass;
1974
- return result;
1975
- }
1976
- show = (e) => true;
1977
- setShow(show) {
1978
- return TooltipSettings.copy({ ...this, show });
1979
- }
1980
- setClass(containerClass) {
1981
- return TooltipSettings.copy({ ...this, containerClass });
1982
- }
1983
- isSame(model) {
1984
- if (this.show !== model.show)
1985
- return false;
1986
- if (this.containerClass !== model.containerClass)
1987
- return false;
1988
- if (this.id !== model.id)
1989
- return false;
1990
- return true;
1991
- }
1992
- }
1993
-
1994
- class TooltipComponent extends DestructibleComponent {
1995
- postboy;
1996
- detector;
1997
- container;
1998
- overlay;
1999
- show = false;
2000
- map;
2001
- constructor(postboy, detector) {
2002
- super();
2003
- this.postboy = postboy;
2004
- this.detector = detector;
2005
- }
2006
- _settings = new TooltipSettings();
2007
- set settings(value) {
2008
- if (!value || this._settings.isSame(value))
2009
- return;
2010
- this._settings = value;
2011
- this.detector.detectChanges();
2012
- }
2013
- ngOnInit() {
2014
- this.subs.push(this.observeMapRender());
2015
- this.subs.push(this.observeMapClick());
2016
- this.subs.push(this.observeClose());
2017
- }
2018
- addOverlay(coordinates) {
2019
- this.removeOverlay();
2020
- this.overlay = new Overlay(this.options(coordinates));
2021
- this.map?.addOverlay(this.overlay);
2022
- this.show = true;
2023
- this.detector.detectChanges();
2024
- }
2025
- options = (coordinates) => {
2026
- return {
2027
- element: this.container?.nativeElement,
2028
- autoPan: false,
2029
- autoPanAnimation: { duration: 0 },
2030
- position: coordinates,
2031
- };
2032
- };
2033
- observeMapClick() {
2034
- return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
2035
- this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
2036
- });
2037
- }
2038
- observeClose() {
2039
- return this.postboy
2040
- .subscribe(CloseTooltipCommand.ID)
2041
- .pipe(filter((ev) => ev.tooltipId === this._settings.id))
2042
- .subscribe(() => this.removeOverlay());
2043
- }
2044
- observeMapRender() {
2045
- return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
2046
- this.map = m.map;
2047
- });
2048
- }
2049
- removeOverlay = () => {
2050
- !!this.overlay && this.map?.removeOverlay(this.overlay);
2051
- this.show = false;
2052
- };
2053
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2054
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TooltipComponent, selector: "art-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2055
- }
2056
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TooltipComponent, decorators: [{
2057
- type: Component,
2058
- args: [{ selector: 'art-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
2059
- }], ctorParameters: function () { return [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { container: [{
2060
- type: ViewChild,
2061
- args: ['tip']
2062
- }], settings: [{
2063
- type: Input
1964
+ class TooltipSettings {
1965
+ id;
1966
+ containerClass = 'custom-tooltip-class';
1967
+ constructor(id) {
1968
+ this.id = id ?? IdGenerator.get();
1969
+ }
1970
+ static copy(model) {
1971
+ const result = new TooltipSettings(model.id);
1972
+ result.show = model.show;
1973
+ result.containerClass = model.containerClass;
1974
+ return result;
1975
+ }
1976
+ show = (e) => true;
1977
+ setShow(show) {
1978
+ return TooltipSettings.copy({ ...this, show });
1979
+ }
1980
+ setClass(containerClass) {
1981
+ return TooltipSettings.copy({ ...this, containerClass });
1982
+ }
1983
+ isSame(model) {
1984
+ if (this.show !== model.show)
1985
+ return false;
1986
+ if (this.containerClass !== model.containerClass)
1987
+ return false;
1988
+ if (this.id !== model.id)
1989
+ return false;
1990
+ return true;
1991
+ }
1992
+ }
1993
+
1994
+ class TooltipComponent extends DestructibleComponent {
1995
+ postboy;
1996
+ detector;
1997
+ container;
1998
+ overlay;
1999
+ show = false;
2000
+ map;
2001
+ constructor(postboy, detector) {
2002
+ super();
2003
+ this.postboy = postboy;
2004
+ this.detector = detector;
2005
+ }
2006
+ _settings = new TooltipSettings();
2007
+ set settings(value) {
2008
+ if (!value || this._settings.isSame(value))
2009
+ return;
2010
+ this._settings = value;
2011
+ this.detector.detectChanges();
2012
+ }
2013
+ ngOnInit() {
2014
+ this.subs.push(this.observeMapRender());
2015
+ this.subs.push(this.observeMapClick());
2016
+ this.subs.push(this.observeClose());
2017
+ }
2018
+ addOverlay(coordinates) {
2019
+ this.removeOverlay();
2020
+ this.overlay = new Overlay(this.options(coordinates));
2021
+ this.map?.addOverlay(this.overlay);
2022
+ this.show = true;
2023
+ this.detector.detectChanges();
2024
+ }
2025
+ options = (coordinates) => {
2026
+ return {
2027
+ element: this.container?.nativeElement,
2028
+ autoPan: false,
2029
+ autoPanAnimation: { duration: 0 },
2030
+ position: coordinates,
2031
+ };
2032
+ };
2033
+ observeMapClick() {
2034
+ return this.postboy.subscribe(MapClickEvent.ID).subscribe((ev) => {
2035
+ this._settings.show(ev) ? this.addOverlay(ev.coordinates) : this.removeOverlay();
2036
+ });
2037
+ }
2038
+ observeClose() {
2039
+ return this.postboy
2040
+ .subscribe(CloseTooltipCommand.ID)
2041
+ .pipe(filter((ev) => ev.tooltipId === this._settings.id))
2042
+ .subscribe(() => this.removeOverlay());
2043
+ }
2044
+ observeMapRender() {
2045
+ return this.postboy.subscribe(MapRenderedEvent.ID).subscribe((m) => {
2046
+ this.map = m.map;
2047
+ });
2048
+ }
2049
+ removeOverlay = () => {
2050
+ !!this.overlay && this.map?.removeOverlay(this.overlay);
2051
+ this.show = false;
2052
+ };
2053
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TooltipComponent, deps: [{ token: MapPostboyService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2054
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: TooltipComponent, selector: "art-tooltip", inputs: { settings: "settings" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["tip"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2055
+ }
2056
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: TooltipComponent, decorators: [{
2057
+ type: Component,
2058
+ args: [{ selector: 'art-tooltip', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div #tip [class]=\"['tooltip-wrapper', _settings.containerClass]\" [hidden]=\"!show\">\r\n <ng-content></ng-content>\r\n</div>\r\n", styles: [".tooltip-wrapper{position:absolute}\n"] }]
2059
+ }], ctorParameters: () => [{ type: MapPostboyService }, { type: i0.ChangeDetectorRef }], propDecorators: { container: [{
2060
+ type: ViewChild,
2061
+ args: ['tip']
2062
+ }], settings: [{
2063
+ type: Input
2064
2064
  }] } });
2065
2065
 
2066
- /**
2067
- * Component for rendering polygons on a map.
2068
- * It listens for changes in the `polygons` input property and
2069
- * automatically puts the polygons on the map using the MapPostboyService.
2070
- */
2071
- class PolygonsComponent extends DestructibleComponent {
2072
- postboy;
2073
- layerName = '';
2074
- constructor(postboy) {
2075
- super();
2076
- this.postboy = postboy;
2077
- }
2078
- _polygons = [];
2079
- /**
2080
- * Sets the value of polygons.
2081
- *
2082
- * @param {PolygonModel[]} value - The new value for polygons.
2083
- */
2084
- set polygons(value) {
2085
- this._polygons = value ?? [];
2086
- this.putPolygons();
2087
- }
2088
- ngOnInit() {
2089
- this.postboy
2090
- .subscribe(MapRenderedEvent.ID)
2091
- .pipe(filter((m) => !!m), first())
2092
- .subscribe(() => this.putPolygons());
2093
- }
2094
- putPolygons() {
2095
- if (!this._polygons)
2096
- return;
2097
- this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
2098
- }
2099
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
2100
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: PolygonsComponent, selector: "art-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2101
- }
2102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: PolygonsComponent, decorators: [{
2103
- type: Component,
2104
- args: [{ selector: 'art-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2105
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { layerName: [{
2106
- type: Input
2107
- }], polygons: [{
2108
- type: Input
2066
+ /**
2067
+ * Component for rendering polygons on a map.
2068
+ * It listens for changes in the `polygons` input property and
2069
+ * automatically puts the polygons on the map using the MapPostboyService.
2070
+ */
2071
+ class PolygonsComponent extends DestructibleComponent {
2072
+ postboy;
2073
+ layerName = '';
2074
+ constructor(postboy) {
2075
+ super();
2076
+ this.postboy = postboy;
2077
+ }
2078
+ _polygons = [];
2079
+ /**
2080
+ * Sets the value of polygons.
2081
+ *
2082
+ * @param {PolygonModel[]} value - The new value for polygons.
2083
+ */
2084
+ set polygons(value) {
2085
+ this._polygons = value ?? [];
2086
+ this.putPolygons();
2087
+ }
2088
+ ngOnInit() {
2089
+ this.postboy
2090
+ .subscribe(MapRenderedEvent.ID)
2091
+ .pipe(filter((m) => !!m), first())
2092
+ .subscribe(() => this.putPolygons());
2093
+ }
2094
+ putPolygons() {
2095
+ if (!this._polygons)
2096
+ return;
2097
+ this.postboy.fire(new PlaceLayerFeaturesCommand(this.layerName, this._polygons.map((m) => m.feature)));
2098
+ }
2099
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: PolygonsComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
2100
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: PolygonsComponent, selector: "art-polygons", inputs: { layerName: "layerName", polygons: "polygons" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2101
+ }
2102
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: PolygonsComponent, decorators: [{
2103
+ type: Component,
2104
+ args: [{ selector: 'art-polygons', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2105
+ }], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { layerName: [{
2106
+ type: Input
2107
+ }], polygons: [{
2108
+ type: Input
2109
2109
  }] } });
2110
2110
 
2111
- /**
2112
- * Represents the settings for a zoom control.
2113
- */
2114
- class ZoomControlSettings {
2115
- /**
2116
- * The CSS class name of the control element.
2117
- *
2118
- * @type {string}
2119
- */
2120
- controlClass = 'ol-zoom';
2121
- /**
2122
- * The CSS class name for zoom in button.
2123
- * @type {string}
2124
- */
2125
- zoomInClass = 'ol-zoom-in';
2126
- /**
2127
- * The CSS class name for the zoom out button element.
2128
- *
2129
- * @type {string}
2130
- */
2131
- zoomOutClass = 'ol-zoom-out';
2132
- /**
2133
- * The label for the zoom in action.
2134
- *
2135
- * @type {string}
2136
- */
2137
- zoomInLabel = 'Zoom In';
2138
- /**
2139
- * The label for the zoom out control.
2140
- *
2141
- * @type {string}
2142
- */
2143
- zoomOutLabel = 'Zoom Out';
2144
- /**
2145
- * Copies the provided ZoomControlSettings object.
2146
- *
2147
- * @param {ZoomControlSettings} model - The ZoomControlSettings object to be copied.
2148
- * @return {ZoomControlSettings} - The copied ZoomControlSettings object.
2149
- */
2150
- static copy(model) {
2151
- const result = new ZoomControlSettings();
2152
- result.controlClass = model.controlClass;
2153
- result.zoomInClass = model.zoomInClass;
2154
- result.zoomOutClass = model.zoomOutClass;
2155
- result.zoomInLabel = model.zoomInLabel;
2156
- result.zoomOutLabel = model.zoomOutLabel;
2157
- return result;
2158
- }
2159
- /**
2160
- * Checks if the current ZoomControlSettings object is equal to the given model.
2161
- *
2162
- * @param {ZoomControlSettings} model - The ZoomControlSettings object to compare with.
2163
- *
2164
- * @return {boolean} - true if the current object is equal to the given model, false otherwise.
2165
- */
2166
- isSame(model) {
2167
- if (this.zoomInClass !== model.zoomInClass)
2168
- return false;
2169
- if (this.zoomOutClass !== model.zoomOutClass)
2170
- return false;
2171
- if (this.zoomInLabel !== model.zoomInLabel)
2172
- return false;
2173
- if (this.controlClass !== model.controlClass)
2174
- return false;
2175
- if (this.zoomOutLabel !== model.zoomOutLabel)
2176
- return false;
2177
- return true;
2178
- }
2179
- /**
2180
- * Sets the zoom in label of the Zoom Control Settings.
2181
- *
2182
- * @param {string} zoomInLabel - The label for the zoom in button.
2183
- * @return {ZoomControlSettings} - The new Zoom Control Settings object with the updated zoom in label.
2184
- */
2185
- setZoomInLabel(zoomInLabel) {
2186
- return ZoomControlSettings.copy({ ...this, zoomInLabel });
2187
- }
2188
- /**
2189
- * Sets the zoomOutClass property of the ZoomControlSettings object.
2190
- *
2191
- * @param {string} zoomOutClass - The CSS class to be assigned to the zoom out button.
2192
- * @return {ZoomControlSettings} - The updated ZoomControlSettings object with the new zoomOutClass value.
2193
- */
2194
- setZoomOutClass(zoomOutClass) {
2195
- return ZoomControlSettings.copy({ ...this, zoomOutClass });
2196
- }
2197
- /**
2198
- * Sets the zoom in class for the zoom control settings.
2199
- *
2200
- * @param {string} zoomInClass - The new zoom in class to be set.
2201
- * @return {ZoomControlSettings} - The updated zoom control settings.
2202
- */
2203
- setZoomInClass(zoomInClass) {
2204
- return ZoomControlSettings.copy({ ...this, zoomInClass });
2205
- }
2206
- /**
2207
- * Set the label for the zoom out control.
2208
- *
2209
- * @param {string} zoomOutLabel - The label for the zoom out control.
2210
- * @returns {ZoomControlSettings} - The updated zoom control settings.
2211
- */
2212
- setZoomOutLabel(zoomOutLabel) {
2213
- return ZoomControlSettings.copy({ ...this, zoomOutLabel });
2214
- }
2215
- /**
2216
- * Sets the control class for the ZoomControlSettings.
2217
- *
2218
- * @param {string} controlClass - The class name of the control to be set.
2219
- *
2220
- * @return {ZoomControlSettings} - The modified ZoomControlSettings object.
2221
- */
2222
- setControlClass(controlClass) {
2223
- return ZoomControlSettings.copy({ ...this, controlClass });
2224
- }
2225
- }
2226
-
2227
- /**
2228
- * @class
2229
- * @classdesc Represents a component for the Zoom control on a map.
2230
- * @extends DestructibleComponent
2231
- * @implements OnInit
2232
- */
2233
- class MapControlZoomComponent extends DestructibleComponent {
2234
- postboy;
2235
- map;
2236
- control;
2237
- constructor(postboy) {
2238
- super();
2239
- this.postboy = postboy;
2240
- }
2241
- _settings = new ZoomControlSettings();
2242
- /**
2243
- * Sets the settings for the Zoom Control.
2244
- *
2245
- * @param {ZoomControlSettings | undefined} value - The new settings for the Zoom Control.
2246
- *
2247
- * @description
2248
- * This method sets the settings for the Zoom Control. It takes a parameter `value` which should be an object of type `ZoomControlSettings` or `undefined`.
2249
- *
2250
- * If the `value` is `undefined` or the same as the current settings, the method will return without making any changes.
2251
- *
2252
- */
2253
- set settings(value) {
2254
- if (!value || this._settings.isSame(value))
2255
- return;
2256
- this._settings = value;
2257
- this.setControl();
2258
- }
2259
- ngOnInit() {
2260
- this.postboy
2261
- .subscribe(MapRenderedEvent.ID)
2262
- .pipe(filter((m) => !!m), first())
2263
- .subscribe((m) => {
2264
- this.map = m.map;
2265
- this.setControl();
2266
- });
2267
- }
2268
- onDestroy = () => {
2269
- this.eliminate();
2270
- };
2271
- setControl() {
2272
- if (!this.map)
2273
- return;
2274
- this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
2275
- this.map.addControl(this.control);
2276
- }
2277
- eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
2278
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
2279
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MapControlZoomComponent, selector: "art-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2280
- }
2281
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapControlZoomComponent, decorators: [{
2282
- type: Component,
2283
- args: [{ selector: 'art-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2284
- }], ctorParameters: function () { return [{ type: MapPostboyService }]; }, propDecorators: { settings: [{
2285
- type: Input
2111
+ /**
2112
+ * Represents the settings for a zoom control.
2113
+ */
2114
+ class ZoomControlSettings {
2115
+ /**
2116
+ * The CSS class name of the control element.
2117
+ *
2118
+ * @type {string}
2119
+ */
2120
+ controlClass = 'ol-zoom';
2121
+ /**
2122
+ * The CSS class name for zoom in button.
2123
+ * @type {string}
2124
+ */
2125
+ zoomInClass = 'ol-zoom-in';
2126
+ /**
2127
+ * The CSS class name for the zoom out button element.
2128
+ *
2129
+ * @type {string}
2130
+ */
2131
+ zoomOutClass = 'ol-zoom-out';
2132
+ /**
2133
+ * The label for the zoom in action.
2134
+ *
2135
+ * @type {string}
2136
+ */
2137
+ zoomInLabel = 'Zoom In';
2138
+ /**
2139
+ * The label for the zoom out control.
2140
+ *
2141
+ * @type {string}
2142
+ */
2143
+ zoomOutLabel = 'Zoom Out';
2144
+ /**
2145
+ * Copies the provided ZoomControlSettings object.
2146
+ *
2147
+ * @param {ZoomControlSettings} model - The ZoomControlSettings object to be copied.
2148
+ * @return {ZoomControlSettings} - The copied ZoomControlSettings object.
2149
+ */
2150
+ static copy(model) {
2151
+ const result = new ZoomControlSettings();
2152
+ result.controlClass = model.controlClass;
2153
+ result.zoomInClass = model.zoomInClass;
2154
+ result.zoomOutClass = model.zoomOutClass;
2155
+ result.zoomInLabel = model.zoomInLabel;
2156
+ result.zoomOutLabel = model.zoomOutLabel;
2157
+ return result;
2158
+ }
2159
+ /**
2160
+ * Checks if the current ZoomControlSettings object is equal to the given model.
2161
+ *
2162
+ * @param {ZoomControlSettings} model - The ZoomControlSettings object to compare with.
2163
+ *
2164
+ * @return {boolean} - true if the current object is equal to the given model, false otherwise.
2165
+ */
2166
+ isSame(model) {
2167
+ if (this.zoomInClass !== model.zoomInClass)
2168
+ return false;
2169
+ if (this.zoomOutClass !== model.zoomOutClass)
2170
+ return false;
2171
+ if (this.zoomInLabel !== model.zoomInLabel)
2172
+ return false;
2173
+ if (this.controlClass !== model.controlClass)
2174
+ return false;
2175
+ if (this.zoomOutLabel !== model.zoomOutLabel)
2176
+ return false;
2177
+ return true;
2178
+ }
2179
+ /**
2180
+ * Sets the zoom in label of the Zoom Control Settings.
2181
+ *
2182
+ * @param {string} zoomInLabel - The label for the zoom in button.
2183
+ * @return {ZoomControlSettings} - The new Zoom Control Settings object with the updated zoom in label.
2184
+ */
2185
+ setZoomInLabel(zoomInLabel) {
2186
+ return ZoomControlSettings.copy({ ...this, zoomInLabel });
2187
+ }
2188
+ /**
2189
+ * Sets the zoomOutClass property of the ZoomControlSettings object.
2190
+ *
2191
+ * @param {string} zoomOutClass - The CSS class to be assigned to the zoom out button.
2192
+ * @return {ZoomControlSettings} - The updated ZoomControlSettings object with the new zoomOutClass value.
2193
+ */
2194
+ setZoomOutClass(zoomOutClass) {
2195
+ return ZoomControlSettings.copy({ ...this, zoomOutClass });
2196
+ }
2197
+ /**
2198
+ * Sets the zoom in class for the zoom control settings.
2199
+ *
2200
+ * @param {string} zoomInClass - The new zoom in class to be set.
2201
+ * @return {ZoomControlSettings} - The updated zoom control settings.
2202
+ */
2203
+ setZoomInClass(zoomInClass) {
2204
+ return ZoomControlSettings.copy({ ...this, zoomInClass });
2205
+ }
2206
+ /**
2207
+ * Set the label for the zoom out control.
2208
+ *
2209
+ * @param {string} zoomOutLabel - The label for the zoom out control.
2210
+ * @returns {ZoomControlSettings} - The updated zoom control settings.
2211
+ */
2212
+ setZoomOutLabel(zoomOutLabel) {
2213
+ return ZoomControlSettings.copy({ ...this, zoomOutLabel });
2214
+ }
2215
+ /**
2216
+ * Sets the control class for the ZoomControlSettings.
2217
+ *
2218
+ * @param {string} controlClass - The class name of the control to be set.
2219
+ *
2220
+ * @return {ZoomControlSettings} - The modified ZoomControlSettings object.
2221
+ */
2222
+ setControlClass(controlClass) {
2223
+ return ZoomControlSettings.copy({ ...this, controlClass });
2224
+ }
2225
+ }
2226
+
2227
+ /**
2228
+ * @class
2229
+ * @classdesc Represents a component for the Zoom control on a map.
2230
+ * @extends DestructibleComponent
2231
+ * @implements OnInit
2232
+ */
2233
+ class MapControlZoomComponent extends DestructibleComponent {
2234
+ postboy;
2235
+ map;
2236
+ control;
2237
+ constructor(postboy) {
2238
+ super();
2239
+ this.postboy = postboy;
2240
+ }
2241
+ _settings = new ZoomControlSettings();
2242
+ /**
2243
+ * Sets the settings for the Zoom Control.
2244
+ *
2245
+ * @param {ZoomControlSettings | undefined} value - The new settings for the Zoom Control.
2246
+ *
2247
+ * @description
2248
+ * This method sets the settings for the Zoom Control. It takes a parameter `value` which should be an object of type `ZoomControlSettings` or `undefined`.
2249
+ *
2250
+ * If the `value` is `undefined` or the same as the current settings, the method will return without making any changes.
2251
+ *
2252
+ */
2253
+ set settings(value) {
2254
+ if (!value || this._settings.isSame(value))
2255
+ return;
2256
+ this._settings = value;
2257
+ this.setControl();
2258
+ }
2259
+ ngOnInit() {
2260
+ this.postboy
2261
+ .subscribe(MapRenderedEvent.ID)
2262
+ .pipe(filter((m) => !!m), first())
2263
+ .subscribe((m) => {
2264
+ this.map = m.map;
2265
+ this.setControl();
2266
+ });
2267
+ }
2268
+ onDestroy = () => {
2269
+ this.eliminate();
2270
+ };
2271
+ setControl() {
2272
+ if (!this.map)
2273
+ return;
2274
+ this.control = this.postboy.execute(new GenerateZoomControlExecutor(this._settings));
2275
+ this.map.addControl(this.control);
2276
+ }
2277
+ eliminate = () => !!this.map && !!this.control && this.map.removeControl(this.control);
2278
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapControlZoomComponent, deps: [{ token: MapPostboyService }], target: i0.ɵɵFactoryTarget.Component });
2279
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.7", type: MapControlZoomComponent, selector: "art-map-control-zoom", inputs: { settings: "settings" }, usesInheritance: true, ngImport: i0, template: '', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2280
+ }
2281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapControlZoomComponent, decorators: [{
2282
+ type: Component,
2283
+ args: [{ selector: 'art-map-control-zoom', template: '', changeDetection: ChangeDetectionStrategy.OnPush }]
2284
+ }], ctorParameters: () => [{ type: MapPostboyService }], propDecorators: { settings: [{
2285
+ type: Input
2286
2286
  }] } });
2287
2287
 
2288
- class MapModule {
2289
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2290
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
2291
- MapPlateComponent,
2292
- TileLayerComponent,
2293
- OsmTileLayerComponent,
2294
- FeatureLayerComponent,
2295
- MarkersComponent,
2296
- TooltipComponent,
2297
- PolygonsComponent,
2298
- ClusterLayerComponent,
2299
- MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
2300
- FeatureLayerComponent,
2301
- MarkersComponent,
2302
- TileLayerComponent,
2303
- TooltipComponent,
2304
- PolygonsComponent,
2305
- ClusterLayerComponent,
2306
- MapControlZoomComponent] });
2307
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, imports: [CommonModule] });
2308
- }
2309
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MapModule, decorators: [{
2310
- type: NgModule,
2311
- args: [{
2312
- imports: [CommonModule],
2313
- declarations: [
2314
- DestructibleComponent,
2315
- MapPlateComponent,
2316
- TileLayerComponent,
2317
- OsmTileLayerComponent,
2318
- FeatureLayerComponent,
2319
- MarkersComponent,
2320
- TooltipComponent,
2321
- PolygonsComponent,
2322
- ClusterLayerComponent,
2323
- MapControlZoomComponent,
2324
- ],
2325
- exports: [
2326
- MapPlateComponent,
2327
- FeatureLayerComponent,
2328
- MarkersComponent,
2329
- TileLayerComponent,
2330
- TooltipComponent,
2331
- PolygonsComponent,
2332
- ClusterLayerComponent,
2333
- MapControlZoomComponent,
2334
- ],
2335
- }]
2288
+ class MapModule {
2289
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2290
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: MapModule, declarations: [DestructibleComponent,
2291
+ MapPlateComponent,
2292
+ TileLayerComponent,
2293
+ OsmTileLayerComponent,
2294
+ FeatureLayerComponent,
2295
+ MarkersComponent,
2296
+ TooltipComponent,
2297
+ PolygonsComponent,
2298
+ ClusterLayerComponent,
2299
+ MapControlZoomComponent], imports: [CommonModule], exports: [MapPlateComponent,
2300
+ FeatureLayerComponent,
2301
+ MarkersComponent,
2302
+ TileLayerComponent,
2303
+ TooltipComponent,
2304
+ PolygonsComponent,
2305
+ ClusterLayerComponent,
2306
+ MapControlZoomComponent] });
2307
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, imports: [CommonModule] });
2308
+ }
2309
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: MapModule, decorators: [{
2310
+ type: NgModule,
2311
+ args: [{
2312
+ imports: [CommonModule],
2313
+ declarations: [
2314
+ DestructibleComponent,
2315
+ MapPlateComponent,
2316
+ TileLayerComponent,
2317
+ OsmTileLayerComponent,
2318
+ FeatureLayerComponent,
2319
+ MarkersComponent,
2320
+ TooltipComponent,
2321
+ PolygonsComponent,
2322
+ ClusterLayerComponent,
2323
+ MapControlZoomComponent,
2324
+ ],
2325
+ exports: [
2326
+ MapPlateComponent,
2327
+ FeatureLayerComponent,
2328
+ MarkersComponent,
2329
+ TileLayerComponent,
2330
+ TooltipComponent,
2331
+ PolygonsComponent,
2332
+ ClusterLayerComponent,
2333
+ MapControlZoomComponent,
2334
+ ],
2335
+ }]
2336
2336
  }] });
2337
2337
 
2338
- /**
2339
- * Helper class to create and modify marker styles.
2340
- */
2341
- class MarkerStyleHelper {
2342
- /**
2343
- * Creates a new Style object from an SVG.
2344
- * @param {string} svg - The SVG string.
2345
- * @param {Array<number>} [size=[30, 30]] - The size of the icon image.
2346
- * @param {number} [zIndex=400] - The zIndex of the style.
2347
- * @returns {Style} A new Style object.
2348
- */
2349
- static fromSvg(svg, size = [30, 30], zIndex = 400) {
2350
- let image = new Image();
2351
- image.src = 'data:image/svg+xml,' + escape(svg);
2352
- return new Style({
2353
- image: new Icon({
2354
- img: image,
2355
- imgSize: size,
2356
- }),
2357
- zIndex,
2358
- });
2359
- }
2360
- /**
2361
- * Returns a Style object with a circle style.
2362
- *
2363
- * @param {number} radius - The radius of the circle.
2364
- * @param {string} fill - The fill color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2365
- * @param {string} strokeColor - The stroke color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2366
- * @param {number} [strokeWidth=1] - The width of the stroke. Default is 1.
2367
- * @returns {Style} - A Style object with a Circle image.
2368
- */
2369
- static circle(radius, fill, strokeColor, strokeWidth = 1) {
2370
- return new Style({
2371
- image: new Circle({
2372
- radius,
2373
- fill: new Fill({ color: fill }),
2374
- stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
2375
- }),
2376
- });
2377
- }
2378
- /**
2379
- * Applies the given Text to the provided Style.
2380
- *
2381
- * @param {Style} style - The Style to modify.
2382
- * @param {Text} text - The Text to apply to the Style.
2383
- * @return {Style} - The modified Style with the applied Text.
2384
- */
2385
- static withText(style, text) {
2386
- style.setText(text);
2387
- return style;
2388
- }
2389
- }
2390
-
2391
- /**
2392
- * A helper class for creating polygon styles.
2393
- * @class
2394
- */
2395
- class PolygonStyleHelper {
2396
- /**
2397
- * Creates a Style object with the given fill color, stroke color, and stroke width.
2398
- *
2399
- * @param {string} fill - The fill color in hexadecimal or RGB format.
2400
- * @param {string} stroke - The stroke color in hexadecimal or RGB format.
2401
- * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2402
- * @return {Style} The created Style object.
2403
- */
2404
- static simple(fill, stroke, strokeWidth = 1) {
2405
- return new Style({
2406
- fill: new Fill({
2407
- color: fill,
2408
- }),
2409
- stroke: new Stroke({
2410
- color: stroke,
2411
- width: strokeWidth,
2412
- }),
2413
- });
2414
- }
2415
- /**
2416
- * Creates a new Style object with the given fill, stroke, stroke width, and pin radius.
2417
- *
2418
- * @param {string} fill - The color to use for the fill of the style.
2419
- * @param {string} stroke - The color to use for the stroke of the style.
2420
- * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2421
- * @param {number} [pinRadius=5] - The radius of the circle used as the image for the style. Defaults to 5.
2422
- * @returns {Style} - The newly created Style object.
2423
- */
2424
- static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2425
- return new Style({
2426
- image: new Circle({
2427
- fill: new Fill({
2428
- color: stroke,
2429
- }),
2430
- radius: pinRadius,
2431
- }),
2432
- fill: new Fill({
2433
- color: fill,
2434
- }),
2435
- stroke: new Stroke({
2436
- color: stroke,
2437
- width: strokeWidth,
2438
- }),
2439
- });
2440
- }
2441
- }
2442
-
2443
- /**
2444
- * Helper class for creating text styles.
2445
- */
2446
- class TextStyleHelper {
2447
- /**
2448
- * Creates a new instance of the Text class with the specified properties.
2449
- *
2450
- * @param {string} text - The text content of the Text object.
2451
- * @param {string} font - The font style of the Text object.
2452
- * @param {string} color - The color of the Text object.
2453
- * @return {Text} A new instance of the Text class.
2454
- */
2455
- static get(text, font, color) {
2456
- return new Text({
2457
- text: text,
2458
- font: font,
2459
- textAlign: 'center',
2460
- fill: new Fill({
2461
- color: color,
2462
- }),
2463
- });
2464
- }
2465
- }
2466
-
2467
- /**
2468
- * A helper class for converting and stringify features.
2469
- */
2470
- class StringifyFeatureHelper {
2471
- static polygon(feature, format = FeatureOutputFormat.GeoJson) {
2472
- return format === FeatureOutputFormat.GeoJson
2473
- ? new GeoJSON().writeFeature(feature)
2474
- : new WKT().writeFeature(feature);
2475
- }
2476
- /**
2477
- * Creates a polygon feature representing a circle based on a given feature with a circle geometry.
2478
- *
2479
- * @param {Feature<Geometry>} feature - The input feature with a circle geometry.
2480
- * @param {FeatureOutputFormat} format - The format for outputting the polygon feature. (default: FeatureOutputFormat.GeoJson)
2481
- *
2482
- * @return {string} - The string representation of the polygon feature.
2483
- */
2484
- static circle(feature, format = FeatureOutputFormat.GeoJson) {
2485
- const circle = feature.getGeometry();
2486
- const ext = feature.getGeometry().getExtent();
2487
- const coords = [
2488
- ...transform([ext[0], ext[1]], 'EPSG:4326', 'EPSG:3857'),
2489
- ...transform([ext[2], ext[3]], 'EPSG:4326', 'EPSG:3857'),
2490
- ];
2491
- const radius = (coords[2] - coords[0]) / 2;
2492
- const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
2493
- return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
2494
- }
2495
- /**
2496
- * Draw a circle based on a center point and radius.
2497
- *
2498
- * @param {number[]} point - The center point coordinates in EPSG:4326 format.
2499
- * @param {number} radius - The radius of the circle in meters.
2500
- * @return {Coordinate[][]} - The coordinates of the circle boundary in EPSG:4326 format.
2501
- */
2502
- static drawCircle(point, radius) {
2503
- const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
2504
- // const tetetemp = point;
2505
- const radians = Math.PI / 180; // degrees to radians
2506
- const degrees = 180 / Math.PI; // radians to degrees
2507
- const earthsradius = 6378137.0;
2508
- const rlat = (radius / earthsradius) * degrees;
2509
- const rlng = rlat / Math.cos(tetetemp[1] * radians);
2510
- const extp = [];
2511
- for (let i = 0; i <= 32; i++) {
2512
- const theta = Math.PI * (i / 16);
2513
- extp.push([
2514
- tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
2515
- tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
2516
- ]);
2517
- }
2518
- return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
2519
- }
2520
- }
2521
-
2522
- /*
2523
- * Public API Surface of maps
2338
+ /**
2339
+ * Helper class to create and modify marker styles.
2340
+ */
2341
+ class MarkerStyleHelper {
2342
+ /**
2343
+ * Creates a new Style object from an SVG.
2344
+ * @param {string} svg - The SVG string.
2345
+ * @param {Array<number>} [size=[30, 30]] - The size of the icon image.
2346
+ * @param {number} [zIndex=400] - The zIndex of the style.
2347
+ * @returns {Style} A new Style object.
2348
+ */
2349
+ static fromSvg(svg, size = [30, 30], zIndex = 400) {
2350
+ let image = new Image();
2351
+ image.src = 'data:image/svg+xml,' + escape(svg);
2352
+ return new Style({
2353
+ image: new Icon({
2354
+ img: image,
2355
+ imgSize: size,
2356
+ }),
2357
+ zIndex,
2358
+ });
2359
+ }
2360
+ /**
2361
+ * Returns a Style object with a circle style.
2362
+ *
2363
+ * @param {number} radius - The radius of the circle.
2364
+ * @param {string} fill - The fill color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2365
+ * @param {string} strokeColor - The stroke color of the circle. Format: '#RRGGBB' or 'rgba(R, G, B, A)'.
2366
+ * @param {number} [strokeWidth=1] - The width of the stroke. Default is 1.
2367
+ * @returns {Style} - A Style object with a Circle image.
2368
+ */
2369
+ static circle(radius, fill, strokeColor, strokeWidth = 1) {
2370
+ return new Style({
2371
+ image: new Circle({
2372
+ radius,
2373
+ fill: new Fill({ color: fill }),
2374
+ stroke: new Stroke({ color: strokeColor, width: strokeWidth }),
2375
+ }),
2376
+ });
2377
+ }
2378
+ /**
2379
+ * Applies the given Text to the provided Style.
2380
+ *
2381
+ * @param {Style} style - The Style to modify.
2382
+ * @param {Text} text - The Text to apply to the Style.
2383
+ * @return {Style} - The modified Style with the applied Text.
2384
+ */
2385
+ static withText(style, text) {
2386
+ style.setText(text);
2387
+ return style;
2388
+ }
2389
+ }
2390
+
2391
+ /**
2392
+ * A helper class for creating polygon styles.
2393
+ * @class
2394
+ */
2395
+ class PolygonStyleHelper {
2396
+ /**
2397
+ * Creates a Style object with the given fill color, stroke color, and stroke width.
2398
+ *
2399
+ * @param {string} fill - The fill color in hexadecimal or RGB format.
2400
+ * @param {string} stroke - The stroke color in hexadecimal or RGB format.
2401
+ * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2402
+ * @return {Style} The created Style object.
2403
+ */
2404
+ static simple(fill, stroke, strokeWidth = 1) {
2405
+ return new Style({
2406
+ fill: new Fill({
2407
+ color: fill,
2408
+ }),
2409
+ stroke: new Stroke({
2410
+ color: stroke,
2411
+ width: strokeWidth,
2412
+ }),
2413
+ });
2414
+ }
2415
+ /**
2416
+ * Creates a new Style object with the given fill, stroke, stroke width, and pin radius.
2417
+ *
2418
+ * @param {string} fill - The color to use for the fill of the style.
2419
+ * @param {string} stroke - The color to use for the stroke of the style.
2420
+ * @param {number} [strokeWidth=1] - The width of the stroke. Defaults to 1.
2421
+ * @param {number} [pinRadius=5] - The radius of the circle used as the image for the style. Defaults to 5.
2422
+ * @returns {Style} - The newly created Style object.
2423
+ */
2424
+ static edit(fill, stroke, strokeWidth = 1, pinRadius = 5) {
2425
+ return new Style({
2426
+ image: new Circle({
2427
+ fill: new Fill({
2428
+ color: stroke,
2429
+ }),
2430
+ radius: pinRadius,
2431
+ }),
2432
+ fill: new Fill({
2433
+ color: fill,
2434
+ }),
2435
+ stroke: new Stroke({
2436
+ color: stroke,
2437
+ width: strokeWidth,
2438
+ }),
2439
+ });
2440
+ }
2441
+ }
2442
+
2443
+ /**
2444
+ * Helper class for creating text styles.
2445
+ */
2446
+ class TextStyleHelper {
2447
+ /**
2448
+ * Creates a new instance of the Text class with the specified properties.
2449
+ *
2450
+ * @param {string} text - The text content of the Text object.
2451
+ * @param {string} font - The font style of the Text object.
2452
+ * @param {string} color - The color of the Text object.
2453
+ * @return {Text} A new instance of the Text class.
2454
+ */
2455
+ static get(text, font, color) {
2456
+ return new Text({
2457
+ text: text,
2458
+ font: font,
2459
+ textAlign: 'center',
2460
+ fill: new Fill({
2461
+ color: color,
2462
+ }),
2463
+ });
2464
+ }
2465
+ }
2466
+
2467
+ /**
2468
+ * A helper class for converting and stringify features.
2469
+ */
2470
+ class StringifyFeatureHelper {
2471
+ static polygon(feature, format = FeatureOutputFormat.GeoJson) {
2472
+ return format === FeatureOutputFormat.GeoJson
2473
+ ? new GeoJSON().writeFeature(feature)
2474
+ : new WKT().writeFeature(feature);
2475
+ }
2476
+ /**
2477
+ * Creates a polygon feature representing a circle based on a given feature with a circle geometry.
2478
+ *
2479
+ * @param {Feature<Geometry>} feature - The input feature with a circle geometry.
2480
+ * @param {FeatureOutputFormat} format - The format for outputting the polygon feature. (default: FeatureOutputFormat.GeoJson)
2481
+ *
2482
+ * @return {string} - The string representation of the polygon feature.
2483
+ */
2484
+ static circle(feature, format = FeatureOutputFormat.GeoJson) {
2485
+ const circle = feature.getGeometry();
2486
+ const ext = feature.getGeometry().getExtent();
2487
+ const coords = [
2488
+ ...transform([ext[0], ext[1]], 'EPSG:4326', 'EPSG:3857'),
2489
+ ...transform([ext[2], ext[3]], 'EPSG:4326', 'EPSG:3857'),
2490
+ ];
2491
+ const radius = (coords[2] - coords[0]) / 2;
2492
+ const polygonGeom = new Polygon(StringifyFeatureHelper.drawCircle(circle.getCenter(), radius));
2493
+ return StringifyFeatureHelper.polygon(new Feature(polygonGeom), format);
2494
+ }
2495
+ /**
2496
+ * Draw a circle based on a center point and radius.
2497
+ *
2498
+ * @param {number[]} point - The center point coordinates in EPSG:4326 format.
2499
+ * @param {number} radius - The radius of the circle in meters.
2500
+ * @return {Coordinate[][]} - The coordinates of the circle boundary in EPSG:4326 format.
2501
+ */
2502
+ static drawCircle(point, radius) {
2503
+ const tetetemp = transform(point, 'EPSG:4326', 'EPSG:3857');
2504
+ // const tetetemp = point;
2505
+ const radians = Math.PI / 180; // degrees to radians
2506
+ const degrees = 180 / Math.PI; // radians to degrees
2507
+ const earthsradius = 6378137.0;
2508
+ const rlat = (radius / earthsradius) * degrees;
2509
+ const rlng = rlat / Math.cos(tetetemp[1] * radians);
2510
+ const extp = [];
2511
+ for (let i = 0; i <= 32; i++) {
2512
+ const theta = Math.PI * (i / 16);
2513
+ extp.push([
2514
+ tetetemp[0] + rlng * Math.cos(theta) * METERS_PER_UNIT,
2515
+ tetetemp[1] + rlat * Math.sin(theta) * METERS_PER_UNIT,
2516
+ ]);
2517
+ }
2518
+ return [extp.map((e) => transform(e, 'EPSG:3857', 'EPSG:4326'))];
2519
+ }
2520
+ }
2521
+
2522
+ /*
2523
+ * Public API Surface of maps
2524
2524
  */
2525
2525
 
2526
- /*
2527
- * Public API Surface of maps-components
2526
+ /*
2527
+ * Public API Surface of maps-components
2528
2528
  */
2529
2529
 
2530
- /**
2531
- * Generated bundle index. Do not edit.
2530
+ /**
2531
+ * Generated bundle index. Do not edit.
2532
2532
  */
2533
2533
 
2534
2534
  export { AddControlCommand, CalculateAreaExecutor, CancelDrawingCommand, CancelFeatureModificationCommand, CloseTooltipCommand, ClusterLayerComponent, ClusterLayerSettings, DrawSelectionAreaCommand, DrawingType, FeatureLayerComponent, FeatureLayerSettings, FeatureOutputFormat, FitToPolygonsCommand, MapClickEvent, MapControl, MapControlZoomComponent, MapLyrs, MapLyrsLabel, MapModule, MapMoveEndEvent, MapPlateComponent, MapPostboyService, MapRenderedEvent, MapSettings, MarkerModel, MarkerStyleHelper, MarkersComponent, MessageRegistratorService, ModifyFeatureCommand, OsmTileLayerComponent, PolygonModel, PolygonStyleHelper, PolygonsComponent, RemoveControlCommand, SetMapCenterCommand, StartDrawingCommand, StringifyFeatureHelper, TextStyleHelper, TileLayerComponent, TileLayerSettings, TooltipComponent, TooltipSettings, ZoomControlSettings };