react-spatial 1.5.3 → 1.5.5

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 (282) hide show
  1. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +262 -0
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +7 -0
  3. package/components/BaseLayerSwitcher/index.js +1 -0
  4. package/components/BaseLayerSwitcher/index.js.map +7 -0
  5. package/{src/components → components}/BasicMap/BasicMap.js +80 -170
  6. package/components/BasicMap/BasicMap.js.map +7 -0
  7. package/components/BasicMap/index.js +1 -0
  8. package/components/BasicMap/index.js.map +7 -0
  9. package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.js +133 -278
  10. package/components/CanvasSaveButton/CanvasSaveButton.js.map +7 -0
  11. package/components/CanvasSaveButton/index.js +1 -0
  12. package/components/CanvasSaveButton/index.js.map +7 -0
  13. package/{src/components → components}/Copyright/Copyright.js +21 -41
  14. package/components/Copyright/Copyright.js.map +7 -0
  15. package/components/Copyright/index.js +1 -0
  16. package/components/Copyright/index.js.map +7 -0
  17. package/components/FeatureExportButton/FeatureExportButton.js +80 -0
  18. package/components/FeatureExportButton/FeatureExportButton.js.map +7 -0
  19. package/components/FeatureExportButton/index.js +1 -0
  20. package/components/FeatureExportButton/index.js.map +7 -0
  21. package/{src/components → components}/FitExtent/FitExtent.js +16 -30
  22. package/components/FitExtent/FitExtent.js.map +7 -0
  23. package/components/FitExtent/index.js +1 -0
  24. package/components/FitExtent/index.js.map +7 -0
  25. package/{src/components → components}/Geolocation/Geolocation.js +60 -110
  26. package/components/Geolocation/Geolocation.js.map +7 -0
  27. package/components/Geolocation/index.js +1 -0
  28. package/components/Geolocation/index.js.map +7 -0
  29. package/{src/components → components}/LayerTree/LayerTree.js +113 -213
  30. package/components/LayerTree/LayerTree.js.map +7 -0
  31. package/components/LayerTree/index.js +1 -0
  32. package/components/LayerTree/index.js.map +7 -0
  33. package/{src/components → components}/MousePosition/MousePosition.js +37 -70
  34. package/components/MousePosition/MousePosition.js.map +7 -0
  35. package/components/MousePosition/index.js +1 -0
  36. package/components/MousePosition/index.js.map +7 -0
  37. package/{src/components → components}/NorthArrow/NorthArrow.js +18 -34
  38. package/components/NorthArrow/NorthArrow.js.map +7 -0
  39. package/components/NorthArrow/index.js +1 -0
  40. package/components/NorthArrow/index.js.map +7 -0
  41. package/{src/components → components}/Overlay/Overlay.js +59 -85
  42. package/components/Overlay/Overlay.js.map +7 -0
  43. package/components/Overlay/index.js +1 -0
  44. package/components/Overlay/index.js.map +7 -0
  45. package/{src/components → components}/Permalink/Permalink.js +64 -147
  46. package/components/Permalink/Permalink.js.map +7 -0
  47. package/components/Permalink/index.js +1 -0
  48. package/components/Permalink/index.js.map +7 -0
  49. package/{src/components → components}/Popup/Popup.js +57 -116
  50. package/components/Popup/Popup.js.map +7 -0
  51. package/components/Popup/index.js +1 -0
  52. package/components/Popup/index.js.map +7 -0
  53. package/{src/components → components}/ResizeHandler/ResizeHandler.js +15 -49
  54. package/components/ResizeHandler/ResizeHandler.js.map +7 -0
  55. package/components/ResizeHandler/index.js +1 -0
  56. package/components/ResizeHandler/index.js.map +7 -0
  57. package/components/RouteSchedule/RouteSchedule.js +268 -0
  58. package/components/RouteSchedule/RouteSchedule.js.map +7 -0
  59. package/components/RouteSchedule/index.js +1 -0
  60. package/components/RouteSchedule/index.js.map +7 -0
  61. package/{src/components → components}/ScaleLine/ScaleLine.js +8 -23
  62. package/components/ScaleLine/ScaleLine.js.map +7 -0
  63. package/components/ScaleLine/index.js +1 -0
  64. package/components/ScaleLine/index.js.map +7 -0
  65. package/{src/components → components}/StopsFinder/StopsFinder.js +74 -103
  66. package/components/StopsFinder/StopsFinder.js.map +7 -0
  67. package/components/StopsFinder/StopsFinderOption.js +44 -0
  68. package/components/StopsFinder/StopsFinderOption.js.map +7 -0
  69. package/components/StopsFinder/index.js +1 -0
  70. package/components/StopsFinder/index.js.map +7 -0
  71. package/{src/components → components}/Zoom/Zoom.js +46 -77
  72. package/components/Zoom/Zoom.js.map +7 -0
  73. package/components/Zoom/index.js +1 -0
  74. package/components/Zoom/index.js.map +7 -0
  75. package/package.json +32 -31
  76. package/{src/propTypes.js → propTypes.js} +30 -16
  77. package/propTypes.js.map +7 -0
  78. package/{src/setupTests.js → setupTests.js} +1 -1
  79. package/setupTests.js.map +7 -0
  80. package/utils/GlobalsForOle.js +94 -0
  81. package/utils/GlobalsForOle.js.map +7 -0
  82. package/utils/KML.js +420 -0
  83. package/utils/KML.js.map +7 -0
  84. package/{src/utils → utils}/KMLFormat.js +29 -32
  85. package/utils/KMLFormat.js.map +7 -0
  86. package/{src/utils → utils}/Styles.js +14 -20
  87. package/utils/Styles.js.map +7 -0
  88. package/{src/utils → utils}/getPolygonPattern.js +6 -34
  89. package/utils/getPolygonPattern.js.map +7 -0
  90. package/{src/utils → utils}/timeUtils.js +5 -22
  91. package/utils/timeUtils.js.map +7 -0
  92. package/.github/workflows/conventional-pr-title.yml +0 -21
  93. package/.github/workflows/main.yml +0 -28
  94. package/.husky/commit-msg +0 -4
  95. package/.husky/post-checkout +0 -4
  96. package/.husky/post-merge +0 -4
  97. package/.husky/post-rebase +0 -4
  98. package/.husky/pre-commit +0 -4
  99. package/.nvmrc +0 -1
  100. package/.whitesource +0 -8
  101. package/CHANGELOG.md +0 -65
  102. package/DEVELOP.md +0 -113
  103. package/__mocks__/mapbox-gl.js +0 -11
  104. package/__mocks__/resize-observer-polyfill.js +0 -9
  105. package/babel.config.js +0 -3
  106. package/commitlint.config.js +0 -1
  107. package/data/topic1.js +0 -119
  108. package/data/topic2.js +0 -28
  109. package/doc/README.md +0 -21
  110. package/doc/doc-config.json +0 -4
  111. package/pull_request_template.md +0 -16
  112. package/renovate.json +0 -4
  113. package/scripts/read-pkg-json.js +0 -17
  114. package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.js +0 -322
  115. package/src/components/BaseLayerSwitcher/BaseLayerSwitcher.test.js +0 -69
  116. package/src/components/BaseLayerSwitcher/README.md +0 -61
  117. package/src/components/BaseLayerSwitcher/__snapshots__/BaseLayerSwitcher.test.js.snap +0 -88
  118. package/src/components/BaseLayerSwitcher/index.js +0 -1
  119. package/src/components/BasicMap/BasicMap.test.js +0 -281
  120. package/src/components/BasicMap/README.md +0 -18
  121. package/src/components/BasicMap/index.js +0 -1
  122. package/src/components/CanvasSaveButton/CanvasSaveButton.test.js +0 -148
  123. package/src/components/CanvasSaveButton/README.md +0 -76
  124. package/src/components/CanvasSaveButton/__snapshots__/CanvasSaveButton.test.js.snap +0 -76
  125. package/src/components/CanvasSaveButton/index.js +0 -1
  126. package/src/components/Copyright/Copyright.test.js +0 -134
  127. package/src/components/Copyright/README.md +0 -36
  128. package/src/components/Copyright/index.js +0 -1
  129. package/src/components/FeatureExportButton/FeatureExportButton.js +0 -118
  130. package/src/components/FeatureExportButton/FeatureExportButton.test.js +0 -417
  131. package/src/components/FeatureExportButton/README.md +0 -76
  132. package/src/components/FeatureExportButton/__snapshots__/FeatureExportButton.test.js.snap +0 -67
  133. package/src/components/FeatureExportButton/index.js +0 -1
  134. package/src/components/FitExtent/FitExtent.test.js +0 -48
  135. package/src/components/FitExtent/README.md +0 -34
  136. package/src/components/FitExtent/__snapshots__/FitExtent.test.js.snap +0 -13
  137. package/src/components/FitExtent/index.js +0 -1
  138. package/src/components/Geolocation/Geolocation.test.js +0 -267
  139. package/src/components/Geolocation/README.md +0 -25
  140. package/src/components/Geolocation/__snapshots__/Geolocation.test.js.snap +0 -92
  141. package/src/components/Geolocation/index.js +0 -1
  142. package/src/components/LayerTree/LayerTree.test.js +0 -337
  143. package/src/components/LayerTree/README.md +0 -92
  144. package/src/components/LayerTree/__snapshots__/LayerTree.test.js.snap +0 -1746
  145. package/src/components/LayerTree/index.js +0 -1
  146. package/src/components/MousePosition/MousePosition.test.js +0 -132
  147. package/src/components/MousePosition/README.md +0 -50
  148. package/src/components/MousePosition/__snapshots__/MousePosition.test.js.snap +0 -76
  149. package/src/components/MousePosition/index.js +0 -1
  150. package/src/components/NorthArrow/NorthArrow.test.js +0 -104
  151. package/src/components/NorthArrow/README.md +0 -59
  152. package/src/components/NorthArrow/__snapshots__/NorthArrow.test.js.snap +0 -117
  153. package/src/components/NorthArrow/index.js +0 -1
  154. package/src/components/Overlay/Overlay.test.js +0 -149
  155. package/src/components/Overlay/README.md +0 -59
  156. package/src/components/Overlay/__snapshots__/Overlay.test.js.snap +0 -9
  157. package/src/components/Overlay/index.js +0 -1
  158. package/src/components/Permalink/Permalink.test.js +0 -285
  159. package/src/components/Permalink/README.md +0 -105
  160. package/src/components/Permalink/index.js +0 -1
  161. package/src/components/Popup/Popup.test.js +0 -307
  162. package/src/components/Popup/README.md +0 -93
  163. package/src/components/Popup/__snapshots__/Popup.test.js.snap +0 -180
  164. package/src/components/Popup/index.js +0 -1
  165. package/src/components/README.md +0 -41
  166. package/src/components/ResizeHandler/ResizeHandler.test.js +0 -344
  167. package/src/components/ResizeHandler/index.js +0 -1
  168. package/src/components/RouteSchedule/README.md +0 -118
  169. package/src/components/RouteSchedule/RouteSchedule.js +0 -370
  170. package/src/components/RouteSchedule/RouteSchedule.test.js +0 -113
  171. package/src/components/RouteSchedule/__snapshots__/RouteSchedule.test.js.snap +0 -248
  172. package/src/components/RouteSchedule/index.js +0 -1
  173. package/src/components/ScaleLine/README.md +0 -29
  174. package/src/components/ScaleLine/ScaleLine.test.js +0 -30
  175. package/src/components/ScaleLine/__snapshots__/ScaleLine.test.js.snap +0 -7
  176. package/src/components/ScaleLine/index.js +0 -1
  177. package/src/components/StopsFinder/README.md +0 -50
  178. package/src/components/StopsFinder/StopsFinder.test.js +0 -17
  179. package/src/components/StopsFinder/StopsFinderOption.js +0 -61
  180. package/src/components/StopsFinder/__snapshots__/StopsFinder.test.js.snap +0 -133
  181. package/src/components/StopsFinder/index.js +0 -1
  182. package/src/components/Zoom/README.md +0 -25
  183. package/src/components/Zoom/Zoom.test.js +0 -141
  184. package/src/components/Zoom/__snapshots__/Zoom.test.js.snap +0 -201
  185. package/src/components/Zoom/index.js +0 -1
  186. package/src/styleguidist/ComponentsList.js +0 -52
  187. package/src/styleguidist/StyleGuide.js +0 -277
  188. package/src/styleguidist/styleguidist.css +0 -38
  189. package/src/utils/GlobalsForOle.js +0 -99
  190. package/src/utils/KML.js +0 -594
  191. package/src/utils/KML.test.js +0 -337
  192. package/src/utils/KMLFormat.test.js +0 -50
  193. package/src/utils/__snapshots__/KML.test.js.snap.KML-readFeatures()-and-writeFeatures()-should-read-and-write-lineDash-and-fillPattern-style-for-polygon.canvas-image.png +0 -0
  194. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-2-(cross)-color-and-(light-blue)-opacity.canvas-image.png +0 -0
  195. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-3-(diagonal-line-from-bottom-left-tot-top-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
  196. package/src/utils/__snapshots__/getPolygonPattern.test.js.snap.getPolygonPattern()-render-pattern-4-(diagonal-line-from-top-left-to-bottom-right)-with-color-(light-blue)-and-opacity.canvas-image.png +0 -0
  197. package/src/utils/getPolygonPattern.test.js +0 -61
  198. package/src/utils/timeUtils.test.js +0 -30
  199. package/styleguide.config.js +0 -251
  200. /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.md.scss +0 -0
  201. /package/{src/components → components}/BaseLayerSwitcher/BaseLayerSwitcher.scss +0 -0
  202. /package/{src/components → components}/BasicMap/BasicMap.md.scss +0 -0
  203. /package/{src/components → components}/CanvasSaveButton/CanvasSaveButton.md.scss +0 -0
  204. /package/{src/components → components}/Copyright/Copyright.md.scss +0 -0
  205. /package/{src/components → components}/FeatureExportButton/FeatureExportButton.md.scss +0 -0
  206. /package/{src/components → components}/FitExtent/FitExtent.md.scss +0 -0
  207. /package/{src/components → components}/Geolocation/Geolocation.md.scss +0 -0
  208. /package/{src/components → components}/Geolocation/Geolocation.scss +0 -0
  209. /package/{src/components → components}/LayerTree/LayerTree.md.scss +0 -0
  210. /package/{src/components → components}/LayerTree/LayerTree.scss +0 -0
  211. /package/{src/components → components}/MousePosition/MousePosition.md.scss +0 -0
  212. /package/{src/components → components}/NorthArrow/NorthArrow.scss +0 -0
  213. /package/{src/components → components}/Overlay/Overlay.md.scss +0 -0
  214. /package/{src/components → components}/Overlay/Overlay.scss +0 -0
  215. /package/{src/components → components}/Permalink/Permalink.md.scss +0 -0
  216. /package/{src/components → components}/Popup/Popup.md.scss +0 -0
  217. /package/{src/components → components}/Popup/Popup.scss +0 -0
  218. /package/{src/components → components}/RouteSchedule/RouteSchedule.md.scss +0 -0
  219. /package/{src/components → components}/RouteSchedule/RouteSchedule.scss +0 -0
  220. /package/{src/components → components}/ScaleLine/ScaleLine.scss +0 -0
  221. /package/{src/components → components}/Zoom/Zoom.md.scss +0 -0
  222. /package/{src/components → components}/Zoom/Zoom.scss +0 -0
  223. /package/{src/images → images}/RouteSchedule/firstStation.png +0 -0
  224. /package/{src/images → images}/RouteSchedule/lastStation.png +0 -0
  225. /package/{src/images → images}/RouteSchedule/line.png +0 -0
  226. /package/{src/images → images}/RouteSchedule/station.png +0 -0
  227. /package/{src/images → images}/baselayer/baselayer.basebright.png +0 -0
  228. /package/{src/images → images}/baselayer/baselayer.osm.png +0 -0
  229. /package/{src/images → images}/baselayer/baselayer.travic.png +0 -0
  230. /package/{src/images → images}/baselayer/open.topo.map.png +0 -0
  231. /package/{src/images → images}/baselayer/osm.baselayer.hot.png +0 -0
  232. /package/{src/images → images}/baselayer/osm.baselayer.png +0 -0
  233. /package/{src/images → images}/favicon.png +0 -0
  234. /package/{src/images → images}/geops_logo.png +0 -0
  235. /package/{src/images → images}/geops_logo.svg +0 -0
  236. /package/{src/images → images}/geops_qr.png +0 -0
  237. /package/{src/images → images}/mots/bus_poi-blue-01.svg +0 -0
  238. /package/{src/images → images}/mots/bus_poi-grey-01.svg +0 -0
  239. /package/{src/images → images}/mots/bus_round-blue-01.svg +0 -0
  240. /package/{src/images → images}/mots/bus_round-grey-01.svg +0 -0
  241. /package/{src/images → images}/mots/bus_square-blue-01.svg +0 -0
  242. /package/{src/images → images}/mots/bus_square-grey-01.svg +0 -0
  243. /package/{src/images → images}/mots/cable_car_poi-blue-01.svg +0 -0
  244. /package/{src/images → images}/mots/cable_car_poi-grey-01.svg +0 -0
  245. /package/{src/images → images}/mots/cable_car_round-blue-01.svg +0 -0
  246. /package/{src/images → images}/mots/cable_car_round-grey-01.svg +0 -0
  247. /package/{src/images → images}/mots/cable_car_square-blue-01.svg +0 -0
  248. /package/{src/images → images}/mots/cable_car_square-grey-01.svg +0 -0
  249. /package/{src/images → images}/mots/ferry_poi-blue-01.svg +0 -0
  250. /package/{src/images → images}/mots/ferry_poi-grey-01.svg +0 -0
  251. /package/{src/images → images}/mots/ferry_round-blue-01.svg +0 -0
  252. /package/{src/images → images}/mots/ferry_round-grey-01.svg +0 -0
  253. /package/{src/images → images}/mots/ferry_square-blue-01.svg +0 -0
  254. /package/{src/images → images}/mots/ferry_square-grey-01.svg +0 -0
  255. /package/{src/images → images}/mots/funicular_round-blue-01.svg +0 -0
  256. /package/{src/images → images}/mots/funicular_round-grey-01.svg +0 -0
  257. /package/{src/images → images}/mots/funicular_square-blue-01.svg +0 -0
  258. /package/{src/images → images}/mots/gondola_round-blue-01.svg +0 -0
  259. /package/{src/images → images}/mots/rail_poi-blue-01.svg +0 -0
  260. /package/{src/images → images}/mots/rail_poi-grey-01.svg +0 -0
  261. /package/{src/images → images}/mots/rail_round-blue-01.svg +0 -0
  262. /package/{src/images → images}/mots/rail_round-grey-01.svg +0 -0
  263. /package/{src/images → images}/mots/rail_square-blue-01.svg +0 -0
  264. /package/{src/images → images}/mots/rail_square-grey-01.svg +0 -0
  265. /package/{src/images → images}/mots/subway_round blue-01.svg +0 -0
  266. /package/{src/images → images}/mots/subway_round-blue-01.svg +0 -0
  267. /package/{src/images → images}/mots/tram_poi-blue-01.svg +0 -0
  268. /package/{src/images → images}/mots/tram_poi-grey-01.svg +0 -0
  269. /package/{src/images → images}/mots/tram_round-blue-01.svg +0 -0
  270. /package/{src/images → images}/mots/tram_round-grey-01.svg +0 -0
  271. /package/{src/images → images}/mots/tram_square-blue-01.svg +0 -0
  272. /package/{src/images → images}/mots/tram_square-grey-01.svg +0 -0
  273. /package/{src/images → images}/northArrow.svg +0 -0
  274. /package/{src/images → images}/northArrow.url.svg +0 -0
  275. /package/{src/images → images}/northArrowCircle.svg +0 -0
  276. /package/{src/images → images}/northArrowCircle.url.svg +0 -0
  277. /package/{src/themes → themes}/README.md +0 -0
  278. /package/{src/themes → themes}/default/components.scss +0 -0
  279. /package/{src/themes → themes}/default/examples.scss +0 -0
  280. /package/{src/themes → themes}/default/index.scss +0 -0
  281. /package/{src/themes → themes}/default/mixins.scss +0 -0
  282. /package/{src/themes → themes}/default/variables.scss +0 -0
@@ -1,76 +0,0 @@
1
-
2
- The following example demonstrates the use of FeatureExportButton.
3
-
4
- ```jsx
5
- import React from 'react';
6
- import { Layer, MapboxLayer } from 'mobility-toolbox-js/ol';
7
- import VectorLayer from 'ol/layer/Vector';
8
- import VectorSource from 'ol/source/Vector';
9
- import Feature from 'ol/Feature';
10
- import Point from 'ol/geom/Point';
11
- import { Icon, Style } from 'ol/style';
12
- import GPX from 'ol/format/GPX';
13
- import { geopsTheme, Header, Footer } from '@geops/geops-ui';
14
- import { ThemeProvider } from '@material-ui/core/styles';
15
- import Button from '@material-ui/core/Button';
16
- import BasicMap from 'react-spatial/components/BasicMap';
17
- import FeatureExportButton from 'react-spatial/components/FeatureExportButton';
18
-
19
-
20
- const vectorLayer = new Layer({
21
- olLayer: new VectorLayer({
22
- style: new Style({
23
- image: new Icon({
24
- anchor: [0.5, 46],
25
- anchorXUnits: 'fraction',
26
- anchorYUnits: 'pixels',
27
- src: 'https://openlayers.org/en/latest/examples/data/icon.png',
28
- imgSize: [32, 48]
29
- })
30
- }),
31
- source: new VectorSource({
32
- features: [
33
- new Feature({
34
- geometry: new Point([819103.972418, 6120013.078324]),
35
- }),
36
- new Feature({
37
- geometry: new Point([873838.856313, 6106009.575876]),
38
- }),
39
- ],
40
- }),
41
- }),
42
- });
43
-
44
- const layers = [
45
- new MapboxLayer({
46
- url: `https://maps.geops.io/styles/travic_v2/style.json?key=${apiKey}`,
47
- }),
48
- vectorLayer,
49
- ];
50
-
51
- <ThemeProvider theme={geopsTheme}>
52
- <div className="rs-feature-export-example">
53
- <BasicMap
54
- center={[843119.531243, 6111943.000197]}
55
- zoom={9}
56
- layers={layers}
57
- tabIndex={0}
58
- />
59
- <div className="rs-feature-export-example-btns">
60
- <FeatureExportButton layer={vectorLayer}>
61
- <Button>
62
- Export as KML
63
- </Button>
64
- </FeatureExportButton>
65
- <FeatureExportButton
66
- format={GPX}
67
- layer={vectorLayer}
68
- >
69
- <Button>
70
- Export as GPX
71
- </Button>
72
- </FeatureExportButton>
73
- </div>
74
- </div>
75
- </ThemeProvider>
76
- ```
@@ -1,67 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`FeatureExportButton should match snapshot should match snapshot with children passed. 1`] = `
4
- <div
5
- className="rs-feature-export-button"
6
- onClick={[Function]}
7
- onKeyPress={[Function]}
8
- role="button"
9
- tabIndex={0}
10
- >
11
- <div>
12
- Foo
13
- </div>
14
- </div>
15
- `;
16
-
17
- exports[`FeatureExportButton should match snapshot should match snapshot with cutom attributes. 1`] = `
18
- <div
19
- className="foo"
20
- onClick={[Function]}
21
- onKeyPress={[Function]}
22
- role="button"
23
- tabIndex={2}
24
- title="bar"
25
- />
26
- `;
27
-
28
- exports[`FeatureExportButton should match snapshot with default attributes. 1`] = `
29
- <div
30
- className="rs-feature-export-button"
31
- onClick={[Function]}
32
- onKeyPress={[Function]}
33
- role="button"
34
- tabIndex={0}
35
- />
36
- `;
37
-
38
- exports[`FeatureExportButton triggers onClick #createFeatureString() using KMLFormat should export kml by default. 1`] = `
39
- <kml xmlns="http://www.opengis.net/kml/2.2"
40
- xmlns:gx="http://www.google.com/kml/ext/2.2"
41
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
42
- xsi:schemalocation="http://www.opengis.net/kml/2.2 https://developers.google.com/kml/schema/kml22gx.xsd"
43
- >
44
- <Document>
45
- <name>
46
- ExportLayer
47
- </name>
48
- <Placemark>
49
- <Style>
50
- <IconStyle>
51
- <scale>2
52
- </scale>
53
- <Icon>
54
- <href>https://openlayers.org/en/latest/examples/data/icon.png
55
- </href>
56
- </Icon>
57
- </IconStyle>
58
- </Style>
59
- <Point>
60
- <coordinates>
61
- 7.358136177061042,48.07903229472336
62
- </coordinates>
63
- </Point>
64
- </Placemark>
65
- </Document>
66
- </kml>
67
- `;
@@ -1 +0,0 @@
1
- export { default } from './FeatureExportButton';
@@ -1,48 +0,0 @@
1
- import React from 'react';
2
- import renderer from 'react-test-renderer';
3
- import { configure, shallow } from 'enzyme';
4
- import Adapter from '@cfaester/enzyme-adapter-react-18';
5
- import OLView from 'ol/View';
6
- import OLMap from 'ol/Map';
7
- import FitExtent from './FitExtent';
8
-
9
- configure({ adapter: new Adapter() });
10
-
11
- const extent = [1, 2, 3, 4];
12
-
13
- test('Button should match snapshot.', () => {
14
- const map = new OLMap({});
15
- const component = renderer.create(
16
- <FitExtent map={map} extent={extent}>
17
- FitExtent
18
- </FitExtent>,
19
- );
20
- const tree = component.toJSON();
21
- expect(tree).toMatchSnapshot();
22
- });
23
-
24
- test('Should fit the extent.', () => {
25
- const map = new OLMap({ view: new OLView({ zoom: 7, center: [0, 0] }) });
26
- const wrapper = shallow(
27
- <FitExtent map={map} extent={extent} className="fit-ext">
28
- FitExtent
29
- </FitExtent>,
30
- );
31
- wrapper.find('.fit-ext').first().simulate('click', {});
32
- const calculatedExtent = map.getView().calculateExtent(map.getSize());
33
-
34
- expect(calculatedExtent).toStrictEqual([1, 2, 3, 4]);
35
- });
36
-
37
- test('Should fit the extent on return.', () => {
38
- const map = new OLMap({ view: new OLView({ zoom: 7, center: [0, 0] }) });
39
- const wrapper = shallow(
40
- <FitExtent map={map} extent={extent} className="fit-ext">
41
- FitExtent
42
- </FitExtent>,
43
- );
44
- wrapper.find('.fit-ext').first().simulate('click', { which: 13 });
45
- const calculatedExtent = map.getView().calculateExtent(map.getSize());
46
-
47
- expect(calculatedExtent).toStrictEqual([1, 2, 3, 4]);
48
- });
@@ -1,34 +0,0 @@
1
-
2
- The following example demonstrates the use of FitExtent.
3
-
4
- ```jsx
5
- import React from 'react';
6
- import { MapboxLayer } from 'mobility-toolbox-js/ol';
7
- import Tile from 'ol/layer/Tile';
8
- import OSM from 'ol/source/OSM';
9
- import Map from 'ol/Map';
10
- import { geopsTheme, Header, Footer } from '@geops/geops-ui';
11
- import { ThemeProvider } from '@material-ui/core/styles';
12
- import Button from '@material-ui/core/Button';
13
- import FitExtent from 'react-spatial/components/FitExtent';
14
- import BasicMap from 'react-spatial/components/BasicMap';
15
-
16
- const extent = [-15380353.1391, 2230738.2886, -6496535.908, 6927029.2369];
17
-
18
- const map = new Map({ controls: [] });
19
-
20
- const layers = [
21
- new MapboxLayer({
22
- url: `https://maps.geops.io/styles/travic_v2/style.json?key=${apiKey}`,
23
- }),
24
- ];
25
-
26
- <ThemeProvider theme={geopsTheme}>
27
- <BasicMap map={map} layers={layers} tabIndex={0} />
28
- <FitExtent map={map} extent={extent}>
29
- <Button>
30
- Fit to US
31
- </Button>
32
- </FitExtent>
33
- </ThemeProvider>
34
- ```
@@ -1,13 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Button should match snapshot. 1`] = `
4
- <div
5
- className="rs-fit-extent"
6
- onClick={[Function]}
7
- onKeyPress={[Function]}
8
- role="button"
9
- tabIndex="0"
10
- >
11
- FitExtent
12
- </div>
13
- `;
@@ -1 +0,0 @@
1
- export { default } from './FitExtent';
@@ -1,267 +0,0 @@
1
- import React from 'react';
2
- import renderer from 'react-test-renderer';
3
- import { configure, mount, shallow } from 'enzyme';
4
- import Adapter from '@cfaester/enzyme-adapter-react-18';
5
-
6
- import 'jest-canvas-mock';
7
- import Map from 'ol/Map';
8
- import View from 'ol/View';
9
- import MapEvent from 'ol/MapEvent';
10
- import Geolocation from './Geolocation';
11
-
12
- configure({ adapter: new Adapter() });
13
-
14
- const geolocationBackup = global.navigator.geolocation;
15
-
16
- const mockGeolocation = () => {
17
- const mock = {
18
- clearWatch: jest.fn(),
19
- getCurrentPosition: jest.fn(),
20
- watchPosition: (onSuccess) => {
21
- onSuccess({
22
- coords: {
23
- latitude: 47.9913611,
24
- longitude: 7.84868,
25
- accuracy: 55,
26
- },
27
- timestamp: 1552660077044,
28
- });
29
- },
30
- };
31
-
32
- global.navigator.geolocation = mock;
33
- };
34
-
35
- const mockMissingGeolocation = () => {
36
- delete global.navigator.geolocation;
37
- };
38
-
39
- const restoreGeolocation = () => {
40
- global.navigator.geolocation = geolocationBackup;
41
- };
42
-
43
- class CallbackHandler {
44
- static onError() {}
45
-
46
- static onSuccess() {}
47
-
48
- static onActivate() {}
49
-
50
- static onDeactivate() {}
51
- }
52
-
53
- describe('Geolocation', () => {
54
- let map;
55
-
56
- beforeEach(() => {
57
- const target = document.createElement('div');
58
- const { style } = target;
59
- style.position = 'absolute';
60
- style.left = '-1000px';
61
- style.top = '-1000px';
62
- style.width = '100px';
63
- style.height = '100px';
64
- document.body.appendChild(target);
65
-
66
- map = new Map({
67
- target,
68
- view: new View({
69
- center: [0, 0],
70
- resolutions: [1],
71
- zoom: 0,
72
- }),
73
- });
74
- map.renderSync();
75
- });
76
-
77
- afterEach(() => {
78
- const target = map.getTarget();
79
- map.setTarget(null);
80
- if (target && target.parentNode) {
81
- target.parentNode.removeChild(target);
82
- }
83
- map.dispose();
84
- });
85
-
86
- describe('should match snapshot', () => {
87
- test('minimum props', () => {
88
- const component = renderer.create(<Geolocation map={map} />);
89
- const tree = component.toJSON();
90
- expect(tree).toMatchSnapshot();
91
- });
92
-
93
- test('with title', () => {
94
- const component = renderer.create(
95
- <Geolocation map={map} title="Lokalisieren" />,
96
- );
97
- const tree = component.toJSON();
98
- expect(tree).toMatchSnapshot();
99
- });
100
-
101
- test('with class name', () => {
102
- const component = renderer.create(
103
- <Geolocation map={map} className="my-class-name" />,
104
- );
105
- const tree = component.toJSON();
106
- expect(tree).toMatchSnapshot();
107
- });
108
- });
109
-
110
- test('should use children', () => {
111
- mockGeolocation();
112
-
113
- const wrapper = mount(<Geolocation map={map}>test</Geolocation>);
114
-
115
- const text = wrapper.find('.rs-geolocation').first().text();
116
-
117
- expect(text).toBe('test');
118
-
119
- restoreGeolocation();
120
- });
121
-
122
- describe('button classes', () => {
123
- test('class should be active', () => {
124
- mockGeolocation();
125
-
126
- const wrapper = mount(<Geolocation map={map} />);
127
- const basic = wrapper.getDOMNode();
128
-
129
- wrapper.find('.rs-geolocation').first().simulate('click');
130
-
131
- expect(basic.className).toBe('rs-geolocation rs-active');
132
-
133
- restoreGeolocation();
134
- });
135
-
136
- test('class should not be active', () => {
137
- mockGeolocation();
138
-
139
- const wrapper = mount(<Geolocation map={map} />);
140
- const basic = wrapper.getDOMNode();
141
-
142
- wrapper
143
- .find('.rs-geolocation')
144
- .first()
145
- .simulate('click')
146
- .simulate('click');
147
-
148
- expect(basic.className).toBe('rs-geolocation ');
149
-
150
- restoreGeolocation();
151
- });
152
- });
153
-
154
- test(`highlight on first toggle`, () => {
155
- mockGeolocation();
156
-
157
- const component = shallow(<Geolocation map={map} />);
158
- const instance = component.instance();
159
- const spy = jest.spyOn(instance, 'highlight');
160
- instance.toggle();
161
- expect(spy).toHaveBeenCalled();
162
-
163
- restoreGeolocation();
164
- });
165
-
166
- test(`success/activate/deactivate callback functions should be called`, () => {
167
- mockGeolocation();
168
- const spyOnSuccess = jest.spyOn(CallbackHandler, 'onSuccess');
169
- const spyOnActivate = jest.spyOn(CallbackHandler, 'onActivate');
170
- const spyOnDeactivate = jest.spyOn(CallbackHandler, 'onDeactivate');
171
-
172
- const wrapper = mount(
173
- <Geolocation
174
- map={map}
175
- onSuccess={() => {
176
- return CallbackHandler.onSuccess();
177
- }}
178
- onActivate={() => {
179
- return CallbackHandler.onActivate();
180
- }}
181
- onDeactivate={() => {
182
- return CallbackHandler.onDeactivate();
183
- }}
184
- />,
185
- );
186
-
187
- wrapper.find('.rs-geolocation').first().simulate('click');
188
-
189
- expect(spyOnActivate).toHaveBeenCalled();
190
- expect(spyOnSuccess).toHaveBeenCalled();
191
-
192
- wrapper.find('.rs-geolocation').first().simulate('click');
193
-
194
- expect(spyOnDeactivate).toHaveBeenCalled();
195
-
196
- restoreGeolocation();
197
- });
198
-
199
- test(`error function should be called`, () => {
200
- mockMissingGeolocation();
201
-
202
- const spy = jest.spyOn(CallbackHandler, 'onError');
203
-
204
- const wrapper = mount(
205
- <Geolocation
206
- map={map}
207
- onError={() => {
208
- return CallbackHandler.onError();
209
- }}
210
- />,
211
- );
212
-
213
- wrapper.find('.rs-geolocation').first().simulate('click');
214
-
215
- expect(spy).toHaveBeenCalled();
216
-
217
- restoreGeolocation();
218
- });
219
-
220
- describe('map centering', () => {
221
- test('centers map', () => {
222
- mockGeolocation();
223
-
224
- const center1 = [742952.8821531708, 6330118.608483334];
225
- map.getView().setCenter(center1);
226
-
227
- const component = shallow(<Geolocation map={map} />);
228
- component.instance().toggle();
229
-
230
- const center2 = map.getView().getCenter();
231
- expect(center1).not.toEqual(center2);
232
-
233
- restoreGeolocation();
234
- });
235
-
236
- test('sets isRecenteringToPosition=false after pointerdrag event with the noCenterAfterDrag prop', () => {
237
- mockGeolocation();
238
-
239
- const component = shallow(<Geolocation map={map} noCenterAfterDrag />);
240
- component.instance().toggle();
241
-
242
- expect(component.instance().isRecenteringToPosition).toEqual(true);
243
-
244
- map.dispatchEvent(new MapEvent('pointerdrag', map));
245
- expect(component.instance().isRecenteringToPosition).toEqual(false);
246
-
247
- restoreGeolocation();
248
- });
249
- });
250
-
251
- test('custom style function', () => {
252
- mockGeolocation();
253
-
254
- const styleFunc = jest.fn();
255
-
256
- const component = shallow(
257
- <Geolocation map={map} colorOrStyleFunc={styleFunc} />,
258
- );
259
- const instance = component.instance();
260
- instance.toggle();
261
- const style = instance.layer.getSource().getFeatures()[0].getStyle();
262
-
263
- expect(style).toBe(styleFunc);
264
-
265
- restoreGeolocation();
266
- });
267
- });
@@ -1,25 +0,0 @@
1
-
2
- The following example demonstrates the use of Geolocation.
3
-
4
- ```jsx
5
- import React from 'react';
6
- import { MapboxLayer } from 'mobility-toolbox-js/ol';
7
- import Tile from 'ol/layer/Tile';
8
- import OSM from 'ol/source/OSM';
9
- import Map from 'ol/Map';
10
- import Geolocation from 'react-spatial/components/Geolocation';
11
- import BasicMap from 'react-spatial/components/BasicMap';
12
-
13
- const map = new Map({ controls: [] });
14
-
15
- const layers = [
16
- new MapboxLayer({
17
- url: `https://maps.geops.io/styles/travic_v2/style.json?key=${apiKey}`,
18
- }),
19
- ];
20
-
21
- <div className="rs-geolocation-example">
22
- <BasicMap map={map} layers={layers} tabIndex={0} />
23
- <Geolocation map={map} />
24
- </div>
25
- ```
@@ -1,92 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Geolocation should match snapshot minimum props 1`] = `
4
- <div
5
- className="rs-geolocation "
6
- onClick={[Function]}
7
- onKeyPress={[Function]}
8
- role="button"
9
- tabIndex="0"
10
- >
11
- <svg
12
- fill="currentColor"
13
- focusable={false}
14
- height="1em"
15
- stroke="currentColor"
16
- strokeWidth="0"
17
- style={
18
- {
19
- "color": undefined,
20
- }
21
- }
22
- viewBox="0 0 512 512"
23
- width="1em"
24
- xmlns="http://www.w3.org/2000/svg"
25
- >
26
- <path
27
- d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
28
- />
29
- </svg>
30
- </div>
31
- `;
32
-
33
- exports[`Geolocation should match snapshot with class name 1`] = `
34
- <div
35
- className="my-class-name "
36
- onClick={[Function]}
37
- onKeyPress={[Function]}
38
- role="button"
39
- tabIndex="0"
40
- >
41
- <svg
42
- fill="currentColor"
43
- focusable={false}
44
- height="1em"
45
- stroke="currentColor"
46
- strokeWidth="0"
47
- style={
48
- {
49
- "color": undefined,
50
- }
51
- }
52
- viewBox="0 0 512 512"
53
- width="1em"
54
- xmlns="http://www.w3.org/2000/svg"
55
- >
56
- <path
57
- d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
58
- />
59
- </svg>
60
- </div>
61
- `;
62
-
63
- exports[`Geolocation should match snapshot with title 1`] = `
64
- <div
65
- className="rs-geolocation "
66
- onClick={[Function]}
67
- onKeyPress={[Function]}
68
- role="button"
69
- tabIndex="0"
70
- title="Lokalisieren"
71
- >
72
- <svg
73
- fill="currentColor"
74
- focusable={false}
75
- height="1em"
76
- stroke="currentColor"
77
- strokeWidth="0"
78
- style={
79
- {
80
- "color": undefined,
81
- }
82
- }
83
- viewBox="0 0 512 512"
84
- width="1em"
85
- xmlns="http://www.w3.org/2000/svg"
86
- >
87
- <path
88
- d="M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"
89
- />
90
- </svg>
91
- </div>
92
- `;
@@ -1 +0,0 @@
1
- export { default } from './Geolocation';