@map-colonies/react-components 3.7.2 → 3.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/index.js +2 -0
  3. package/package.json +100 -95
  4. package/src/lib/autocomplete/autocomplete.css +25 -0
  5. package/src/lib/autocomplete/autocomplete.stories.tsx +101 -0
  6. package/src/lib/autocomplete/autocomplete.tsx +683 -0
  7. package/src/lib/autocomplete/get-input-selection.d.ts +1 -0
  8. package/src/lib/autocomplete/index.ts +1 -0
  9. package/src/lib/cesium-map/context-menu.stories.tsx +1 -2
  10. package/src/lib/cesium-map/layers/3d.tileset.stories.tsx +1 -2
  11. package/src/lib/cesium-map/layers/3d.tileset.update.ts +72 -0
  12. package/src/lib/cesium-map/layers/layers.rect.stories.tsx +171 -0
  13. package/src/lib/cesium-map/layers-manager.stories.tsx +2 -3
  14. package/src/lib/cesium-map/layers-manager.ts +3 -1
  15. package/src/lib/cesium-map/map.stories.tsx +3 -3
  16. package/src/lib/cesium-map/map.tsx +3 -1
  17. package/src/lib/cesium-map/terrain-providers/custom/dummy-quantized-mesh-tile.ts +243 -0
  18. package/src/lib/cesium-map/terrain-providers/custom/quantized-mesh-decoder.ts +321 -0
  19. package/src/lib/cesium-map/terrain-providers/custom/quantized-mesh-terrain-provider.ts +237 -0
  20. package/src/lib/cesium-map/terrain-providers/terrain-provider.stories.tsx +183 -0
  21. package/{dist/date-range-picker/date-range-picker.css → src/lib/date-picker/date-picker.css} +0 -0
  22. package/src/lib/date-picker/date-picker.stories.tsx +130 -0
  23. package/src/lib/date-picker/date-picker.tsx +90 -0
  24. package/src/lib/date-picker/index.ts +1 -0
  25. package/src/lib/date-range-picker/date-range-picker.form-control.tsx +9 -7
  26. package/src/lib/date-range-picker/date-range-picker.tsx +12 -10
  27. package/src/lib/index.ts +2 -0
  28. package/src/lib/models/defaults.ts +12 -0
  29. package/src/types/quantized-mesh-decoder.d.ts +1 -0
  30. package/storybook-static/mock/{tileset → tileset_1}/ll.b3dm +0 -0
  31. package/storybook-static/mock/{tileset → tileset_1}/lr.b3dm +0 -0
  32. package/storybook-static/mock/{tileset → tileset_1}/parent.b3dm +0 -0
  33. package/storybook-static/mock/{tileset → tileset_1}/tileset.json +0 -0
  34. package/storybook-static/mock/{tileset → tileset_1}/ul.b3dm +0 -0
  35. package/storybook-static/mock/{tileset → tileset_1}/ur.b3dm +0 -0
  36. package/dist/assets/img/dragIcon.png +0 -0
  37. package/dist/assets/img/dragIconLight.png +0 -0
  38. package/dist/assets/img/glyphicons_067_cleaning.png +0 -0
  39. package/dist/assets/img/glyphicons_094_vector_path_square.png +0 -0
  40. package/dist/assets/img/glyphicons_095_vector_path_circle.png +0 -0
  41. package/dist/assets/img/glyphicons_096_vector_path_polygon.png +0 -0
  42. package/dist/assets/img/glyphicons_097_vector_path_line.png +0 -0
  43. package/dist/assets/img/glyphicons_242_google_maps.png +0 -0
  44. package/dist/box/box.d.ts +0 -4
  45. package/dist/box/box.d.ts.map +0 -1
  46. package/dist/box/box.js +0 -34
  47. package/dist/box/box.js.map +0 -1
  48. package/dist/box/index.d.ts +0 -2
  49. package/dist/box/index.d.ts.map +0 -1
  50. package/dist/box/index.js +0 -5
  51. package/dist/box/index.js.map +0 -1
  52. package/dist/cesium-map/data-sources/custom.data-source.d.ts +0 -6
  53. package/dist/cesium-map/data-sources/custom.data-source.d.ts.map +0 -1
  54. package/dist/cesium-map/data-sources/custom.data-source.js +0 -22
  55. package/dist/cesium-map/data-sources/custom.data-source.js.map +0 -1
  56. package/dist/cesium-map/data-sources/drawings.data-source.d.ts +0 -35
  57. package/dist/cesium-map/data-sources/drawings.data-source.d.ts.map +0 -1
  58. package/dist/cesium-map/data-sources/drawings.data-source.js +0 -174
  59. package/dist/cesium-map/data-sources/drawings.data-source.js.map +0 -1
  60. package/dist/cesium-map/data-sources/index.d.ts +0 -3
  61. package/dist/cesium-map/data-sources/index.d.ts.map +0 -1
  62. package/dist/cesium-map/data-sources/index.js +0 -8
  63. package/dist/cesium-map/data-sources/index.js.map +0 -1
  64. package/dist/cesium-map/entities/entity.d.ts +0 -6
  65. package/dist/cesium-map/entities/entity.d.ts.map +0 -1
  66. package/dist/cesium-map/entities/entity.description.d.ts +0 -7
  67. package/dist/cesium-map/entities/entity.description.d.ts.map +0 -1
  68. package/dist/cesium-map/entities/entity.description.js +0 -25
  69. package/dist/cesium-map/entities/entity.description.js.map +0 -1
  70. package/dist/cesium-map/entities/entity.js +0 -22
  71. package/dist/cesium-map/entities/entity.js.map +0 -1
  72. package/dist/cesium-map/entities/graphics/polygon.graphics.d.ts +0 -6
  73. package/dist/cesium-map/entities/graphics/polygon.graphics.d.ts.map +0 -1
  74. package/dist/cesium-map/entities/graphics/polygon.graphics.js +0 -22
  75. package/dist/cesium-map/entities/graphics/polygon.graphics.js.map +0 -1
  76. package/dist/cesium-map/entities/graphics/polyline.graphics.d.ts +0 -6
  77. package/dist/cesium-map/entities/graphics/polyline.graphics.d.ts.map +0 -1
  78. package/dist/cesium-map/entities/graphics/polyline.graphics.js +0 -22
  79. package/dist/cesium-map/entities/graphics/polyline.graphics.js.map +0 -1
  80. package/dist/cesium-map/entities/graphics/rectangle.graphics.d.ts +0 -6
  81. package/dist/cesium-map/entities/graphics/rectangle.graphics.d.ts.map +0 -1
  82. package/dist/cesium-map/entities/graphics/rectangle.graphics.js +0 -22
  83. package/dist/cesium-map/entities/graphics/rectangle.graphics.js.map +0 -1
  84. package/dist/cesium-map/entities/index.d.ts +0 -5
  85. package/dist/cesium-map/entities/index.d.ts.map +0 -1
  86. package/dist/cesium-map/entities/index.js +0 -10
  87. package/dist/cesium-map/entities/index.js.map +0 -1
  88. package/dist/cesium-map/index.d.ts +0 -8
  89. package/dist/cesium-map/index.d.ts.map +0 -1
  90. package/dist/cesium-map/index.js +0 -13
  91. package/dist/cesium-map/index.js.map +0 -1
  92. package/dist/cesium-map/layers/3d.tileset.d.ts +0 -8
  93. package/dist/cesium-map/layers/3d.tileset.d.ts.map +0 -1
  94. package/dist/cesium-map/layers/3d.tileset.js +0 -38
  95. package/dist/cesium-map/layers/3d.tileset.js.map +0 -1
  96. package/dist/cesium-map/layers/geojson.layer.d.ts +0 -6
  97. package/dist/cesium-map/layers/geojson.layer.d.ts.map +0 -1
  98. package/dist/cesium-map/layers/geojson.layer.js +0 -22
  99. package/dist/cesium-map/layers/geojson.layer.js.map +0 -1
  100. package/dist/cesium-map/layers/imagery.layer.d.ts +0 -7
  101. package/dist/cesium-map/layers/imagery.layer.d.ts.map +0 -1
  102. package/dist/cesium-map/layers/imagery.layer.js +0 -51
  103. package/dist/cesium-map/layers/imagery.layer.js.map +0 -1
  104. package/dist/cesium-map/layers/index.d.ts +0 -8
  105. package/dist/cesium-map/layers/index.d.ts.map +0 -1
  106. package/dist/cesium-map/layers/index.js +0 -13
  107. package/dist/cesium-map/layers/index.js.map +0 -1
  108. package/dist/cesium-map/layers/osm.layer.d.ts +0 -10
  109. package/dist/cesium-map/layers/osm.layer.d.ts.map +0 -1
  110. package/dist/cesium-map/layers/osm.layer.js +0 -35
  111. package/dist/cesium-map/layers/osm.layer.js.map +0 -1
  112. package/dist/cesium-map/layers/wms.layer.d.ts +0 -10
  113. package/dist/cesium-map/layers/wms.layer.d.ts.map +0 -1
  114. package/dist/cesium-map/layers/wms.layer.js +0 -35
  115. package/dist/cesium-map/layers/wms.layer.js.map +0 -1
  116. package/dist/cesium-map/layers/wmts.layer.d.ts +0 -10
  117. package/dist/cesium-map/layers/wmts.layer.d.ts.map +0 -1
  118. package/dist/cesium-map/layers/wmts.layer.js +0 -35
  119. package/dist/cesium-map/layers/wmts.layer.js.map +0 -1
  120. package/dist/cesium-map/layers/xyz.layer.d.ts +0 -10
  121. package/dist/cesium-map/layers/xyz.layer.d.ts.map +0 -1
  122. package/dist/cesium-map/layers/xyz.layer.js +0 -35
  123. package/dist/cesium-map/layers/xyz.layer.js.map +0 -1
  124. package/dist/cesium-map/layers-manager.d.ts +0 -47
  125. package/dist/cesium-map/layers-manager.d.ts.map +0 -1
  126. package/dist/cesium-map/layers-manager.js +0 -232
  127. package/dist/cesium-map/layers-manager.js.map +0 -1
  128. package/dist/cesium-map/map.css +0 -54
  129. package/dist/cesium-map/map.d.ts +0 -45
  130. package/dist/cesium-map/map.d.ts.map +0 -1
  131. package/dist/cesium-map/map.js +0 -250
  132. package/dist/cesium-map/map.js.map +0 -1
  133. package/dist/cesium-map/map.types.d.ts +0 -9
  134. package/dist/cesium-map/map.types.d.ts.map +0 -1
  135. package/dist/cesium-map/map.types.js +0 -12
  136. package/dist/cesium-map/map.types.js.map +0 -1
  137. package/dist/cesium-map/proxied.types.d.ts +0 -20
  138. package/dist/cesium-map/proxied.types.d.ts.map +0 -1
  139. package/dist/cesium-map/proxied.types.js +0 -87
  140. package/dist/cesium-map/proxied.types.js.map +0 -1
  141. package/dist/cesium-map/settings/base-maps.css +0 -37
  142. package/dist/cesium-map/settings/base-maps.d.ts +0 -8
  143. package/dist/cesium-map/settings/base-maps.d.ts.map +0 -1
  144. package/dist/cesium-map/settings/base-maps.js +0 -68
  145. package/dist/cesium-map/settings/base-maps.js.map +0 -1
  146. package/dist/cesium-map/settings/scene-modes.css +0 -19
  147. package/dist/cesium-map/settings/scene-modes.d.ts +0 -8
  148. package/dist/cesium-map/settings/scene-modes.d.ts.map +0 -1
  149. package/dist/cesium-map/settings/scene-modes.js +0 -52
  150. package/dist/cesium-map/settings/scene-modes.js.map +0 -1
  151. package/dist/cesium-map/settings/settings.css +0 -49
  152. package/dist/cesium-map/settings/settings.d.ts +0 -24
  153. package/dist/cesium-map/settings/settings.d.ts.map +0 -1
  154. package/dist/cesium-map/settings/settings.js +0 -66
  155. package/dist/cesium-map/settings/settings.js.map +0 -1
  156. package/dist/cesium-map/tools/cesium/primitives-conversions.cesium.d.ts +0 -3
  157. package/dist/cesium-map/tools/cesium/primitives-conversions.cesium.d.ts.map +0 -1
  158. package/dist/cesium-map/tools/cesium/primitives-conversions.cesium.js +0 -25
  159. package/dist/cesium-map/tools/cesium/primitives-conversions.cesium.js.map +0 -1
  160. package/dist/cesium-map/tools/coordinates-tracker.tool.css +0 -11
  161. package/dist/cesium-map/tools/coordinates-tracker.tool.d.ts +0 -8
  162. package/dist/cesium-map/tools/coordinates-tracker.tool.d.ts.map +0 -1
  163. package/dist/cesium-map/tools/coordinates-tracker.tool.js +0 -65
  164. package/dist/cesium-map/tools/coordinates-tracker.tool.js.map +0 -1
  165. package/dist/cesium-map/tools/draw/drawHelper.css +0 -101
  166. package/dist/cesium-map/tools/draw/drawHelper.d.ts +0 -29
  167. package/dist/cesium-map/tools/draw/drawHelper.d.ts.map +0 -1
  168. package/dist/cesium-map/tools/draw/drawHelper.js +0 -1681
  169. package/dist/cesium-map/tools/draw/drawHelper.js.map +0 -1
  170. package/dist/cesium-map/tools/geojson/geojson-to-primitive.d.ts +0 -5
  171. package/dist/cesium-map/tools/geojson/geojson-to-primitive.d.ts.map +0 -1
  172. package/dist/cesium-map/tools/geojson/geojson-to-primitive.js +0 -40
  173. package/dist/cesium-map/tools/geojson/geojson-to-primitive.js.map +0 -1
  174. package/dist/cesium-map/tools/geojson/index.d.ts +0 -3
  175. package/dist/cesium-map/tools/geojson/index.d.ts.map +0 -1
  176. package/dist/cesium-map/tools/geojson/index.js +0 -8
  177. package/dist/cesium-map/tools/geojson/index.js.map +0 -1
  178. package/dist/cesium-map/tools/geojson/point.geojson.d.ts +0 -4
  179. package/dist/cesium-map/tools/geojson/point.geojson.d.ts.map +0 -1
  180. package/dist/cesium-map/tools/geojson/point.geojson.js +0 -20
  181. package/dist/cesium-map/tools/geojson/point.geojson.js.map +0 -1
  182. package/dist/cesium-map/tools/geojson/polygon.geojson.d.ts +0 -4
  183. package/dist/cesium-map/tools/geojson/polygon.geojson.d.ts.map +0 -1
  184. package/dist/cesium-map/tools/geojson/polygon.geojson.js +0 -23
  185. package/dist/cesium-map/tools/geojson/polygon.geojson.js.map +0 -1
  186. package/dist/cesium-map/tools/geojson/rectangle.geojson.d.ts +0 -4
  187. package/dist/cesium-map/tools/geojson/rectangle.geojson.d.ts.map +0 -1
  188. package/dist/cesium-map/tools/geojson/rectangle.geojson.js +0 -31
  189. package/dist/cesium-map/tools/geojson/rectangle.geojson.js.map +0 -1
  190. package/dist/cesium-map/tools/scale-tracker.tool.css +0 -16
  191. package/dist/cesium-map/tools/scale-tracker.tool.d.ts +0 -9
  192. package/dist/cesium-map/tools/scale-tracker.tool.d.ts.map +0 -1
  193. package/dist/cesium-map/tools/scale-tracker.tool.js +0 -145
  194. package/dist/cesium-map/tools/scale-tracker.tool.js.map +0 -1
  195. package/dist/cssbaseline/cssbaseline.d.ts +0 -6
  196. package/dist/cssbaseline/cssbaseline.d.ts.map +0 -1
  197. package/dist/cssbaseline/cssbaseline.js +0 -39
  198. package/dist/cssbaseline/cssbaseline.js.map +0 -1
  199. package/dist/cssbaseline/index.d.ts +0 -2
  200. package/dist/cssbaseline/index.d.ts.map +0 -1
  201. package/dist/cssbaseline/index.js +0 -6
  202. package/dist/cssbaseline/index.js.map +0 -1
  203. package/dist/date-range-picker/date-range-picker.d.ts +0 -27
  204. package/dist/date-range-picker/date-range-picker.d.ts.map +0 -1
  205. package/dist/date-range-picker/date-range-picker.form-control.css +0 -3
  206. package/dist/date-range-picker/date-range-picker.form-control.d.ts +0 -29
  207. package/dist/date-range-picker/date-range-picker.form-control.d.ts.map +0 -1
  208. package/dist/date-range-picker/date-range-picker.form-control.js +0 -80
  209. package/dist/date-range-picker/date-range-picker.form-control.js.map +0 -1
  210. package/dist/date-range-picker/date-range-picker.js +0 -91
  211. package/dist/date-range-picker/date-range-picker.js.map +0 -1
  212. package/dist/date-range-picker/index.d.ts +0 -3
  213. package/dist/date-range-picker/index.d.ts.map +0 -1
  214. package/dist/date-range-picker/index.js +0 -8
  215. package/dist/date-range-picker/index.js.map +0 -1
  216. package/dist/index.d.ts +0 -11
  217. package/dist/index.d.ts.map +0 -1
  218. package/dist/index.js.map +0 -1
  219. package/dist/map-filter-container/container-map.css +0 -5
  220. package/dist/map-filter-container/container-map.d.ts +0 -12
  221. package/dist/map-filter-container/container-map.d.ts.map +0 -1
  222. package/dist/map-filter-container/container-map.js +0 -30
  223. package/dist/map-filter-container/container-map.js.map +0 -1
  224. package/dist/map-filter-container/index.d.ts +0 -2
  225. package/dist/map-filter-container/index.d.ts.map +0 -1
  226. package/dist/map-filter-container/index.js +0 -7
  227. package/dist/map-filter-container/index.js.map +0 -1
  228. package/dist/map-filter-container/map-filter-container.d.ts +0 -10
  229. package/dist/map-filter-container/map-filter-container.d.ts.map +0 -1
  230. package/dist/map-filter-container/map-filter-container.js +0 -65
  231. package/dist/map-filter-container/map-filter-container.js.map +0 -1
  232. package/dist/map-filter-container/polygon-selection-ui.d.ts +0 -13
  233. package/dist/map-filter-container/polygon-selection-ui.d.ts.map +0 -1
  234. package/dist/map-filter-container/polygon-selection-ui.js +0 -61
  235. package/dist/map-filter-container/polygon-selection-ui.js.map +0 -1
  236. package/dist/models/defaults.d.ts +0 -18
  237. package/dist/models/defaults.d.ts.map +0 -1
  238. package/dist/models/defaults.js +0 -21
  239. package/dist/models/defaults.js.map +0 -1
  240. package/dist/models/enums.d.ts +0 -14
  241. package/dist/models/enums.d.ts.map +0 -1
  242. package/dist/models/enums.js +0 -19
  243. package/dist/models/enums.js.map +0 -1
  244. package/dist/models/index.d.ts +0 -2
  245. package/dist/models/index.d.ts.map +0 -1
  246. package/dist/models/index.js +0 -7
  247. package/dist/models/index.js.map +0 -1
  248. package/dist/ol-map/feature.d.ts +0 -7
  249. package/dist/ol-map/feature.d.ts.map +0 -1
  250. package/dist/ol-map/feature.js +0 -19
  251. package/dist/ol-map/feature.js.map +0 -1
  252. package/dist/ol-map/index.d.ts +0 -7
  253. package/dist/ol-map/index.d.ts.map +0 -1
  254. package/dist/ol-map/index.js +0 -12
  255. package/dist/ol-map/index.js.map +0 -1
  256. package/dist/ol-map/interactions/draw.d.ts +0 -9
  257. package/dist/ol-map/interactions/draw.d.ts.map +0 -1
  258. package/dist/ol-map/interactions/draw.js +0 -44
  259. package/dist/ol-map/interactions/draw.js.map +0 -1
  260. package/dist/ol-map/interactions/index.d.ts +0 -2
  261. package/dist/ol-map/interactions/index.d.ts.map +0 -1
  262. package/dist/ol-map/interactions/index.js +0 -7
  263. package/dist/ol-map/interactions/index.js.map +0 -1
  264. package/dist/ol-map/layers/index.d.ts +0 -4
  265. package/dist/ol-map/layers/index.d.ts.map +0 -1
  266. package/dist/ol-map/layers/index.js +0 -9
  267. package/dist/ol-map/layers/index.js.map +0 -1
  268. package/dist/ol-map/layers/tile-layer.d.ts +0 -10
  269. package/dist/ol-map/layers/tile-layer.d.ts.map +0 -1
  270. package/dist/ol-map/layers/tile-layer.js +0 -34
  271. package/dist/ol-map/layers/tile-layer.js.map +0 -1
  272. package/dist/ol-map/layers/vector-layer.d.ts +0 -5
  273. package/dist/ol-map/layers/vector-layer.d.ts.map +0 -1
  274. package/dist/ol-map/layers/vector-layer.js +0 -34
  275. package/dist/ol-map/layers/vector-layer.js.map +0 -1
  276. package/dist/ol-map/layers/vector-tile-layer.d.ts +0 -11
  277. package/dist/ol-map/layers/vector-tile-layer.d.ts.map +0 -1
  278. package/dist/ol-map/layers/vector-tile-layer.js +0 -52
  279. package/dist/ol-map/layers/vector-tile-layer.js.map +0 -1
  280. package/dist/ol-map/map.css +0 -17
  281. package/dist/ol-map/map.d.ts +0 -15
  282. package/dist/ol-map/map.d.ts.map +0 -1
  283. package/dist/ol-map/map.js +0 -103
  284. package/dist/ol-map/map.js.map +0 -1
  285. package/dist/ol-map/source/index.d.ts +0 -7
  286. package/dist/ol-map/source/index.d.ts.map +0 -1
  287. package/dist/ol-map/source/index.js +0 -12
  288. package/dist/ol-map/source/index.js.map +0 -1
  289. package/dist/ol-map/source/mvt.d.ts +0 -12
  290. package/dist/ol-map/source/mvt.d.ts.map +0 -1
  291. package/dist/ol-map/source/mvt.js +0 -34
  292. package/dist/ol-map/source/mvt.js.map +0 -1
  293. package/dist/ol-map/source/osm.d.ts +0 -3
  294. package/dist/ol-map/source/osm.d.ts.map +0 -1
  295. package/dist/ol-map/source/osm.js +0 -13
  296. package/dist/ol-map/source/osm.js.map +0 -1
  297. package/dist/ol-map/source/vector-source.d.ts +0 -5
  298. package/dist/ol-map/source/vector-source.d.ts.map +0 -1
  299. package/dist/ol-map/source/vector-source.js +0 -31
  300. package/dist/ol-map/source/vector-source.js.map +0 -1
  301. package/dist/ol-map/source/wms.d.ts +0 -18
  302. package/dist/ol-map/source/wms.d.ts.map +0 -1
  303. package/dist/ol-map/source/wms.js +0 -28
  304. package/dist/ol-map/source/wms.js.map +0 -1
  305. package/dist/ol-map/source/wmts.d.ts +0 -22
  306. package/dist/ol-map/source/wmts.d.ts.map +0 -1
  307. package/dist/ol-map/source/wmts.js +0 -57
  308. package/dist/ol-map/source/wmts.js.map +0 -1
  309. package/dist/ol-map/source/xyz.d.ts +0 -13
  310. package/dist/ol-map/source/xyz.d.ts.map +0 -1
  311. package/dist/ol-map/source/xyz.js +0 -25
  312. package/dist/ol-map/source/xyz.js.map +0 -1
  313. package/dist/ol-map/style.d.ts +0 -5
  314. package/dist/ol-map/style.d.ts.map +0 -1
  315. package/dist/ol-map/style.js +0 -22
  316. package/dist/ol-map/style.js.map +0 -1
  317. package/dist/popover/index.d.ts +0 -2
  318. package/dist/popover/index.d.ts.map +0 -1
  319. package/dist/popover/index.js +0 -5
  320. package/dist/popover/index.js.map +0 -1
  321. package/dist/popover/popover.d.ts +0 -4
  322. package/dist/popover/popover.d.ts.map +0 -1
  323. package/dist/popover/popover.js +0 -34
  324. package/dist/popover/popover.js.map +0 -1
  325. package/dist/smart-table/__mock-data__/smartTableMocks.d.ts +0 -8
  326. package/dist/smart-table/__mock-data__/smartTableMocks.d.ts.map +0 -1
  327. package/dist/smart-table/__mock-data__/smartTableMocks.js +0 -17
  328. package/dist/smart-table/__mock-data__/smartTableMocks.js.map +0 -1
  329. package/dist/smart-table/index.d.ts +0 -3
  330. package/dist/smart-table/index.d.ts.map +0 -1
  331. package/dist/smart-table/index.js +0 -8
  332. package/dist/smart-table/index.js.map +0 -1
  333. package/dist/smart-table/smart-table-head.d.ts +0 -12
  334. package/dist/smart-table/smart-table-head.d.ts.map +0 -1
  335. package/dist/smart-table/smart-table-head.js +0 -22
  336. package/dist/smart-table/smart-table-head.js.map +0 -1
  337. package/dist/smart-table/smart-table-row.d.ts +0 -14
  338. package/dist/smart-table/smart-table-row.d.ts.map +0 -1
  339. package/dist/smart-table/smart-table-row.js +0 -36
  340. package/dist/smart-table/smart-table-row.js.map +0 -1
  341. package/dist/smart-table/smart-table-types.d.ts +0 -11
  342. package/dist/smart-table/smart-table-types.d.ts.map +0 -1
  343. package/dist/smart-table/smart-table-types.js +0 -3
  344. package/dist/smart-table/smart-table-types.js.map +0 -1
  345. package/dist/smart-table/smart-table.d.ts +0 -18
  346. package/dist/smart-table/smart-table.d.ts.map +0 -1
  347. package/dist/smart-table/smart-table.js +0 -39
  348. package/dist/smart-table/smart-table.js.map +0 -1
  349. package/dist/theme/index.d.ts +0 -2
  350. package/dist/theme/index.d.ts.map +0 -1
  351. package/dist/theme/index.js +0 -7
  352. package/dist/theme/index.js.map +0 -1
  353. package/dist/theme/theme.d.ts +0 -9
  354. package/dist/theme/theme.d.ts.map +0 -1
  355. package/dist/theme/theme.js +0 -124
  356. package/dist/theme/theme.js.map +0 -1
  357. package/dist/utils/map.d.ts +0 -4
  358. package/dist/utils/map.d.ts.map +0 -1
  359. package/dist/utils/map.js +0 -18
  360. package/dist/utils/map.js.map +0 -1
  361. package/dist/utils/projections.d.ts +0 -7
  362. package/dist/utils/projections.d.ts.map +0 -1
  363. package/dist/utils/projections.js +0 -10
  364. package/dist/utils/projections.js.map +0 -1
  365. package/dist/utils/story.d.ts +0 -13
  366. package/dist/utils/story.d.ts.map +0 -1
  367. package/dist/utils/story.js +0 -3
  368. package/dist/utils/story.js.map +0 -1
@@ -1,1681 +0,0 @@
1
- "use strict";
2
- var __importStar = (this && this.__importStar) || function (mod) {
3
- if (mod && mod.__esModule) return mod;
4
- var result = {};
5
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6
- result["default"] = mod;
7
- return result;
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- // inspired by https://github.com/leforthomas/cesium-drawhelper
11
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
- // @ts-nocheck
13
- var Cesium = __importStar(require("cesium"));
14
- require("./drawHelper.css");
15
- /* eslint-disable */
16
- var DrawHelper = (function () {
17
- // static variables
18
- var ellipsoid = Cesium.Ellipsoid.WGS84;
19
- var drawingVertexColor;
20
- var material = Cesium.Material.fromType(Cesium.Material.ColorType);
21
- // constructor
22
- function _(cesiumWidget, materialClr, drawingVertexClr) {
23
- if (materialClr === void 0) { materialClr = new Cesium.Color(1.0, 1.0, 0.0, 0.5); }
24
- if (drawingVertexClr === void 0) { drawingVertexClr = new Cesium.Color(1.0, 1.0, 1.0, 1.0); }
25
- this._scene = cesiumWidget.scene;
26
- // UPDATE scoped varibles
27
- material.uniforms.color = materialClr;
28
- drawingVertexColor = drawingVertexClr;
29
- //MC_CHANGE disable/override tooltip
30
- this._tooltip = {
31
- setVisible: function () { },
32
- showAt: function () { },
33
- };
34
- // this._tooltip = createTooltip(cesiumWidget.container);
35
- this._surfaces = [];
36
- this.initialiseHandlers();
37
- this.enhancePrimitives();
38
- }
39
- _.prototype.initialiseHandlers = function () {
40
- var scene = this._scene;
41
- var _self = this;
42
- // scene events
43
- var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
44
- function callPrimitiveCallback(name, position) {
45
- if (_self._handlersMuted == true)
46
- return;
47
- var pickedObject = scene.pick(position);
48
- if (pickedObject &&
49
- pickedObject.primitive &&
50
- pickedObject.primitive[name]) {
51
- pickedObject.primitive[name](position);
52
- }
53
- }
54
- handler.setInputAction(function (movement) {
55
- callPrimitiveCallback('leftClick', movement.position);
56
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
57
- handler.setInputAction(function (movement) {
58
- callPrimitiveCallback('leftDoubleClick', movement.position);
59
- }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
60
- var mouseOutObject;
61
- handler.setInputAction(function (movement) {
62
- if (_self._handlersMuted == true)
63
- return;
64
- var pickedObject = scene.pick(movement.endPosition);
65
- if (mouseOutObject &&
66
- (!pickedObject || mouseOutObject != pickedObject.primitive)) {
67
- !(mouseOutObject.isDestroyed && mouseOutObject.isDestroyed()) &&
68
- mouseOutObject.mouseOut(movement.endPosition);
69
- mouseOutObject = null;
70
- }
71
- if (pickedObject && pickedObject.primitive) {
72
- pickedObject = pickedObject.primitive;
73
- if (pickedObject.mouseOut) {
74
- mouseOutObject = pickedObject;
75
- }
76
- if (pickedObject.mouseMove) {
77
- pickedObject.mouseMove(movement.endPosition);
78
- }
79
- }
80
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
81
- handler.setInputAction(function (movement) {
82
- callPrimitiveCallback('leftUp', movement.position);
83
- }, Cesium.ScreenSpaceEventType.LEFT_UP);
84
- handler.setInputAction(function (movement) {
85
- callPrimitiveCallback('leftDown', movement.position);
86
- }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
87
- };
88
- _.prototype.setListener = function (primitive, type, callback) {
89
- primitive[type] = callback;
90
- };
91
- _.prototype.muteHandlers = function (muted) {
92
- this._handlersMuted = muted;
93
- };
94
- // register event handling for an editable shape
95
- // shape should implement setEditMode and setHighlighted
96
- _.prototype.registerEditableShape = function (surface) {
97
- var _self = this;
98
- // handlers for interactions
99
- // highlight polygon when mouse is entering
100
- setListener(surface, 'mouseMove', function (position) {
101
- surface.setHighlighted(true);
102
- if (!surface._editMode) {
103
- _self._tooltip.showAt(position, 'Click to edit this shape');
104
- }
105
- });
106
- // hide the highlighting when mouse is leaving the polygon
107
- setListener(surface, 'mouseOut', function (position) {
108
- surface.setHighlighted(false);
109
- _self._tooltip.setVisible(false);
110
- });
111
- setListener(surface, 'leftClick', function (position) {
112
- surface.setEditMode(true);
113
- });
114
- };
115
- _.prototype.startDrawing = function (cleanUp) {
116
- // undo any current edit of shapes
117
- this.disableAllEditMode();
118
- // check for cleanUp first
119
- if (this.editCleanUp) {
120
- this.editCleanUp();
121
- }
122
- this.editCleanUp = cleanUp;
123
- this.muteHandlers(true);
124
- };
125
- _.prototype.stopDrawing = function () {
126
- // check for cleanUp first
127
- if (this.editCleanUp) {
128
- this.editCleanUp();
129
- this.editCleanUp = null;
130
- }
131
- this.muteHandlers(false);
132
- };
133
- // make sure only one shape is highlighted at a time
134
- _.prototype.disableAllHighlights = function () {
135
- this.setHighlighted(undefined);
136
- };
137
- _.prototype.setHighlighted = function (surface) {
138
- if (this._highlightedSurface &&
139
- !this._highlightedSurface.isDestroyed() &&
140
- this._highlightedSurface != surface) {
141
- this._highlightedSurface.setHighlighted(false);
142
- }
143
- this._highlightedSurface = surface;
144
- };
145
- _.prototype.disableAllEditMode = function () {
146
- this.setEdited(undefined);
147
- };
148
- _.prototype.setEdited = function (surface) {
149
- if (this._editedSurface && !this._editedSurface.isDestroyed()) {
150
- this._editedSurface.setEditMode(false);
151
- }
152
- this._editedSurface = surface;
153
- };
154
- var defaultShapeOptions = {
155
- ellipsoid: Cesium.Ellipsoid.WGS84,
156
- textureRotationAngle: 0.0,
157
- height: 0.0,
158
- asynchronous: true,
159
- show: true,
160
- debugShowBoundingVolume: false,
161
- };
162
- var defaultSurfaceOptions = copyOptions(defaultShapeOptions, {
163
- appearance: new Cesium.EllipsoidSurfaceAppearance({
164
- aboveGround: false,
165
- }),
166
- material: material,
167
- granularity: Math.PI / 180.0,
168
- });
169
- var defaultPolygonOptions = copyOptions(defaultShapeOptions, {});
170
- var defaultExtentOptions = copyOptions(defaultShapeOptions, {});
171
- var defaultCircleOptions = copyOptions(defaultShapeOptions, {});
172
- var defaultEllipseOptions = copyOptions(defaultSurfaceOptions, {
173
- rotation: 0,
174
- });
175
- var defaultPolylineOptions = copyOptions(defaultShapeOptions, {
176
- width: 5,
177
- geodesic: true,
178
- granularity: 10000,
179
- appearance: new Cesium.PolylineMaterialAppearance({
180
- aboveGround: false,
181
- }),
182
- material: material,
183
- });
184
- // Cesium.Polygon.prototype.setStrokeStyle = setStrokeStyle;
185
- //
186
- // Cesium.Polygon.prototype.drawOutline = drawOutline;
187
- //
188
- var ChangeablePrimitive = (function () {
189
- function _() { }
190
- _.prototype.initialiseOptions = function (options) {
191
- fillOptions(this, options);
192
- this._ellipsoid = undefined;
193
- this._granularity = undefined;
194
- this._height = undefined;
195
- this._textureRotationAngle = undefined;
196
- this._id = undefined;
197
- // set the flags to initiate a first drawing
198
- this._createPrimitive = true;
199
- this._primitive = undefined;
200
- this._outlinePolygon = undefined;
201
- };
202
- _.prototype.setAttribute = function (name, value) {
203
- this[name] = value;
204
- this._createPrimitive = true;
205
- };
206
- _.prototype.getAttribute = function (name) {
207
- return this[name];
208
- };
209
- /**
210
- * @private
211
- */
212
- _.prototype.update = function (context, frameState, commandList) {
213
- if (!Cesium.defined(this.ellipsoid)) {
214
- throw new Cesium.DeveloperError('this.ellipsoid must be defined.');
215
- }
216
- if (!Cesium.defined(this.appearance)) {
217
- throw new Cesium.DeveloperError('this.material must be defined.');
218
- }
219
- if (this.granularity < 0.0) {
220
- throw new Cesium.DeveloperError('this.granularity and scene2D/scene3D overrides must be greater than zero.');
221
- }
222
- if (!this.show) {
223
- return;
224
- }
225
- if (!this._createPrimitive && !Cesium.defined(this._primitive)) {
226
- // No positions/hierarchy to draw
227
- return;
228
- }
229
- if (this._createPrimitive ||
230
- this._ellipsoid !== this.ellipsoid ||
231
- this._granularity !== this.granularity ||
232
- this._height !== this.height ||
233
- this._textureRotationAngle !== this.textureRotationAngle ||
234
- this._id !== this.id) {
235
- var geometry = this.getGeometry();
236
- if (!geometry) {
237
- return;
238
- }
239
- this._createPrimitive = false;
240
- this._ellipsoid = this.ellipsoid;
241
- this._granularity = this.granularity;
242
- this._height = this.height;
243
- this._textureRotationAngle = this.textureRotationAngle;
244
- this._id = this.id;
245
- this._primitive = this._primitive && this._primitive.destroy();
246
- this._primitive = new Cesium.Primitive({
247
- geometryInstances: new Cesium.GeometryInstance({
248
- geometry: geometry,
249
- id: this.id,
250
- pickPrimitive: this,
251
- }),
252
- appearance: this.appearance,
253
- asynchronous: this.asynchronous,
254
- });
255
- this._outlinePolygon =
256
- this._outlinePolygon && this._outlinePolygon.destroy();
257
- if (this.strokeColor && this.getOutlineGeometry) {
258
- // create the highlighting frame
259
- this._outlinePolygon = new Cesium.Primitive({
260
- geometryInstances: new Cesium.GeometryInstance({
261
- geometry: this.getOutlineGeometry(),
262
- attributes: {
263
- color: Cesium.ColorGeometryInstanceAttribute.fromColor(this.strokeColor),
264
- },
265
- }),
266
- appearance: new Cesium.PerInstanceColorAppearance({
267
- flat: true,
268
- renderState: {
269
- depthTest: {
270
- enabled: true,
271
- },
272
- //MC_CHANGE
273
- lineWidth: this.strokeWidth || 4.0,
274
- },
275
- }),
276
- });
277
- }
278
- }
279
- var primitive = this._primitive;
280
- primitive.appearance.material = this.material;
281
- primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
282
- primitive.update(context, frameState, commandList);
283
- this._outlinePolygon &&
284
- this._outlinePolygon.update(context, frameState, commandList);
285
- };
286
- _.prototype.isDestroyed = function () {
287
- return false;
288
- };
289
- _.prototype.destroy = function () {
290
- this._primitive = this._primitive && this._primitive.destroy();
291
- return Cesium.destroyObject(this);
292
- };
293
- _.prototype.setStrokeStyle = function (strokeColor, strokeWidth) {
294
- if (!this.strokeColor ||
295
- !this.strokeColor.equals(strokeColor) ||
296
- this.strokeWidth != strokeWidth) {
297
- this._createPrimitive = true;
298
- this.strokeColor = strokeColor;
299
- this.strokeWidth = strokeWidth;
300
- }
301
- };
302
- return _;
303
- })();
304
- _.ExtentPrimitive = (function () {
305
- function _(options) {
306
- if (!Cesium.defined(options.extent)) {
307
- throw new Cesium.DeveloperError('Extent is required');
308
- }
309
- options = copyOptions(options, defaultSurfaceOptions);
310
- this.initialiseOptions(options);
311
- this.setExtent(options.extent);
312
- }
313
- _.prototype = new ChangeablePrimitive();
314
- _.prototype.setExtent = function (extent) {
315
- this.setAttribute('extent', extent);
316
- };
317
- _.prototype.getExtent = function () {
318
- return this.getAttribute('extent');
319
- };
320
- _.prototype.getGeometry = function () {
321
- if (!Cesium.defined(this.extent)) {
322
- return;
323
- }
324
- return new Cesium.RectangleGeometry({
325
- rectangle: this.extent,
326
- height: this.height,
327
- vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
328
- stRotation: this.textureRotationAngle,
329
- ellipsoid: this.ellipsoid,
330
- granularity: this.granularity,
331
- });
332
- };
333
- _.prototype.getOutlineGeometry = function () {
334
- return new Cesium.RectangleOutlineGeometry({
335
- rectangle: this.extent,
336
- });
337
- };
338
- return _;
339
- })();
340
- _.PolygonPrimitive = (function () {
341
- function _(options) {
342
- options = copyOptions(options, defaultSurfaceOptions);
343
- this.initialiseOptions(options);
344
- this.isPolygon = true;
345
- }
346
- _.prototype = new ChangeablePrimitive();
347
- _.prototype.setPositions = function (positions) {
348
- this.setAttribute('positions', positions);
349
- };
350
- _.prototype.getPositions = function () {
351
- return this.getAttribute('positions');
352
- };
353
- _.prototype.getGeometry = function () {
354
- if (!Cesium.defined(this.positions) || this.positions.length < 3) {
355
- return;
356
- }
357
- return Cesium.PolygonGeometry.fromPositions({
358
- positions: this.positions,
359
- height: this.height,
360
- vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
361
- stRotation: this.textureRotationAngle,
362
- ellipsoid: this.ellipsoid,
363
- granularity: this.granularity,
364
- });
365
- };
366
- _.prototype.getOutlineGeometry = function () {
367
- return Cesium.PolygonOutlineGeometry.fromPositions({
368
- positions: this.getPositions(),
369
- });
370
- };
371
- return _;
372
- })();
373
- _.CirclePrimitive = (function () {
374
- function _(options) {
375
- if (!(Cesium.defined(options.center) && Cesium.defined(options.radius))) {
376
- throw new Cesium.DeveloperError('Center and radius are required');
377
- }
378
- options = copyOptions(options, defaultSurfaceOptions);
379
- this.initialiseOptions(options);
380
- this.setRadius(options.radius);
381
- }
382
- _.prototype = new ChangeablePrimitive();
383
- _.prototype.setCenter = function (center) {
384
- this.setAttribute('center', center);
385
- };
386
- _.prototype.setRadius = function (radius) {
387
- this.setAttribute('radius', Math.max(0.1, radius));
388
- };
389
- _.prototype.getCenter = function () {
390
- return this.getAttribute('center');
391
- };
392
- _.prototype.getRadius = function () {
393
- return this.getAttribute('radius');
394
- };
395
- _.prototype.getGeometry = function () {
396
- if (!(Cesium.defined(this.center) && Cesium.defined(this.radius))) {
397
- return;
398
- }
399
- return new Cesium.CircleGeometry({
400
- center: this.center,
401
- radius: this.radius,
402
- height: this.height,
403
- vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
404
- stRotation: this.textureRotationAngle,
405
- ellipsoid: this.ellipsoid,
406
- granularity: this.granularity,
407
- });
408
- };
409
- _.prototype.getOutlineGeometry = function () {
410
- return new Cesium.CircleOutlineGeometry({
411
- center: this.getCenter(),
412
- radius: this.getRadius(),
413
- });
414
- };
415
- return _;
416
- })();
417
- _.EllipsePrimitive = (function () {
418
- function _(options) {
419
- if (!(Cesium.defined(options.center) &&
420
- Cesium.defined(options.semiMajorAxis) &&
421
- Cesium.defined(options.semiMinorAxis))) {
422
- throw new Cesium.DeveloperError('Center and semi major and semi minor axis are required');
423
- }
424
- options = copyOptions(options, defaultEllipseOptions);
425
- this.initialiseOptions(options);
426
- }
427
- _.prototype = new ChangeablePrimitive();
428
- _.prototype.setCenter = function (center) {
429
- this.setAttribute('center', center);
430
- };
431
- _.prototype.setSemiMajorAxis = function (semiMajorAxis) {
432
- if (semiMajorAxis < this.getSemiMinorAxis())
433
- return;
434
- this.setAttribute('semiMajorAxis', semiMajorAxis);
435
- };
436
- _.prototype.setSemiMinorAxis = function (semiMinorAxis) {
437
- if (semiMinorAxis > this.getSemiMajorAxis())
438
- return;
439
- this.setAttribute('semiMinorAxis', semiMinorAxis);
440
- };
441
- _.prototype.setRotation = function (rotation) {
442
- return this.setAttribute('rotation', rotation);
443
- };
444
- _.prototype.getCenter = function () {
445
- return this.getAttribute('center');
446
- };
447
- _.prototype.getSemiMajorAxis = function () {
448
- return this.getAttribute('semiMajorAxis');
449
- };
450
- _.prototype.getSemiMinorAxis = function () {
451
- return this.getAttribute('semiMinorAxis');
452
- };
453
- _.prototype.getRotation = function () {
454
- return this.getAttribute('rotation');
455
- };
456
- _.prototype.getGeometry = function () {
457
- if (!(Cesium.defined(this.center) &&
458
- Cesium.defined(this.semiMajorAxis) &&
459
- Cesium.defined(this.semiMinorAxis))) {
460
- return;
461
- }
462
- return new Cesium.EllipseGeometry({
463
- ellipsoid: this.ellipsoid,
464
- center: this.center,
465
- semiMajorAxis: this.semiMajorAxis,
466
- semiMinorAxis: this.semiMinorAxis,
467
- rotation: this.rotation,
468
- height: this.height,
469
- vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
470
- stRotation: this.textureRotationAngle,
471
- ellipsoid: this.ellipsoid,
472
- granularity: this.granularity,
473
- });
474
- };
475
- _.prototype.getOutlineGeometry = function () {
476
- return new Cesium.EllipseOutlineGeometry({
477
- center: this.getCenter(),
478
- semiMajorAxis: this.getSemiMajorAxis(),
479
- semiMinorAxis: this.getSemiMinorAxis(),
480
- rotation: this.getRotation(),
481
- });
482
- };
483
- return _;
484
- })();
485
- _.PolylinePrimitive = (function () {
486
- function _(options) {
487
- options = copyOptions(options, defaultPolylineOptions);
488
- this.initialiseOptions(options);
489
- }
490
- _.prototype = new ChangeablePrimitive();
491
- _.prototype.setPositions = function (positions) {
492
- this.setAttribute('positions', positions);
493
- };
494
- _.prototype.setWidth = function (width) {
495
- this.setAttribute('width', width);
496
- };
497
- _.prototype.setGeodesic = function (geodesic) {
498
- this.setAttribute('geodesic', geodesic);
499
- };
500
- _.prototype.getPositions = function () {
501
- return this.getAttribute('positions');
502
- };
503
- _.prototype.getWidth = function () {
504
- return this.getAttribute('width');
505
- };
506
- _.prototype.getGeodesic = function (geodesic) {
507
- return this.getAttribute('geodesic');
508
- };
509
- _.prototype.getGeometry = function () {
510
- if (!Cesium.defined(this.positions) || this.positions.length < 2) {
511
- return;
512
- }
513
- return new Cesium.PolylineGeometry({
514
- positions: this.positions,
515
- height: this.height,
516
- width: this.width < 1 ? 1 : this.width,
517
- vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
518
- ellipsoid: this.ellipsoid,
519
- });
520
- };
521
- return _;
522
- })();
523
- var defaultBillboard = {
524
- iconUrl: './assets/img/dragIcon.png',
525
- shiftX: 0,
526
- shiftY: 0,
527
- };
528
- var dragBillboard = {
529
- iconUrl: './assets/img/dragIcon.png',
530
- shiftX: 0,
531
- shiftY: 0,
532
- };
533
- var dragHalfBillboard = {
534
- iconUrl: './assets/img/dragIconLight.png',
535
- shiftX: 0,
536
- shiftY: 0,
537
- };
538
- _.prototype.createBillboardGroup = function (points, options, callbacks) {
539
- var markers = new _.BillboardGroup(this, options);
540
- markers.addBillboards(points, callbacks);
541
- return markers;
542
- };
543
- _.BillboardGroup = function (drawHelper, options) {
544
- this._drawHelper = drawHelper;
545
- this._scene = drawHelper._scene;
546
- this._options = copyOptions(options, defaultBillboard);
547
- // create one common billboard collection for all billboards
548
- var b = new Cesium.BillboardCollection();
549
- this._scene.primitives.add(b);
550
- this._billboards = b;
551
- // keep an ordered list of billboards
552
- this._orderedBillboards = [];
553
- };
554
- _.BillboardGroup.prototype.createBillboard = function (position, callbacks) {
555
- var billboard = this._billboards.add({
556
- show: true,
557
- position: position,
558
- pixelOffset: new Cesium.Cartesian2(this._options.shiftX, this._options.shiftY),
559
- eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0),
560
- horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
561
- verticalOrigin: Cesium.VerticalOrigin.CENTER,
562
- scale: 1.0,
563
- image: this._options.iconUrl,
564
- color: drawingVertexColor,
565
- });
566
- // if editable
567
- if (callbacks) {
568
- var _self = this;
569
- var screenSpaceCameraController = this._scene.screenSpaceCameraController;
570
- function enableRotation(enable) {
571
- screenSpaceCameraController.enableRotate = enable;
572
- }
573
- function getIndex() {
574
- // find index
575
- for (var i = 0, I = _self._orderedBillboards.length; i < I && _self._orderedBillboards[i] != billboard; ++i)
576
- ;
577
- return i;
578
- }
579
- if (callbacks.dragHandlers) {
580
- var _self = this;
581
- setListener(billboard, 'leftDown', function (position) {
582
- // TODO - start the drag handlers here
583
- // create handlers for mouseOut and leftUp for the billboard and a mouseMove
584
- function onDrag(position) {
585
- billboard.position = position;
586
- // find index
587
- for (var i = 0, I = _self._orderedBillboards.length; i < I && _self._orderedBillboards[i] != billboard; ++i)
588
- ;
589
- callbacks.dragHandlers.onDrag &&
590
- callbacks.dragHandlers.onDrag(getIndex(), position);
591
- }
592
- function onDragEnd(position) {
593
- handler.destroy();
594
- enableRotation(true);
595
- callbacks.dragHandlers.onDragEnd &&
596
- callbacks.dragHandlers.onDragEnd(getIndex(), position);
597
- }
598
- var handler = new Cesium.ScreenSpaceEventHandler(_self._scene.canvas);
599
- handler.setInputAction(function (movement) {
600
- var cartesian = _self._scene.camera.pickEllipsoid(movement.endPosition, ellipsoid);
601
- if (cartesian) {
602
- onDrag(cartesian);
603
- }
604
- else {
605
- onDragEnd(cartesian);
606
- }
607
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
608
- handler.setInputAction(function (movement) {
609
- onDragEnd(_self._scene.camera.pickEllipsoid(movement.position, ellipsoid));
610
- }, Cesium.ScreenSpaceEventType.LEFT_UP);
611
- enableRotation(false);
612
- callbacks.dragHandlers.onDragStart &&
613
- callbacks.dragHandlers.onDragStart(getIndex(), _self._scene.camera.pickEllipsoid(position, ellipsoid));
614
- });
615
- }
616
- if (callbacks.onDoubleClick) {
617
- setListener(billboard, 'leftDoubleClick', function (position) {
618
- callbacks.onDoubleClick(getIndex());
619
- });
620
- }
621
- if (callbacks.onClick) {
622
- setListener(billboard, 'leftClick', function (position) {
623
- callbacks.onClick(getIndex());
624
- });
625
- }
626
- if (callbacks.tooltip) {
627
- setListener(billboard, 'mouseMove', function (position) {
628
- _self._drawHelper._tooltip.showAt(position, callbacks.tooltip());
629
- });
630
- setListener(billboard, 'mouseOut', function (position) {
631
- _self._drawHelper._tooltip.setVisible(false);
632
- });
633
- }
634
- }
635
- return billboard;
636
- };
637
- _.BillboardGroup.prototype.insertBillboard = function (index, position, callbacks) {
638
- this._orderedBillboards.splice(index, 0, this.createBillboard(position, callbacks));
639
- };
640
- _.BillboardGroup.prototype.addBillboard = function (position, callbacks) {
641
- this._orderedBillboards.push(this.createBillboard(position, callbacks));
642
- };
643
- _.BillboardGroup.prototype.addBillboards = function (positions, callbacks) {
644
- var index = 0;
645
- for (; index < positions.length; index++) {
646
- this.addBillboard(positions[index], callbacks);
647
- }
648
- };
649
- _.BillboardGroup.prototype.updateBillboardsPositions = function (positions) {
650
- var index = 0;
651
- for (; index < positions.length; index++) {
652
- this.getBillboard(index).position = positions[index];
653
- }
654
- };
655
- _.BillboardGroup.prototype.countBillboards = function () {
656
- return this._orderedBillboards.length;
657
- };
658
- _.BillboardGroup.prototype.getBillboard = function (index) {
659
- return this._orderedBillboards[index];
660
- };
661
- _.BillboardGroup.prototype.removeBillboard = function (index) {
662
- this._billboards.remove(this.getBillboard(index));
663
- this._orderedBillboards.splice(index, 1);
664
- };
665
- _.BillboardGroup.prototype.remove = function () {
666
- this._billboards =
667
- this._billboards &&
668
- this._billboards.removeAll() &&
669
- this._billboards.destroy();
670
- };
671
- _.BillboardGroup.prototype.setOnTop = function () {
672
- this._scene.primitives.raiseToTop(this._billboards);
673
- };
674
- _.prototype.startDrawingMarker = function (options) {
675
- var options = copyOptions(options, defaultBillboard);
676
- this.startDrawing(function () {
677
- markers.remove();
678
- mouseHandler.destroy();
679
- tooltip.setVisible(false);
680
- });
681
- var _self = this;
682
- var scene = this._scene;
683
- var primitives = scene.primitives;
684
- var tooltip = this._tooltip;
685
- var markers = new _.BillboardGroup(this, options);
686
- var mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
687
- // Now wait for start
688
- mouseHandler.setInputAction(function (movement) {
689
- if (movement.position != null) {
690
- var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);
691
- if (cartesian) {
692
- markers.addBillboard(cartesian);
693
- _self.stopDrawing();
694
- options.callback(cartesian);
695
- }
696
- }
697
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
698
- mouseHandler.setInputAction(function (movement) {
699
- var position = movement.endPosition;
700
- if (position != null) {
701
- var cartesian = scene.camera.pickEllipsoid(position, ellipsoid);
702
- if (cartesian) {
703
- tooltip.showAt(position, '<p>Click to add your marker. Position is: </p>' +
704
- getDisplayLatLngString(ellipsoid.cartesianToCartographic(cartesian)));
705
- }
706
- else {
707
- tooltip.showAt(position, '<p>Click on the globe to add your marker.</p>');
708
- }
709
- }
710
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
711
- };
712
- _.prototype.startDrawingPolygon = function (options) {
713
- var options = copyOptions(options, defaultSurfaceOptions);
714
- this.startDrawingPolyshape(true, options);
715
- };
716
- _.prototype.startDrawingPolyline = function (options) {
717
- var options = copyOptions(options, defaultPolylineOptions);
718
- this.startDrawingPolyshape(false, options);
719
- };
720
- _.prototype.startDrawingPolyshape = function (isPolygon, options) {
721
- this.startDrawing(function () {
722
- primitives.remove(poly);
723
- markers.remove();
724
- mouseHandler.destroy();
725
- tooltip.setVisible(false);
726
- unsetDrawCursor(scene);
727
- });
728
- var _self = this;
729
- var scene = this._scene;
730
- var primitives = scene.primitives;
731
- var tooltip = this._tooltip;
732
- var minPoints = isPolygon ? 3 : 2;
733
- var poly;
734
- if (isPolygon) {
735
- poly = new DrawHelper.PolygonPrimitive(options);
736
- }
737
- else {
738
- poly = new DrawHelper.PolylinePrimitive(options);
739
- }
740
- poly.asynchronous = false;
741
- primitives.add(poly);
742
- var positions = [];
743
- var markers = new _.BillboardGroup(this, defaultBillboard);
744
- var mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
745
- setDrawCursor(scene);
746
- // Now wait for start
747
- mouseHandler.setInputAction(function (movement) {
748
- if (movement.position != null) {
749
- var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);
750
- if (cartesian) {
751
- // first click
752
- if (positions.length == 0) {
753
- positions.push(cartesian.clone());
754
- markers.addBillboard(positions[0]);
755
- }
756
- if (positions.length >= minPoints) {
757
- poly.positions = positions;
758
- poly._createPrimitive = true;
759
- }
760
- // add new point to polygon
761
- // this one will move with the mouse
762
- positions.push(cartesian);
763
- // add marker at the new position
764
- markers.addBillboard(cartesian);
765
- }
766
- }
767
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
768
- mouseHandler.setInputAction(function (movement) {
769
- var position = movement.endPosition;
770
- if (position != null) {
771
- if (positions.length == 0) {
772
- tooltip.showAt(position, '<p>Click to add first point</p>');
773
- }
774
- else {
775
- var cartesian = scene.camera.pickEllipsoid(position, ellipsoid);
776
- if (cartesian) {
777
- positions.pop();
778
- // make sure it is slightly different
779
- cartesian.y += 1 + Math.random();
780
- positions.push(cartesian);
781
- if (positions.length >= minPoints) {
782
- poly.positions = positions;
783
- poly._createPrimitive = true;
784
- }
785
- // update marker
786
- markers.getBillboard(positions.length - 1).position = cartesian;
787
- // show tooltip
788
- tooltip.showAt(position, '<p>Click to add new point (' +
789
- positions.length +
790
- ')</p>' +
791
- (positions.length > minPoints
792
- ? '<p>Double click to finish drawing</p>'
793
- : ''));
794
- }
795
- }
796
- }
797
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
798
- mouseHandler.setInputAction(function (movement) {
799
- var position = movement.position;
800
- if (position != null) {
801
- if (positions.length < minPoints + 2) {
802
- return;
803
- }
804
- else {
805
- var cartesian = scene.camera.pickEllipsoid(position, ellipsoid);
806
- if (cartesian) {
807
- unsetDrawCursor(scene);
808
- _self.stopDrawing();
809
- if (typeof options.callback == 'function') {
810
- // remove overlapping ones
811
- var index = positions.length - 1;
812
- options.callback(positions);
813
- }
814
- }
815
- }
816
- }
817
- }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
818
- };
819
- function getExtentCorners(value) {
820
- return ellipsoid.cartographicArrayToCartesianArray([
821
- Cesium.Rectangle.northwest(value),
822
- Cesium.Rectangle.northeast(value),
823
- Cesium.Rectangle.southeast(value),
824
- Cesium.Rectangle.southwest(value),
825
- ]);
826
- }
827
- // MC_CHANGE add to change draw mode cursor
828
- function setDrawCursor(scene) {
829
- if (scene) {
830
- scene.canvas.style.cursor = 'crosshair';
831
- }
832
- }
833
- // MC_CHANGE add to restore regular mode
834
- function unsetDrawCursor(scene) {
835
- if (scene) {
836
- scene.canvas.style.cursor = '';
837
- }
838
- }
839
- _.prototype.startDrawingExtent = function (options) {
840
- var options = copyOptions(options, defaultSurfaceOptions);
841
- this.startDrawing(function () {
842
- if (extent != null) {
843
- primitives.remove(extent);
844
- }
845
- //MC_CHANGE if added
846
- if (markers != null) {
847
- markers.remove();
848
- }
849
- mouseHandler.destroy();
850
- tooltip.setVisible(false);
851
- unsetDrawCursor(scene);
852
- });
853
- var _self = this;
854
- var scene = this._scene;
855
- var primitives = this._scene.primitives;
856
- var tooltip = this._tooltip;
857
- var firstPoint = null;
858
- var extent = null;
859
- var markers = null;
860
- var mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
861
- setDrawCursor(scene);
862
- function updateExtent(value) {
863
- if (extent == null) {
864
- //MC_CHANGE
865
- extent = new DrawHelper.ExtentPrimitive({
866
- extent: value,
867
- material: options.material,
868
- });
869
- //extent = new Cesium.RectanglePrimitive();
870
- extent.asynchronous = false;
871
- primitives.add(extent);
872
- }
873
- extent.setExtent(value);
874
- // update the markers
875
- var corners = getExtentCorners(value);
876
- // create if they do not yet exist
877
- if (markers == null) {
878
- markers = new _.BillboardGroup(_self, defaultBillboard);
879
- markers.addBillboards(corners);
880
- }
881
- else {
882
- markers.updateBillboardsPositions(corners);
883
- }
884
- }
885
- // Now wait for start
886
- mouseHandler.setInputAction(function (movement) {
887
- if (movement.position != null) {
888
- var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);
889
- if (cartesian) {
890
- if (extent == null) {
891
- // create the rectangle
892
- firstPoint = ellipsoid.cartesianToCartographic(cartesian);
893
- var value = getExtent(firstPoint, firstPoint);
894
- updateExtent(value);
895
- }
896
- else {
897
- _self.stopDrawing();
898
- if (typeof options.callback == 'function') {
899
- options.callback(getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian)));
900
- }
901
- }
902
- }
903
- }
904
- }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
905
- mouseHandler.setInputAction(function (movement) {
906
- var position = movement.endPosition;
907
- if (position != null) {
908
- if (extent == null) {
909
- tooltip.showAt(position, '<p>Click to start drawing rectangle</p>');
910
- }
911
- else {
912
- var cartesian = scene.camera.pickEllipsoid(position, ellipsoid);
913
- if (cartesian) {
914
- var value = getExtent(firstPoint, ellipsoid.cartesianToCartographic(cartesian));
915
- updateExtent(value);
916
- tooltip.showAt(position, '<p>Drag to change rectangle extent</p><p>Click again to finish drawing</p>');
917
- }
918
- }
919
- }
920
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
921
- };
922
- _.prototype.startDrawingCircle = function (options) {
923
- var options = copyOptions(options, defaultSurfaceOptions);
924
- this.startDrawing(function cleanUp() {
925
- if (circle != null) {
926
- primitives.remove(circle);
927
- }
928
- markers.remove();
929
- mouseHandler.destroy();
930
- tooltip.setVisible(false);
931
- });
932
- var _self = this;
933
- var scene = this._scene;
934
- var primitives = this._scene.primitives;
935
- var tooltip = this._tooltip;
936
- var circle = null;
937
- var markers = null;
938
- var mouseHandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
939
- // Now wait for start
940
- mouseHandler.setInputAction(function (movement) {
941
- if (movement.position != null) {
942
- var cartesian = scene.camera.pickEllipsoid(movement.position, ellipsoid);
943
- if (cartesian) {
944
- if (circle == null) {
945
- // create the circle
946
- circle = new _.CirclePrimitive({
947
- center: cartesian,
948
- radius: 0,
949
- asynchronous: false,
950
- material: options.material,
951
- });
952
- primitives.add(circle);
953
- markers = new _.BillboardGroup(_self, defaultBillboard);
954
- markers.addBillboards([cartesian]);
955
- }
956
- else {
957
- if (typeof options.callback == 'function') {
958
- options.callback(circle.getCenter(), circle.getRadius());
959
- }
960
- _self.stopDrawing();
961
- }
962
- }
963
- }
964
- }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
965
- mouseHandler.setInputAction(function (movement) {
966
- var position = movement.endPosition;
967
- if (position != null) {
968
- if (circle == null) {
969
- tooltip.showAt(position, '<p>Click to start drawing the circle</p>');
970
- }
971
- else {
972
- var cartesian = scene.camera.pickEllipsoid(position, ellipsoid);
973
- if (cartesian) {
974
- circle.setRadius(Cesium.Cartesian3.distance(circle.getCenter(), cartesian));
975
- markers.updateBillboardsPositions(cartesian);
976
- tooltip.showAt(position, '<p>Move mouse to change circle radius</p><p>Click again to finish drawing</p>');
977
- }
978
- }
979
- }
980
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
981
- };
982
- _.prototype.enhancePrimitives = function () {
983
- var drawHelper = this;
984
- Cesium.Billboard.prototype.setEditable = function () {
985
- if (this._editable) {
986
- return;
987
- }
988
- this._editable = true;
989
- var billboard = this;
990
- var _self = this;
991
- function enableRotation(enable) {
992
- drawHelper._scene.screenSpaceCameraController.enableRotate = enable;
993
- }
994
- setListener(billboard, 'leftDown', function (position) {
995
- // TODO - start the drag handlers here
996
- // create handlers for mouseOut and leftUp for the billboard and a mouseMove
997
- function onDrag(position) {
998
- billboard.position = position;
999
- _self.executeListeners({ name: 'drag', positions: position });
1000
- }
1001
- function onDragEnd(position) {
1002
- handler.destroy();
1003
- enableRotation(true);
1004
- _self.executeListeners({ name: 'dragEnd', positions: position });
1005
- }
1006
- var handler = new Cesium.ScreenSpaceEventHandler(drawHelper._scene.canvas);
1007
- handler.setInputAction(function (movement) {
1008
- var cartesian = drawHelper._scene.camera.pickEllipsoid(movement.endPosition, ellipsoid);
1009
- if (cartesian) {
1010
- onDrag(cartesian);
1011
- }
1012
- else {
1013
- onDragEnd(cartesian);
1014
- }
1015
- }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
1016
- handler.setInputAction(function (movement) {
1017
- onDragEnd(drawHelper._scene.camera.pickEllipsoid(movement.position, ellipsoid));
1018
- }, Cesium.ScreenSpaceEventType.LEFT_UP);
1019
- enableRotation(false);
1020
- });
1021
- enhanceWithListeners(billboard);
1022
- };
1023
- function setHighlighted(highlighted) {
1024
- var scene = drawHelper._scene;
1025
- // if no change
1026
- // if already highlighted, the outline polygon will be available
1027
- if (this._highlighted && this._highlighted == highlighted) {
1028
- return;
1029
- }
1030
- // disable if already in edit mode
1031
- if (this._editMode === true) {
1032
- return;
1033
- }
1034
- this._highlighted = highlighted;
1035
- // highlight by creating an outline polygon matching the polygon points
1036
- if (highlighted) {
1037
- // make sure all other shapes are not highlighted
1038
- drawHelper.setHighlighted(this);
1039
- this._strokeColor = this.strokeColor;
1040
- this.setStrokeStyle(Cesium.Color.fromCssColorString('white'), this.strokeWidth);
1041
- }
1042
- else {
1043
- if (this._strokeColor) {
1044
- this.setStrokeStyle(this._strokeColor, this.strokeWidth);
1045
- }
1046
- else {
1047
- this.setStrokeStyle(undefined, undefined);
1048
- }
1049
- }
1050
- }
1051
- function setEditMode(editMode) {
1052
- // if no change
1053
- if (this._editMode == editMode) {
1054
- return;
1055
- }
1056
- // make sure all other shapes are not in edit mode before starting the editing of this shape
1057
- drawHelper.disableAllHighlights();
1058
- // display markers
1059
- if (editMode) {
1060
- drawHelper.setEdited(this);
1061
- var scene = drawHelper._scene;
1062
- var _self = this;
1063
- // create the markers and handlers for the editing
1064
- if (this._markers == null) {
1065
- var markers = new _.BillboardGroup(drawHelper, dragBillboard);
1066
- var editMarkers = new _.BillboardGroup(drawHelper, dragHalfBillboard);
1067
- // function for updating the edit markers around a certain point
1068
- function updateHalfMarkers(index, positions) {
1069
- // update the half markers before and after the index
1070
- var editIndex = index - 1 < 0 ? positions.length - 1 : index - 1;
1071
- if (editIndex < editMarkers.countBillboards()) {
1072
- editMarkers.getBillboard(editIndex).position = calculateHalfMarkerPosition(editIndex);
1073
- }
1074
- editIndex = index;
1075
- if (editIndex < editMarkers.countBillboards()) {
1076
- editMarkers.getBillboard(editIndex).position = calculateHalfMarkerPosition(editIndex);
1077
- }
1078
- }
1079
- function onEdited() {
1080
- _self.executeListeners({
1081
- name: 'onEdited',
1082
- positions: _self.positions,
1083
- });
1084
- }
1085
- var handleMarkerChanges = {
1086
- dragHandlers: {
1087
- onDrag: function (index, position) {
1088
- _self.positions[index] = position;
1089
- updateHalfMarkers(index, _self.positions);
1090
- _self._createPrimitive = true;
1091
- },
1092
- onDragEnd: function (index, position) {
1093
- _self._createPrimitive = true;
1094
- onEdited();
1095
- },
1096
- },
1097
- onDoubleClick: function (index) {
1098
- if (_self.positions.length < 4) {
1099
- return;
1100
- }
1101
- // remove the point and the corresponding markers
1102
- _self.positions.splice(index, 1);
1103
- _self._createPrimitive = true;
1104
- markers.removeBillboard(index);
1105
- editMarkers.removeBillboard(index);
1106
- updateHalfMarkers(index, _self.positions);
1107
- onEdited();
1108
- },
1109
- tooltip: function () {
1110
- if (_self.positions.length > 3) {
1111
- return 'Double click to remove this point';
1112
- }
1113
- },
1114
- };
1115
- // add billboards and keep an ordered list of them for the polygon edges
1116
- markers.addBillboards(_self.positions, handleMarkerChanges);
1117
- this._markers = markers;
1118
- function calculateHalfMarkerPosition(index) {
1119
- var positions = _self.positions;
1120
- return ellipsoid.cartographicToCartesian(new Cesium.EllipsoidGeodesic(ellipsoid.cartesianToCartographic(positions[index]), ellipsoid.cartesianToCartographic(positions[index < positions.length - 1 ? index + 1 : 0])).interpolateUsingFraction(0.5));
1121
- }
1122
- var halfPositions = [];
1123
- var index = 0;
1124
- var length = _self.positions.length + (this.isPolygon ? 0 : -1);
1125
- for (; index < length; index++) {
1126
- halfPositions.push(calculateHalfMarkerPosition(index));
1127
- }
1128
- var handleEditMarkerChanges = {
1129
- dragHandlers: {
1130
- onDragStart: function (index, position) {
1131
- // add a new position to the polygon but not a new marker yet
1132
- this.index = index + 1;
1133
- _self.positions.splice(this.index, 0, position);
1134
- _self._createPrimitive = true;
1135
- },
1136
- onDrag: function (index, position) {
1137
- _self.positions[this.index] = position;
1138
- _self._createPrimitive = true;
1139
- },
1140
- onDragEnd: function (index, position) {
1141
- // create new sets of makers for editing
1142
- markers.insertBillboard(this.index, position, handleMarkerChanges);
1143
- editMarkers.getBillboard(this.index - 1).position = calculateHalfMarkerPosition(this.index - 1);
1144
- editMarkers.insertBillboard(this.index, calculateHalfMarkerPosition(this.index), handleEditMarkerChanges);
1145
- _self._createPrimitive = true;
1146
- onEdited();
1147
- },
1148
- },
1149
- tooltip: function () {
1150
- return 'Drag to create a new point';
1151
- },
1152
- };
1153
- editMarkers.addBillboards(halfPositions, handleEditMarkerChanges);
1154
- this._editMarkers = editMarkers;
1155
- // add a handler for clicking in the globe
1156
- this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
1157
- this._globeClickhandler.setInputAction(function (movement) {
1158
- var pickedObject = scene.pick(movement.position);
1159
- if (!(pickedObject && pickedObject.primitive)) {
1160
- _self.setEditMode(false);
1161
- }
1162
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
1163
- // set on top of the polygon
1164
- markers.setOnTop();
1165
- editMarkers.setOnTop();
1166
- }
1167
- this._editMode = true;
1168
- }
1169
- else {
1170
- if (this._markers != null) {
1171
- this._markers.remove();
1172
- this._editMarkers.remove();
1173
- this._markers = null;
1174
- this._editMarkers = null;
1175
- this._globeClickhandler.destroy();
1176
- }
1177
- this._editMode = false;
1178
- }
1179
- }
1180
- DrawHelper.PolylinePrimitive.prototype.setEditable = function () {
1181
- if (this.setEditMode) {
1182
- return;
1183
- }
1184
- var polyline = this;
1185
- polyline.isPolygon = false;
1186
- polyline.asynchronous = false;
1187
- drawHelper.registerEditableShape(polyline);
1188
- polyline.setEditMode = setEditMode;
1189
- var originalWidth = this.width;
1190
- polyline.setHighlighted = function (highlighted) {
1191
- // disable if already in edit mode
1192
- if (this._editMode === true) {
1193
- return;
1194
- }
1195
- if (highlighted) {
1196
- drawHelper.setHighlighted(this);
1197
- this.setWidth(originalWidth * 2);
1198
- }
1199
- else {
1200
- this.setWidth(originalWidth);
1201
- }
1202
- };
1203
- polyline.getExtent = function () {
1204
- return Cesium.Extent.fromCartographicArray(ellipsoid.cartesianArrayToCartographicArray(this.positions));
1205
- };
1206
- enhanceWithListeners(polyline);
1207
- polyline.setEditMode(false);
1208
- };
1209
- DrawHelper.PolygonPrimitive.prototype.setEditable = function () {
1210
- var polygon = this;
1211
- polygon.asynchronous = false;
1212
- var scene = drawHelper._scene;
1213
- drawHelper.registerEditableShape(polygon);
1214
- polygon.setEditMode = setEditMode;
1215
- polygon.setHighlighted = setHighlighted;
1216
- enhanceWithListeners(polygon);
1217
- polygon.setEditMode(false);
1218
- };
1219
- DrawHelper.ExtentPrimitive.prototype.setEditable = function () {
1220
- if (this.setEditMode) {
1221
- return;
1222
- }
1223
- var extent = this;
1224
- var scene = drawHelper._scene;
1225
- drawHelper.registerEditableShape(extent);
1226
- extent.asynchronous = false;
1227
- extent.setEditMode = function (editMode) {
1228
- // if no change
1229
- if (this._editMode == editMode) {
1230
- return;
1231
- }
1232
- drawHelper.disableAllHighlights();
1233
- // display markers
1234
- if (editMode) {
1235
- // make sure all other shapes are not in edit mode before starting the editing of this shape
1236
- drawHelper.setEdited(this);
1237
- // create the markers and handlers for the editing
1238
- if (this._markers == null) {
1239
- var markers = new _.BillboardGroup(drawHelper, dragBillboard);
1240
- function onEdited() {
1241
- extent.executeListeners({
1242
- name: 'onEdited',
1243
- extent: extent.extent,
1244
- });
1245
- }
1246
- var handleMarkerChanges = {
1247
- dragHandlers: {
1248
- onDrag: function (index, position) {
1249
- var corner = markers.getBillboard((index + 2) % 4).position;
1250
- extent.setExtent(getExtent(ellipsoid.cartesianToCartographic(corner), ellipsoid.cartesianToCartographic(position)));
1251
- markers.updateBillboardsPositions(getExtentCorners(extent.extent));
1252
- },
1253
- onDragEnd: function (index, position) {
1254
- onEdited();
1255
- },
1256
- },
1257
- tooltip: function () {
1258
- return 'Drag to change the corners of this extent';
1259
- },
1260
- };
1261
- markers.addBillboards(getExtentCorners(extent.extent), handleMarkerChanges);
1262
- this._markers = markers;
1263
- // add a handler for clicking in the globe
1264
- this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
1265
- this._globeClickhandler.setInputAction(function (movement) {
1266
- var pickedObject = scene.pick(movement.position);
1267
- // disable edit if pickedobject is different or not an object
1268
- if (!(pickedObject &&
1269
- !pickedObject.isDestroyed() &&
1270
- pickedObject.primitive)) {
1271
- extent.setEditMode(false);
1272
- }
1273
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
1274
- // set on top of the polygon
1275
- markers.setOnTop();
1276
- }
1277
- this._editMode = true;
1278
- }
1279
- else {
1280
- if (this._markers != null) {
1281
- this._markers.remove();
1282
- this._markers = null;
1283
- this._globeClickhandler.destroy();
1284
- }
1285
- this._editMode = false;
1286
- }
1287
- };
1288
- extent.setHighlighted = setHighlighted;
1289
- enhanceWithListeners(extent);
1290
- extent.setEditMode(false);
1291
- };
1292
- _.EllipsePrimitive.prototype.setEditable = function () {
1293
- if (this.setEditMode) {
1294
- return;
1295
- }
1296
- var ellipse = this;
1297
- var scene = drawHelper._scene;
1298
- ellipse.asynchronous = false;
1299
- drawHelper.registerEditableShape(ellipse);
1300
- ellipse.setEditMode = function (editMode) {
1301
- // if no change
1302
- if (this._editMode == editMode) {
1303
- return;
1304
- }
1305
- drawHelper.disableAllHighlights();
1306
- // display markers
1307
- if (editMode) {
1308
- // make sure all other shapes are not in edit mode before starting the editing of this shape
1309
- drawHelper.setEdited(this);
1310
- var _self = this;
1311
- // create the markers and handlers for the editing
1312
- if (this._markers == null) {
1313
- var markers = new _.BillboardGroup(drawHelper, dragBillboard);
1314
- function getMarkerPositions() {
1315
- return Cesium.Shapes.computeEllipseBoundary(ellipsoid, ellipse.getCenter(), ellipse.getSemiMajorAxis(), ellipse.getSemiMinorAxis(), ellipse.getRotation() + Math.PI / 2, Math.PI / 2.0).splice(0, 4);
1316
- }
1317
- function onEdited() {
1318
- ellipse.executeListeners({
1319
- name: 'onEdited',
1320
- center: ellipse.getCenter(),
1321
- semiMajorAxis: ellipse.getSemiMajorAxis(),
1322
- semiMinorAxis: ellipse.getSemiMinorAxis(),
1323
- rotation: 0,
1324
- });
1325
- }
1326
- var handleMarkerChanges = {
1327
- dragHandlers: {
1328
- onDrag: function (index, position) {
1329
- var distance = Cesium.Cartesian3.distance(ellipse.getCenter(), position);
1330
- if (index % 2 == 0) {
1331
- ellipse.setSemiMajorAxis(distance);
1332
- }
1333
- else {
1334
- ellipse.setSemiMinorAxis(distance);
1335
- }
1336
- markers.updateBillboardsPositions(getMarkerPositions());
1337
- },
1338
- onDragEnd: function (index, position) {
1339
- onEdited();
1340
- },
1341
- },
1342
- tooltip: function () {
1343
- return 'Drag to change the excentricity and radius';
1344
- },
1345
- };
1346
- markers.addBillboards(getMarkerPositions(), handleMarkerChanges);
1347
- this._markers = markers;
1348
- // add a handler for clicking in the globe
1349
- this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
1350
- this._globeClickhandler.setInputAction(function (movement) {
1351
- var pickedObject = scene.pick(movement.position);
1352
- if (!(pickedObject && pickedObject.primitive)) {
1353
- _self.setEditMode(false);
1354
- }
1355
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
1356
- // set on top of the polygon
1357
- markers.setOnTop();
1358
- }
1359
- this._editMode = true;
1360
- }
1361
- else {
1362
- if (this._markers != null) {
1363
- this._markers.remove();
1364
- this._markers = null;
1365
- this._globeClickhandler.destroy();
1366
- }
1367
- this._editMode = false;
1368
- }
1369
- };
1370
- ellipse.setHighlighted = setHighlighted;
1371
- enhanceWithListeners(ellipse);
1372
- ellipse.setEditMode(false);
1373
- };
1374
- _.CirclePrimitive.prototype.getCircleCartesianCoordinates = function (granularity) {
1375
- var geometry = Cesium.CircleOutlineGeometry.createGeometry(new Cesium.CircleOutlineGeometry({
1376
- ellipsoid: ellipsoid,
1377
- center: this.getCenter(),
1378
- radius: this.getRadius(),
1379
- granularity: granularity,
1380
- }));
1381
- var count = 0, value, values = [];
1382
- for (; count < geometry.attributes.position.values.length; count += 3) {
1383
- value = geometry.attributes.position.values;
1384
- values.push(new Cesium.Cartesian3(value[count], value[count + 1], value[count + 2]));
1385
- }
1386
- return values;
1387
- };
1388
- _.CirclePrimitive.prototype.setEditable = function () {
1389
- if (this.setEditMode) {
1390
- return;
1391
- }
1392
- var circle = this;
1393
- var scene = drawHelper._scene;
1394
- circle.asynchronous = false;
1395
- drawHelper.registerEditableShape(circle);
1396
- circle.setEditMode = function (editMode) {
1397
- // if no change
1398
- if (this._editMode == editMode) {
1399
- return;
1400
- }
1401
- drawHelper.disableAllHighlights();
1402
- // display markers
1403
- if (editMode) {
1404
- // make sure all other shapes are not in edit mode before starting the editing of this shape
1405
- drawHelper.setEdited(this);
1406
- var _self = this;
1407
- // create the markers and handlers for the editing
1408
- if (this._markers == null) {
1409
- var markers = new _.BillboardGroup(drawHelper, dragBillboard);
1410
- function getMarkerPositions() {
1411
- return _self.getCircleCartesianCoordinates(Cesium.Math.PI_OVER_TWO);
1412
- }
1413
- function onEdited() {
1414
- circle.executeListeners({
1415
- name: 'onEdited',
1416
- center: circle.getCenter(),
1417
- radius: circle.getRadius(),
1418
- });
1419
- }
1420
- var handleMarkerChanges = {
1421
- dragHandlers: {
1422
- onDrag: function (index, position) {
1423
- circle.setRadius(Cesium.Cartesian3.distance(circle.getCenter(), position));
1424
- markers.updateBillboardsPositions(getMarkerPositions());
1425
- },
1426
- onDragEnd: function (index, position) {
1427
- onEdited();
1428
- },
1429
- },
1430
- tooltip: function () {
1431
- return 'Drag to change the radius';
1432
- },
1433
- };
1434
- markers.addBillboards(getMarkerPositions(), handleMarkerChanges);
1435
- this._markers = markers;
1436
- // add a handler for clicking in the globe
1437
- this._globeClickhandler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
1438
- this._globeClickhandler.setInputAction(function (movement) {
1439
- var pickedObject = scene.pick(movement.position);
1440
- if (!(pickedObject && pickedObject.primitive)) {
1441
- _self.setEditMode(false);
1442
- }
1443
- }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
1444
- // set on top of the polygon
1445
- markers.setOnTop();
1446
- }
1447
- this._editMode = true;
1448
- }
1449
- else {
1450
- if (this._markers != null) {
1451
- this._markers.remove();
1452
- this._markers = null;
1453
- this._globeClickhandler.destroy();
1454
- }
1455
- this._editMode = false;
1456
- }
1457
- };
1458
- circle.setHighlighted = setHighlighted;
1459
- enhanceWithListeners(circle);
1460
- circle.setEditMode(false);
1461
- };
1462
- };
1463
- _.DrawHelperWidget = (function () {
1464
- // constructor
1465
- function _(drawHelper, options) {
1466
- // container must be specified
1467
- if (!Cesium.defined(options.container)) {
1468
- throw new Cesium.DeveloperError('Container is required');
1469
- }
1470
- var drawOptions = {
1471
- markerIcon: './assets/img/glyphicons_242_google_maps.png',
1472
- polylineIcon: './assets/img/glyphicons_097_vector_path_line.png',
1473
- polygonIcon: './assets/img/glyphicons_096_vector_path_polygon.png',
1474
- circleIcon: './assets/img/glyphicons_095_vector_path_circle.png',
1475
- extentIcon: './assets/img/glyphicons_094_vector_path_square.png',
1476
- clearIcon: './assets/img/glyphicons_067_cleaning.png',
1477
- polylineDrawingOptions: defaultPolylineOptions,
1478
- polygonDrawingOptions: defaultPolygonOptions,
1479
- extentDrawingOptions: defaultExtentOptions,
1480
- circleDrawingOptions: defaultCircleOptions,
1481
- };
1482
- fillOptions(options, drawOptions);
1483
- var _self = this;
1484
- var toolbar = document.createElement('DIV');
1485
- toolbar.className = 'toolbar';
1486
- options.container.appendChild(toolbar);
1487
- function addIcon(id, url, title, callback) {
1488
- var div = document.createElement('DIV');
1489
- div.className = 'button';
1490
- div.title = title;
1491
- toolbar.appendChild(div);
1492
- div.onclick = callback;
1493
- var span = document.createElement('SPAN');
1494
- div.appendChild(span);
1495
- var image = document.createElement('IMG');
1496
- image.src = url;
1497
- span.appendChild(image);
1498
- return div;
1499
- }
1500
- var scene = drawHelper._scene;
1501
- addIcon('marker', options.markerIcon, 'Click to start drawing a 2D marker', function () {
1502
- drawHelper.startDrawingMarker({
1503
- callback: function (position) {
1504
- _self.executeListeners({
1505
- name: 'markerCreated',
1506
- position: position,
1507
- });
1508
- },
1509
- });
1510
- });
1511
- addIcon('polyline', options.polylineIcon, 'Click to start drawing a 2D polyline', function () {
1512
- drawHelper.startDrawingPolyline({
1513
- callback: function (positions) {
1514
- _self.executeListeners({
1515
- name: 'polylineCreated',
1516
- positions: positions,
1517
- });
1518
- },
1519
- });
1520
- });
1521
- addIcon('polygon', options.polygonIcon, 'Click to start drawing a 2D polygon', function () {
1522
- drawHelper.startDrawingPolygon({
1523
- callback: function (positions) {
1524
- _self.executeListeners({
1525
- name: 'polygonCreated',
1526
- positions: positions,
1527
- });
1528
- },
1529
- });
1530
- });
1531
- addIcon('extent', options.extentIcon, 'Click to start drawing an Extent', function () {
1532
- drawHelper.startDrawingExtent({
1533
- callback: function (extent) {
1534
- _self.executeListeners({ name: 'extentCreated', extent: extent });
1535
- },
1536
- });
1537
- });
1538
- addIcon('circle', options.circleIcon, 'Click to start drawing a Circle', function () {
1539
- drawHelper.startDrawingCircle({
1540
- callback: function (center, radius) {
1541
- _self.executeListeners({
1542
- name: 'circleCreated',
1543
- center: center,
1544
- radius: radius,
1545
- });
1546
- },
1547
- });
1548
- });
1549
- // add a clear button at the end
1550
- // add a divider first
1551
- var div = document.createElement('DIV');
1552
- div.className = 'divider';
1553
- toolbar.appendChild(div);
1554
- addIcon('clear', options.clearIcon, 'Remove all primitives', function () {
1555
- scene.primitives.removeAll();
1556
- });
1557
- enhanceWithListeners(this);
1558
- }
1559
- return _;
1560
- })();
1561
- _.prototype.addToolbar = function (container, options) {
1562
- options = copyOptions(options, { container: container });
1563
- return new _.DrawHelperWidget(this, options);
1564
- };
1565
- function getExtent(mn, mx) {
1566
- var e = new Cesium.Rectangle();
1567
- // Re-order so west < east and south < north
1568
- e.west = Math.min(mn.longitude, mx.longitude);
1569
- e.east = Math.max(mn.longitude, mx.longitude);
1570
- e.south = Math.min(mn.latitude, mx.latitude);
1571
- e.north = Math.max(mn.latitude, mx.latitude);
1572
- // Check for approx equal (shouldn't require abs due to re-order)
1573
- var epsilon = Cesium.Math.EPSILON7;
1574
- if (e.east - e.west < epsilon) {
1575
- e.east += epsilon * 2.0;
1576
- }
1577
- if (e.north - e.south < epsilon) {
1578
- e.north += epsilon * 2.0;
1579
- }
1580
- return e;
1581
- }
1582
- function createTooltip(frameDiv) {
1583
- var tooltip = function (frameDiv) {
1584
- var div = document.createElement('DIV');
1585
- div.className = 'twipsy right';
1586
- var arrow = document.createElement('DIV');
1587
- arrow.className = 'twipsy-arrow';
1588
- div.appendChild(arrow);
1589
- var title = document.createElement('DIV');
1590
- title.className = 'twipsy-inner';
1591
- div.appendChild(title);
1592
- this._div = div;
1593
- this._title = title;
1594
- // add to frame div and display coordinates
1595
- frameDiv.appendChild(div);
1596
- };
1597
- tooltip.prototype.setVisible = function (visible) {
1598
- this._div.style.display = visible ? 'block' : 'none';
1599
- };
1600
- tooltip.prototype.showAt = function (position, message) {
1601
- if (position && message) {
1602
- this.setVisible(true);
1603
- this._title.innerHTML = message;
1604
- this._div.style.left = position.x + 10 + 'px';
1605
- this._div.style.top = position.y - this._div.clientHeight / 2 + 'px';
1606
- }
1607
- };
1608
- return new tooltip(frameDiv);
1609
- }
1610
- function getDisplayLatLngString(cartographic, precision) {
1611
- return (cartographic.longitude.toFixed(precision || 3) +
1612
- ', ' +
1613
- cartographic.latitude.toFixed(precision || 3));
1614
- }
1615
- function clone(from, to) {
1616
- if (from == null || typeof from != 'object')
1617
- return from;
1618
- if (from.constructor != Object && from.constructor != Array)
1619
- return from;
1620
- if (from.constructor == Date ||
1621
- from.constructor == RegExp ||
1622
- from.constructor == Function ||
1623
- from.constructor == String ||
1624
- from.constructor == Number ||
1625
- from.constructor == Boolean)
1626
- return new from.constructor(from);
1627
- to = to || new from.constructor();
1628
- for (var name in from) {
1629
- to[name] =
1630
- typeof to[name] == 'undefined' ? clone(from[name], null) : to[name];
1631
- }
1632
- return to;
1633
- }
1634
- function fillOptions(options, defaultOptions) {
1635
- options = options || {};
1636
- var option;
1637
- for (option in defaultOptions) {
1638
- if (options[option] === undefined) {
1639
- options[option] = clone(defaultOptions[option]);
1640
- }
1641
- }
1642
- }
1643
- // shallow copy
1644
- function copyOptions(options, defaultOptions) {
1645
- var newOptions = clone(options), option;
1646
- for (option in defaultOptions) {
1647
- if (newOptions[option] === undefined) {
1648
- newOptions[option] = clone(defaultOptions[option]);
1649
- }
1650
- }
1651
- return newOptions;
1652
- }
1653
- function setListener(primitive, type, callback) {
1654
- primitive[type] = callback;
1655
- }
1656
- function enhanceWithListeners(element) {
1657
- element._listeners = {};
1658
- element.addListener = function (name, callback) {
1659
- this._listeners[name] = this._listeners[name] || [];
1660
- this._listeners[name].push(callback);
1661
- return this._listeners[name].length;
1662
- };
1663
- element.executeListeners = function (event, defaultCallback) {
1664
- if (this._listeners[event.name] &&
1665
- this._listeners[event.name].length > 0) {
1666
- var index = 0;
1667
- for (; index < this._listeners[event.name].length; index++) {
1668
- this._listeners[event.name][index](event);
1669
- }
1670
- }
1671
- else {
1672
- if (defaultCallback) {
1673
- defaultCallback(event);
1674
- }
1675
- }
1676
- };
1677
- }
1678
- return _;
1679
- })();
1680
- exports.DrawHelper = DrawHelper;
1681
- //# sourceMappingURL=drawHelper.js.map