react-spatial 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js +51 -51
  2. package/components/BaseLayerSwitcher/BaseLayerSwitcher.js.map +2 -2
  3. package/components/BasicMap/BasicMap.js +80 -80
  4. package/components/BasicMap/BasicMap.js.map +2 -2
  5. package/components/CanvasSaveButton/CanvasSaveButton.js +68 -68
  6. package/components/CanvasSaveButton/CanvasSaveButton.js.map +2 -2
  7. package/components/Copyright/Copyright.js +12 -12
  8. package/components/Copyright/Copyright.js.map +2 -2
  9. package/components/FeatureExportButton/FeatureExportButton.js +5 -5
  10. package/components/FeatureExportButton/FeatureExportButton.js.map +2 -2
  11. package/components/FitExtent/FitExtent.js +15 -15
  12. package/components/FitExtent/FitExtent.js.map +2 -2
  13. package/components/Geolocation/Geolocation.js +96 -96
  14. package/components/Geolocation/Geolocation.js.map +2 -2
  15. package/components/LayerTree/LayerTree.js +172 -172
  16. package/components/LayerTree/LayerTree.js.map +2 -2
  17. package/components/MousePosition/MousePosition.js +27 -27
  18. package/components/MousePosition/MousePosition.js.map +2 -2
  19. package/components/NorthArrow/NorthArrow.js +13 -13
  20. package/components/NorthArrow/NorthArrow.js.map +2 -2
  21. package/components/Overlay/Overlay.js +49 -49
  22. package/components/Overlay/Overlay.js.map +2 -2
  23. package/components/Permalink/Permalink.js +70 -70
  24. package/components/Permalink/Permalink.js.map +2 -2
  25. package/components/Popup/Popup.js +73 -73
  26. package/components/Popup/Popup.js.map +2 -2
  27. package/components/ResizeHandler/ResizeHandler.js +51 -49
  28. package/components/ResizeHandler/ResizeHandler.js.map +2 -2
  29. package/components/RouteSchedule/RouteSchedule.js +86 -74
  30. package/components/RouteSchedule/RouteSchedule.js.map +2 -2
  31. package/components/RouteSchedule/RouteSchedule.scss +0 -20
  32. package/components/ScaleLine/ScaleLine.js +2 -2
  33. package/components/ScaleLine/ScaleLine.js.map +2 -2
  34. package/components/StopsFinder/StopsFinder.js +21 -21
  35. package/components/StopsFinder/StopsFinder.js.map +2 -2
  36. package/components/StopsFinder/StopsFinderOption.js +3 -3
  37. package/components/StopsFinder/StopsFinderOption.js.map +2 -2
  38. package/components/Zoom/Zoom.js +35 -35
  39. package/components/Zoom/Zoom.js.map +2 -2
  40. package/package.json +33 -29
  41. package/propTypes.js +10 -10
  42. package/propTypes.js.map +2 -2
  43. package/utils/GlobalsForOle.js +57 -57
  44. package/utils/GlobalsForOle.js.map +2 -2
  45. package/utils/KML.js +32 -32
  46. package/utils/KML.js.map +2 -2
  47. package/utils/Styles.js +7 -7
  48. package/utils/Styles.js.map +2 -2
  49. package/utils/timeUtils.js +6 -6
  50. package/utils/timeUtils.js.map +2 -2
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/BasicMap/BasicMap.js"],
4
- "sourcesContent": ["import React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { defaults as defaultInteractions } from \"ol/interaction\";\nimport { equals } from \"ol/extent\";\nimport OLMap from \"ol/Map\";\nimport OLCollection from \"ol/Collection\";\nimport View from \"ol/View\";\nimport { unByKey } from \"ol/Observable\";\nimport Interaction from \"ol/interaction/Interaction\";\nimport { Layer } from \"mobility-toolbox-js/ol\";\n\nconst propTypes = {\n /** Map animation options */\n animationOptions: PropTypes.shape({\n center: PropTypes.arrayOf(PropTypes.number),\n resolution: PropTypes.number,\n zoom: PropTypes.number,\n }),\n\n /** Center of the [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html). */\n center: PropTypes.arrayOf(PropTypes.number),\n\n /** Class name of the map container */\n className: PropTypes.string,\n\n /** Map extent */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /** Openlayers [fit options](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) when extent is updated */\n fitOptions: PropTypes.object,\n\n /** Array of [ol/interaction](https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html). */\n interactions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.instanceOf(Interaction)),\n PropTypes.instanceOf(OLCollection),\n ]),\n\n /** Array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers) to display. */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is clicked.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The singleclick [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:singleclick).\n */\n onFeaturesClick: PropTypes.func,\n\n /**\n * Optional options to pass on feature click. Passed to ol's 'getFeaturesAtPixel' method.\n * https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#getFeaturesAtPixel\n */\n featuresClickOptions: PropTypes.shape({\n layerFilter: PropTypes.func,\n hitTolerance: PropTypes.number,\n checkWrapped: PropTypes.bool,\n }),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is hovered.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The pointermove [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:pointermove).\n */\n onFeaturesHover: PropTypes.func,\n\n /**\n * Callback when the map was moved.\n * @param {ol.MapEvent} event The movend [ol/MapEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:moveend).\n */\n onMapMoved: PropTypes.func,\n\n /** Map resolution */\n resolution: PropTypes.number,\n\n /** The tabIndex of the map. */\n tabIndex: PropTypes.number,\n\n /** The style of the map. */\n style: PropTypes.object,\n\n /** HTML aria-label. */\n ariaLabel: PropTypes.string,\n\n /** [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html) constructor options */\n viewOptions: PropTypes.shape({\n minZoom: PropTypes.number,\n maxZoom: PropTypes.number,\n extent: PropTypes.array,\n projection: PropTypes.string,\n }),\n\n /** Map zoom level */\n zoom: PropTypes.number,\n};\n\nconst defaultProps = {\n animationOptions: undefined,\n center: [0, 0],\n className: \"rs-map\",\n extent: undefined,\n fitOptions: {\n duration: 1000,\n padding: [20, 20, 20, 20],\n maxZoom: 23,\n },\n style: undefined,\n interactions: null,\n layers: [],\n map: null,\n onFeaturesClick: undefined,\n featuresClickOptions: {\n hitTolerance: 0,\n },\n onFeaturesHover: undefined,\n onMapMoved: undefined,\n resolution: undefined,\n tabIndex: undefined,\n ariaLabel: \"map\",\n viewOptions: {\n minZoom: 0,\n maxZoom: 22,\n extent: undefined,\n projection: \"EPSG:3857\",\n },\n zoom: 1,\n};\n\n/**\n * The BasicMap component renders an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n *\n * The map's view is created with the following parameters for the view:\n * - projection: 'EPSG:3857'\n * - zoom: 0\n * - minZoom: 0\n * - maxZoom: 22\n *\n * These options can be overridden using the viewOptions property.\n */\nclass BasicMap extends PureComponent {\n constructor(props) {\n super(props);\n const { map, interactions } = this.props;\n\n this.map =\n map ||\n new OLMap({\n controls: [],\n interactions:\n interactions ||\n defaultInteractions({\n altShiftDragRotate: false,\n pinchRotate: false,\n }),\n });\n\n this.state = {\n node: null,\n };\n\n this.moveEndRef = null;\n this.singleClickRef = null;\n this.pointerMoveRef = null;\n this.setNode = this.setNode.bind(this);\n }\n\n componentDidMount() {\n const { layers, extent, viewOptions, center, zoom, resolution } =\n this.props;\n const { node } = this.state;\n this.map.setTarget(node);\n\n // We set the view here otherwise the map is not correctly zoomed.\n this.map.setView(new View({ ...viewOptions, center, zoom, resolution }));\n\n // // Since ol 6.1.0 touch-action is set to auto and creates a bad navigation experience on mobile,\n // // so we have to force it to none for mobile.\n // // https://github.com/openlayers/openlayers/pull/10187/files\n const viewPort = this.map.getViewport();\n viewPort.style.touchAction = \"none\";\n viewPort.style.msTouchAction = \"none\";\n viewPort.setAttribute(\"touch-action\", \"none\");\n\n // Fit only work if the map has a size.\n if (this.map.getSize() && extent) {\n this.map.getView().fit(extent);\n }\n\n this.setLayers(layers);\n this.listenMoveEnd();\n this.listenSingleClick();\n this.listenPointerMove();\n }\n\n componentDidUpdate(prevProps, prevState) {\n const {\n animationOptions,\n center,\n extent,\n fitOptions,\n layers,\n resolution,\n viewOptions,\n zoom,\n onMapMoved,\n onFeaturesClick,\n onFeaturesHover,\n } = this.props;\n const { node } = this.state;\n\n if (prevState.node !== node) {\n if (zoom) {\n this.map.getView().setZoom(zoom);\n }\n\n if (resolution) {\n this.map.getView().setResolution(resolution);\n }\n this.map.setTarget(node);\n\n // When the node is set we reinitialize the extent with the extent property.\n if (!prevState.node && node && extent) {\n this.map.getView().fit(extent);\n }\n }\n\n if (prevProps.layers !== layers) {\n this.setLayers(layers, prevProps.layers);\n }\n\n // Creates a new view if necessary before updating the others prop.\n if (\n viewOptions &&\n JSON.stringify(viewOptions) !== JSON.stringify(prevProps.viewOptions)\n ) {\n // Re-create a view, ol doesn't provide any method to setExtent of view.\n this.map.setView(\n new View({\n ...viewOptions,\n center,\n resolution,\n zoom,\n }),\n );\n }\n\n const view = this.map.getView();\n\n if (animationOptions && prevProps.animationOptions !== animationOptions) {\n view.animate(animationOptions);\n }\n\n if (prevProps.center !== center) {\n view.setCenter(center);\n }\n\n if (zoom !== prevProps.zoom) {\n view.setZoom(zoom);\n }\n\n if (resolution !== prevProps.resolution) {\n view.setResolution(resolution);\n }\n\n if (extent && !equals(extent, prevProps.extent || [])) {\n view.fit(extent, fitOptions);\n }\n\n if (onMapMoved !== prevProps.onMapMoved) {\n this.listenMoveEnd();\n }\n\n if (onFeaturesClick !== prevProps.onFeaturesClick) {\n this.listenSingleClick();\n }\n\n if (onFeaturesHover !== prevProps.onFeaturesHover) {\n this.listenPointerMove();\n }\n }\n\n componentWillUnmount() {\n unByKey([this.moveEndRef, this.singleClickRef, this.pointerMoveRef]);\n }\n\n setNode(node) {\n this.setState({ node });\n }\n\n setLayers(layers = [], prevLayers = []) {\n for (let i = 0; i < prevLayers.length; i += 1) {\n this.terminateLayer(prevLayers[i]);\n }\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n initLayer(layer) {\n if (layer.attachToMap) {\n layer.attachToMap(this.map);\n }\n\n if (layer.init) {\n layer.init(this.map);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n !this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.addLayer(layer.olLayer);\n }\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n terminateLayer(layer) {\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.terminateLayer(layers[i]);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.removeLayer(layer.olLayer);\n }\n\n if (layer.terminate) {\n layer.terminate(this.map);\n }\n\n if (layer.detachFromMap) {\n layer.detachFromMap(this.map);\n }\n }\n\n listenMoveEnd() {\n const { onMapMoved } = this.props;\n unByKey(this.moveEndRef);\n\n if (!onMapMoved) {\n return;\n }\n\n this.moveEndRef = this.map.on(\"moveend\", (evt) => {\n return onMapMoved(evt);\n });\n }\n\n listenSingleClick() {\n const { onFeaturesClick, featuresClickOptions } = this.props;\n unByKey(this.singleClickRef);\n\n if (!onFeaturesClick) {\n return;\n }\n\n this.singleClickRef = this.map.on(\"singleclick\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(\n evt.pixel,\n featuresClickOptions,\n );\n onFeaturesClick(features || [], evt);\n });\n }\n\n listenPointerMove() {\n const { onFeaturesHover } = this.props;\n unByKey(this.pointerMoveRef);\n\n if (!onFeaturesHover) {\n return;\n }\n\n this.pointerMoveRef = this.map.on(\"pointermove\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(evt.pixel);\n onFeaturesHover(features || [], evt);\n });\n }\n\n render() {\n const { className, tabIndex, ariaLabel, style } = this.props;\n return (\n <div\n className={className}\n ref={this.setNode}\n role=\"presentation\"\n aria-label={ariaLabel}\n tabIndex={tabIndex}\n style={style}\n />\n );\n }\n}\n\nBasicMap.propTypes = propTypes;\nBasicMap.defaultProps = defaultProps;\n\nexport default BasicMap;\n"],
5
- "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,SAAS,YAAY,2BAA2B;AAChD,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,OAAO,kBAAkB;AACzB,OAAO,UAAU;AACjB,SAAS,eAAe;AACxB,OAAO,iBAAiB;AACxB,SAAS,aAAa;AAEtB,MAAM,YAAY;AAAA;AAAA,EAEhB,kBAAkB,UAAU,MAAM;AAAA,IAChC,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA,IAC1C,YAAY,UAAU;AAAA,IACtB,MAAM,UAAU;AAAA,EAClB,CAAC;AAAA;AAAA,EAGD,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,WAAW,UAAU;AAAA;AAAA,EAGrB,QAAQ,UAAU,QAAQ,UAAU,MAAM;AAAA;AAAA,EAG1C,YAAY,UAAU;AAAA;AAAA,EAGtB,cAAc,UAAU,UAAU;AAAA,IAChC,UAAU,QAAQ,UAAU,WAAW,WAAW,CAAC;AAAA,IACnD,UAAU,WAAW,YAAY;AAAA,EACnC,CAAC;AAAA;AAAA,EAGD,QAAQ,UAAU,QAAQ,UAAU,WAAW,KAAK,CAAC;AAAA;AAAA,EAGrD,KAAK,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AAY;AACrB,SAAS,eAAe;AAExB,eAAe;",
4
+ "sourcesContent": ["import { Layer } from \"mobility-toolbox-js/ol\";\nimport OLCollection from \"ol/Collection\";\nimport { equals } from \"ol/extent\";\nimport { defaults as defaultInteractions } from \"ol/interaction\";\nimport Interaction from \"ol/interaction/Interaction\";\nimport OLMap from \"ol/Map\";\nimport { unByKey } from \"ol/Observable\";\nimport View from \"ol/View\";\nimport PropTypes from \"prop-types\";\nimport React, { PureComponent } from \"react\";\n\nconst propTypes = {\n /** Map animation options */\n animationOptions: PropTypes.shape({\n center: PropTypes.arrayOf(PropTypes.number),\n resolution: PropTypes.number,\n zoom: PropTypes.number,\n }),\n\n /** HTML aria-label. */\n ariaLabel: PropTypes.string,\n\n /** Center of the [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html). */\n center: PropTypes.arrayOf(PropTypes.number),\n\n /** Class name of the map container */\n className: PropTypes.string,\n\n /** Map extent */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Optional options to pass on feature click. Passed to ol's 'getFeaturesAtPixel' method.\n * https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html#getFeaturesAtPixel\n */\n featuresClickOptions: PropTypes.shape({\n checkWrapped: PropTypes.bool,\n hitTolerance: PropTypes.number,\n layerFilter: PropTypes.func,\n }),\n\n /** Openlayers [fit options](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html#fit) when extent is updated */\n fitOptions: PropTypes.object,\n\n /** Array of [ol/interaction](https://openlayers.org/en/latest/apidoc/module-ol_interaction_Interaction-Interaction.html). */\n interactions: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.instanceOf(Interaction)),\n PropTypes.instanceOf(OLCollection),\n ]),\n\n /** Array of [mobility-toolbox-js layers](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers) to display. */\n layers: PropTypes.arrayOf(PropTypes.instanceOf(Layer)),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is clicked.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The singleclick [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:singleclick).\n */\n onFeaturesClick: PropTypes.func,\n\n /**\n * Callback when a [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html) is hovered.\n * @param {OLFeature[]} features An array of [ol/Feature](https://openlayers.org/en/latest/apidoc/module-ol_Feature-Feature.html).\n * @param {ol.MapBrowserEvent} event The pointermove [ol/MapBrowserEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:pointermove).\n */\n onFeaturesHover: PropTypes.func,\n\n /**\n * Callback when the map was moved.\n * @param {ol.MapEvent} event The movend [ol/MapEvent](https://openlayers.org/en/latest/apidoc/module-ol_MapBrowserEvent-MapBrowserEvent.html#event:moveend).\n */\n onMapMoved: PropTypes.func,\n\n /** Map resolution */\n resolution: PropTypes.number,\n\n /** The style of the map. */\n style: PropTypes.object,\n\n /** The tabIndex of the map. */\n tabIndex: PropTypes.number,\n\n /** [ol/View](https://openlayers.org/en/latest/apidoc/module-ol_View-View.html) constructor options */\n viewOptions: PropTypes.shape({\n extent: PropTypes.array,\n maxZoom: PropTypes.number,\n minZoom: PropTypes.number,\n projection: PropTypes.string,\n }),\n\n /** Map zoom level */\n zoom: PropTypes.number,\n};\n\nconst defaultProps = {\n animationOptions: undefined,\n ariaLabel: \"map\",\n center: [0, 0],\n className: \"rs-map\",\n extent: undefined,\n featuresClickOptions: {\n hitTolerance: 0,\n },\n fitOptions: {\n duration: 1000,\n maxZoom: 23,\n padding: [20, 20, 20, 20],\n },\n interactions: null,\n layers: [],\n map: null,\n onFeaturesClick: undefined,\n onFeaturesHover: undefined,\n onMapMoved: undefined,\n resolution: undefined,\n style: undefined,\n tabIndex: undefined,\n viewOptions: {\n extent: undefined,\n maxZoom: 22,\n minZoom: 0,\n projection: \"EPSG:3857\",\n },\n zoom: 1,\n};\n\n/**\n * The BasicMap component renders an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html).\n *\n * The map's view is created with the following parameters for the view:\n * - projection: 'EPSG:3857'\n * - zoom: 0\n * - minZoom: 0\n * - maxZoom: 22\n *\n * These options can be overridden using the viewOptions property.\n */\nclass BasicMap extends PureComponent {\n constructor(props) {\n super(props);\n const { interactions, map } = this.props;\n\n this.map =\n map ||\n new OLMap({\n controls: [],\n interactions:\n interactions ||\n defaultInteractions({\n altShiftDragRotate: false,\n pinchRotate: false,\n }),\n });\n\n this.state = {\n node: null,\n };\n\n this.moveEndRef = null;\n this.singleClickRef = null;\n this.pointerMoveRef = null;\n this.setNode = this.setNode.bind(this);\n }\n\n componentDidMount() {\n const { center, extent, layers, resolution, viewOptions, zoom } =\n this.props;\n const { node } = this.state;\n this.map.setTarget(node);\n\n // We set the view here otherwise the map is not correctly zoomed.\n this.map.setView(new View({ ...viewOptions, center, resolution, zoom }));\n\n // // Since ol 6.1.0 touch-action is set to auto and creates a bad navigation experience on mobile,\n // // so we have to force it to none for mobile.\n // // https://github.com/openlayers/openlayers/pull/10187/files\n const viewPort = this.map.getViewport();\n viewPort.style.touchAction = \"none\";\n viewPort.style.msTouchAction = \"none\";\n viewPort.setAttribute(\"touch-action\", \"none\");\n\n // Fit only work if the map has a size.\n if (this.map.getSize() && extent) {\n this.map.getView().fit(extent);\n }\n\n this.setLayers(layers);\n this.listenMoveEnd();\n this.listenSingleClick();\n this.listenPointerMove();\n }\n\n componentDidUpdate(prevProps, prevState) {\n const {\n animationOptions,\n center,\n extent,\n fitOptions,\n layers,\n onFeaturesClick,\n onFeaturesHover,\n onMapMoved,\n resolution,\n viewOptions,\n zoom,\n } = this.props;\n const { node } = this.state;\n\n if (prevState.node !== node) {\n if (zoom) {\n this.map.getView().setZoom(zoom);\n }\n\n if (resolution) {\n this.map.getView().setResolution(resolution);\n }\n this.map.setTarget(node);\n\n // When the node is set we reinitialize the extent with the extent property.\n if (!prevState.node && node && extent) {\n this.map.getView().fit(extent);\n }\n }\n\n if (prevProps.layers !== layers) {\n this.setLayers(layers, prevProps.layers);\n }\n\n // Creates a new view if necessary before updating the others prop.\n if (\n viewOptions &&\n JSON.stringify(viewOptions) !== JSON.stringify(prevProps.viewOptions)\n ) {\n // Re-create a view, ol doesn't provide any method to setExtent of view.\n this.map.setView(\n new View({\n ...viewOptions,\n center,\n resolution,\n zoom,\n }),\n );\n }\n\n const view = this.map.getView();\n\n if (animationOptions && prevProps.animationOptions !== animationOptions) {\n view.animate(animationOptions);\n }\n\n if (prevProps.center !== center) {\n view.setCenter(center);\n }\n\n if (zoom !== prevProps.zoom) {\n view.setZoom(zoom);\n }\n\n if (resolution !== prevProps.resolution) {\n view.setResolution(resolution);\n }\n\n if (extent && !equals(extent, prevProps.extent || [])) {\n view.fit(extent, fitOptions);\n }\n\n if (onMapMoved !== prevProps.onMapMoved) {\n this.listenMoveEnd();\n }\n\n if (onFeaturesClick !== prevProps.onFeaturesClick) {\n this.listenSingleClick();\n }\n\n if (onFeaturesHover !== prevProps.onFeaturesHover) {\n this.listenPointerMove();\n }\n }\n\n componentWillUnmount() {\n unByKey([this.moveEndRef, this.singleClickRef, this.pointerMoveRef]);\n }\n\n initLayer(layer) {\n if (layer.attachToMap) {\n layer.attachToMap(this.map);\n }\n\n if (layer.init) {\n layer.init(this.map);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n !this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.addLayer(layer.olLayer);\n }\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n listenMoveEnd() {\n const { onMapMoved } = this.props;\n unByKey(this.moveEndRef);\n\n if (!onMapMoved) {\n return;\n }\n\n this.moveEndRef = this.map.on(\"moveend\", (evt) => {\n return onMapMoved(evt);\n });\n }\n\n listenPointerMove() {\n const { onFeaturesHover } = this.props;\n unByKey(this.pointerMoveRef);\n\n if (!onFeaturesHover) {\n return;\n }\n\n this.pointerMoveRef = this.map.on(\"pointermove\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(evt.pixel);\n onFeaturesHover(features || [], evt);\n });\n }\n\n listenSingleClick() {\n const { featuresClickOptions, onFeaturesClick } = this.props;\n unByKey(this.singleClickRef);\n\n if (!onFeaturesClick) {\n return;\n }\n\n this.singleClickRef = this.map.on(\"singleclick\", (evt) => {\n const features = evt.map.getFeaturesAtPixel(\n evt.pixel,\n featuresClickOptions,\n );\n onFeaturesClick(features || [], evt);\n });\n }\n\n render() {\n const { ariaLabel, className, style, tabIndex } = this.props;\n return (\n <div\n aria-label={ariaLabel}\n className={className}\n ref={this.setNode}\n role=\"presentation\"\n style={style}\n tabIndex={tabIndex}\n />\n );\n }\n\n setLayers(layers = [], prevLayers = []) {\n for (let i = 0; i < prevLayers.length; i += 1) {\n this.terminateLayer(prevLayers[i]);\n }\n for (let i = 0; i < layers.length; i += 1) {\n this.initLayer(layers[i]);\n }\n }\n\n setNode(node) {\n this.setState({ node });\n }\n\n terminateLayer(layer) {\n const layers = layer.children || [];\n for (let i = 0; i < layers.length; i += 1) {\n this.terminateLayer(layers[i]);\n }\n\n if (\n layer.olLayer &&\n this.map.getLayers() &&\n this.map.getLayers().getArray().includes(layer.olLayer)\n ) {\n this.map.removeLayer(layer.olLayer);\n }\n\n if (layer.terminate) {\n layer.terminate(this.map);\n }\n\n if (layer.detachFromMap) {\n layer.detachFromMap(this.map);\n }\n }\n}\n\nBasicMap.propTypes = propTypes;\nBasicMap.defaultProps = defaultProps;\n\nexport default BasicMap;\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,kBAAkB;AACzB,SAAS,cAAc;AACvB,SAAS,YAAY,2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C;AAAA,IACnC;AACA,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,GAAG;AACzC,WAAK,UAAU,OAAO,CAAC,CAAC;AAAA,IAC1B;AAAA,EACF;AAAA,EAEA,QAAQ,MAAM;AACZ,SAAK,SAAS,EAAE,KAAK,CAAC;AAAA,EACxB;AAAA,EAEA,eAAe,OAAO;AACpB,UAAM,SAAS,MAAM,YAAY,CAAC;AAClC,aAAS,IAAI,GAAG,IAAI,OAAO,QAAQ,KAAK,GAAG;AACzC,WAAK,eAAe,OAAO,CAAC,CAAC;AAAA,IAC/B;AAEA,QACE,MAAM,WACN,KAAK,IAAI,UAAU,KACnB,KAAK,IAAI,UAAU,EAAE,SAAS,EAAE,SAAS,MAAM,OAAO,GACtD;AACA,WAAK,IAAI,YAAY,MAAM,OAAO;AAAA,IACpC;AAEA,QAAI,MAAM,WAAW;AACnB,YAAM,UAAU,KAAK,GAAG;AAAA,IAC1B;AAEA,QAAI,MAAM,eAAe;AACvB,YAAM,cAAc,KAAK,GAAG;AAAA,IAC9B;AAAA,EACF;AACF;AAEA,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,15 +1,15 @@
1
- import React, { useCallback } from "react";
2
- import PropTypes from "prop-types";
1
+ import { getBottomRight, getTopLeft } from "ol/extent";
3
2
  import OLMap from "ol/Map";
4
- import { getTopLeft, getBottomRight } from "ol/extent";
3
+ import PropTypes from "prop-types";
4
+ import React, { useCallback } from "react";
5
5
  import NorthArrowSimple from "../../images/northArrow.url.svg";
6
6
  import NorthArrowCircle from "../../images/northArrowCircle.url.svg";
7
7
  const extraDataImgPropType = PropTypes.shape({
8
- src: PropTypes.string,
9
- width: PropTypes.number,
8
+ circled: PropTypes.bool,
10
9
  height: PropTypes.number,
11
10
  rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),
12
- circled: PropTypes.bool
11
+ src: PropTypes.string,
12
+ width: PropTypes.number
13
13
  });
14
14
  const CanvasPatternType = typeof CanvasPattern === "undefined" ? Function : CanvasPattern;
15
15
  const propTypes = {
@@ -21,26 +21,6 @@ const propTypes = {
21
21
  * Children content of the button.
22
22
  */
23
23
  children: PropTypes.node,
24
- /**
25
- * Output format of the image.
26
- */
27
- format: PropTypes.oneOf(["image/jpeg", "image/png"]),
28
- /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */
29
- map: PropTypes.instanceOf(OLMap),
30
- /**
31
- * Space (in pixels) between the border of the canvas and the elements.
32
- * Default to 1% of the canvas width.
33
- */
34
- margin: PropTypes.number,
35
- /**
36
- * Space (in pixels) between elements.
37
- * Default to 5px.
38
- */
39
- padding: PropTypes.number,
40
- /**
41
- * Extent for the export. If no extent is given, the whole map is exported.
42
- */
43
- extent: PropTypes.arrayOf(PropTypes.number),
44
24
  /**
45
25
  * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).
46
26
  * If no coordinates and no extent are given, the whole map is exported.
@@ -50,21 +30,9 @@ const propTypes = {
50
30
  */
51
31
  coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),
52
32
  /**
53
- * Scale the map for better quality. Possible values: 1, 2 or 3.
54
- * WARNING: The tiled layer with a WMTS or XYZ source must provides an url
55
- * for each scale in the config file.
56
- */
57
- scale: PropTypes.number,
58
- /**
59
- * Function called before the dowload process begins.
60
- */
61
- onSaveStart: PropTypes.func,
62
- /**
63
- * Function called after the dowload process ends.
64
- *
65
- * @param {object} error Error message the process fails.
33
+ * Extent for the export. If no extent is given, the whole map is exported.
66
34
  */
67
- onSaveEnd: PropTypes.func,
35
+ extent: PropTypes.arrayOf(PropTypes.number),
68
36
  /**
69
37
  * Extra data, such as copyright, north arrow configuration.
70
38
  * All extra data is optional.
@@ -109,26 +77,58 @@ const propTypes = {
109
77
  }
110
78
  */
111
79
  extraData: PropTypes.shape({
112
- logo: extraDataImgPropType,
113
- northArrow: extraDataImgPropType,
114
- qrCode: extraDataImgPropType,
115
80
  copyright: PropTypes.shape({
116
- text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
117
- font: PropTypes.string,
81
+ background: PropTypes.bool,
118
82
  fillStyle: PropTypes.oneOfType([
119
83
  PropTypes.string,
120
84
  PropTypes.instanceOf(CanvasPatternType)
121
85
  ]),
122
- background: PropTypes.bool,
86
+ font: PropTypes.string,
123
87
  maxWidth: PropTypes.number,
88
+ paddingBackground: PropTypes.number,
124
89
  paddingBottom: PropTypes.number,
125
- paddingBackground: PropTypes.number
126
- })
90
+ text: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
91
+ }),
92
+ logo: extraDataImgPropType,
93
+ northArrow: extraDataImgPropType,
94
+ qrCode: extraDataImgPropType
127
95
  }),
96
+ /**
97
+ * Output format of the image.
98
+ */
99
+ format: PropTypes.oneOf(["image/jpeg", "image/png"]),
128
100
  /**
129
101
  * Return the file name of the image to download.
130
102
  */
131
- getDownloadImageName: PropTypes.func
103
+ getDownloadImageName: PropTypes.func,
104
+ /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */
105
+ map: PropTypes.instanceOf(OLMap),
106
+ /**
107
+ * Space (in pixels) between the border of the canvas and the elements.
108
+ * Default to 1% of the canvas width.
109
+ */
110
+ margin: PropTypes.number,
111
+ /**
112
+ * Function called after the dowload process ends.
113
+ *
114
+ * @param {object} error Error message the process fails.
115
+ */
116
+ onSaveEnd: PropTypes.func,
117
+ /**
118
+ * Function called before the dowload process begins.
119
+ */
120
+ onSaveStart: PropTypes.func,
121
+ /**
122
+ * Space (in pixels) between elements.
123
+ * Default to 5px.
124
+ */
125
+ padding: PropTypes.number,
126
+ /**
127
+ * Scale the map for better quality. Possible values: 1, 2 or 3.
128
+ * WARNING: The tiled layer with a WMTS or XYZ source must provides an url
129
+ * for each scale in the config file.
130
+ */
131
+ scale: PropTypes.number
132
132
  };
133
133
  const getMargin = (destCanvas) => {
134
134
  const newMargin = destCanvas.width / 100;
@@ -167,8 +167,8 @@ const drawTextBackground = (destContext, x, y, width, height, styleOptions = {})
167
167
  destContext.restore();
168
168
  };
169
169
  const drawCopyright = (destContext, destCanvas, maxWidth, extraData, scale, margin, padding) => {
170
- const { text, font, fillStyle, background } = extraData.copyright;
171
- const { paddingBottom = padding, paddingBackground = 2 } = extraData.copyright;
170
+ const { background, fillStyle, font, text } = extraData.copyright;
171
+ const { paddingBackground = 2, paddingBottom = padding } = extraData.copyright;
172
172
  let copyright = typeof text === "function" ? text() : text?.trim();
173
173
  if (Array.isArray(copyright)) {
174
174
  copyright = copyright.join();
@@ -197,7 +197,7 @@ const drawCopyright = (destContext, destCanvas, maxWidth, extraData, scale, marg
197
197
  let lineX = margin;
198
198
  let lineY = destCanvas.height - paddingBottom;
199
199
  lines.forEach((line) => {
200
- const { width, fontBoundingBoxAscent, fontBoundingBoxDescent } = destContext.measureText(line);
200
+ const { fontBoundingBoxAscent, fontBoundingBoxDescent, width } = destContext.measureText(line);
201
201
  const height = fontBoundingBoxAscent + fontBoundingBoxDescent;
202
202
  let lineTop = lineY - height;
203
203
  if (background) {
@@ -222,7 +222,7 @@ const drawCopyright = (destContext, destCanvas, maxWidth, extraData, scale, marg
222
222
  };
223
223
  const drawElement = (data, destCanvas, scale, margin, padding, previousItemSize = [0, 0], side = "right") => {
224
224
  const destContext = destCanvas.getContext("2d");
225
- const { src, width, height, rotation } = data;
225
+ const { height, rotation, src, width } = data;
226
226
  return new Promise((resolve) => {
227
227
  const img = new Image();
228
228
  img.crossOrigin = "Anonymous";
@@ -274,10 +274,10 @@ const calculatePixelsToExport = (mapToExport, extent, coordinates) => {
274
274
  firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1]
275
275
  ];
276
276
  return {
277
- x: pixelTopLeft[0],
278
- y: pixelTopLeft[1],
277
+ h: pixelBottomRight[1] - pixelTopLeft[1],
279
278
  w: pixelBottomRight[0] - pixelTopLeft[0],
280
- h: pixelBottomRight[1] - pixelTopLeft[1]
279
+ x: pixelTopLeft[0],
280
+ y: pixelTopLeft[1]
281
281
  };
282
282
  }
283
283
  return null;
@@ -298,10 +298,10 @@ const createCanvasImage = (mapToExport, extraData, scale, extent, coordinates, m
298
298
  extent,
299
299
  coordinates
300
300
  ) || {
301
- x: 0,
302
- y: 0,
301
+ h: canvas.height,
303
302
  w: canvas.width,
304
- h: canvas.height
303
+ x: 0,
304
+ y: 0
305
305
  };
306
306
  if (!destCanvas) {
307
307
  destCanvas = document.createElement("canvas");
@@ -416,22 +416,22 @@ const downloadCanvasImage = (canvas, format, getDownloadImageName) => {
416
416
  return promise;
417
417
  };
418
418
  function CanvasSaveButton({
419
- margin = null,
420
- padding = 5,
421
419
  autoDownload = true,
422
420
  children = null,
423
- map = null,
424
- format = "image/png",
425
- extraData = null,
426
- extent = null,
427
421
  coordinates = null,
428
- scale = 1,
422
+ extent = null,
423
+ extraData = null,
424
+ format = "image/png",
429
425
  getDownloadImageName = getDefaultDownloadImageName,
426
+ map = null,
427
+ margin = null,
428
+ onSaveEnd = () => {
429
+ },
430
430
  onSaveStart = (mapp) => {
431
431
  return Promise.resolve(mapp);
432
432
  },
433
- onSaveEnd = () => {
434
- }
433
+ padding = 5,
434
+ scale = 1
435
435
  }) {
436
436
  const onClick = useCallback(
437
437
  (evt) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/CanvasSaveButton/CanvasSaveButton.js"],
4
- "sourcesContent": ["/* eslint-disable no-param-reassign */\nimport React, { useCallback } from \"react\";\nimport PropTypes from \"prop-types\";\nimport OLMap from \"ol/Map\";\nimport { getTopLeft, getBottomRight } from \"ol/extent\";\nimport NorthArrowSimple from \"../../images/northArrow.url.svg\";\nimport NorthArrowCircle from \"../../images/northArrowCircle.url.svg\";\n\nconst extraDataImgPropType = PropTypes.shape({\n src: PropTypes.string,\n width: PropTypes.number,\n height: PropTypes.number,\n rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),\n circled: PropTypes.bool,\n});\n\n// support server-side rendering where `Element` will not be defined\nconst CanvasPatternType =\n typeof CanvasPattern === \"undefined\" ? Function : CanvasPattern;\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf([\"image/jpeg\", \"image/png\"]),\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Space (in pixels) between the border of the canvas and the elements.\n * Default to 1% of the canvas width.\n */\n margin: PropTypes.number,\n\n /**\n * Space (in pixels) between elements.\n * Default to 5px.\n */\n padding: PropTypes.number,\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=false)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.shape({\n logo: extraDataImgPropType,\n northArrow: extraDataImgPropType,\n qrCode: extraDataImgPropType,\n copyright: PropTypes.shape({\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n font: PropTypes.string,\n fillStyle: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.instanceOf(CanvasPatternType),\n ]),\n background: PropTypes.bool,\n maxWidth: PropTypes.number,\n paddingBottom: PropTypes.number,\n paddingBackground: PropTypes.number,\n }),\n }),\n\n /**\n * Return the file name of the image to download.\n */\n getDownloadImageName: PropTypes.func,\n};\n\nconst getMargin = (destCanvas) => {\n const newMargin = destCanvas.width / 100; // 1% of the canvas width\n return newMargin;\n};\n\nconst getDefaultDownloadImageName = (format) => {\n const fileExt = format === \"image/jpeg\" ? \"jpg\" : \"png\";\n return `${window.document.title.replace(/ /g, \"_\").toLowerCase()}.${fileExt}`;\n};\n\nlet multilineCopyright = false;\nlet copyrightY = 0;\n\n// Ensure the font size fita with the image width.\nconst decreaseFontSize = (destContext, maxWidth, copyright, scale) => {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], \"\"), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n multilineCopyright = false;\n\n if (fontSize - 1 === minFontSize) {\n multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n};\n\n// eslint-disable-next-line class-methods-use-this\nconst drawTextBackground = (\n destContext,\n x,\n y,\n width,\n height,\n styleOptions = {},\n) => {\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = \"rgba(255,255,255,.8)\";\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === \"object\") {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(x, y, width, height);\n destContext.restore();\n};\n\nconst drawCopyright = (\n destContext,\n destCanvas,\n maxWidth,\n extraData,\n scale,\n margin,\n padding,\n) => {\n const { text, font, fillStyle, background } = extraData.copyright;\n const { paddingBottom = padding, paddingBackground = 2 } =\n extraData.copyright;\n\n let copyright = typeof text === \"function\" ? text() : text?.trim();\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || \"12px Arial\";\n destContext.font = decreaseFontSize(destContext, maxWidth, copyright, scale);\n destContext.textBaseline = \"bottom\";\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || \"black\";\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n let firstLineMetrics = destContext.measureText(firstLine);\n\n // If the text is bigger than the max width we split it into 2 lines\n if (multilineCopyright) {\n const wordNumber = copyright.split(\" \").length;\n for (let i = 0; i < wordNumber; i += 1) {\n // Stop removing word when fits within one line.\n if (firstLineMetrics.width * scale < maxWidth) {\n break;\n }\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(\" \"));\n firstLineMetrics = destContext.measureText(firstLine);\n }\n }\n\n // Define second line if necessary\n const secondLine = copyright.replace(firstLine, \"\").trim();\n\n // At this point we the number of lines to display.\n const lines = [firstLine, secondLine].filter((l) => !!l).reverse();\n\n // We draw from bottom to top because textBaseline is 'bottom\n let lineX = margin;\n let lineY = destCanvas.height - paddingBottom; // we apply the margin only on the left side\n\n lines.forEach((line) => {\n const { width, fontBoundingBoxAscent, fontBoundingBoxDescent } =\n destContext.measureText(line);\n const height = fontBoundingBoxAscent + fontBoundingBoxDescent; // we include paddingBackground to have a bit of distance between lines\n let lineTop = lineY - height;\n\n if (background) {\n const backgroundX = margin;\n lineTop -= paddingBackground * 2;\n drawTextBackground(\n destContext,\n backgroundX,\n lineTop,\n width + paddingBackground * 2,\n height + paddingBackground * 2,\n background,\n );\n lineX += paddingBackground;\n lineY -= paddingBackground;\n }\n\n destContext.fillText(line, lineX, lineY);\n lineY = lineTop;\n });\n\n copyrightY = lineY;\n destContext.restore();\n};\n\nconst drawElement = (\n data,\n destCanvas,\n scale,\n margin,\n padding,\n previousItemSize = [0, 0],\n side = \"right\",\n) => {\n const destContext = destCanvas.getContext(\"2d\");\n const { src, width, height, rotation } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = \"Anonymous\";\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n const left =\n side === \"left\"\n ? margin + elementWidth / 2\n : destCanvas.width - margin - elementWidth / 2;\n const top =\n (side === \"left\" && copyrightY\n ? copyrightY - padding\n : destCanvas.height) -\n margin -\n elementHeight / 2 -\n previousItemSize[1];\n\n destContext.translate(left, top);\n\n if (rotation) {\n const angle = typeof rotation === \"function\" ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([elementWidth + 2 * padding, elementHeight + 2 * padding]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n};\n\nconst calculatePixelsToExport = (mapToExport, extent, coordinates) => {\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n h: pixelBottomRight[1] - pixelTopLeft[1],\n };\n }\n return null;\n};\n\nconst createCanvasImage = (\n mapToExport,\n extraData,\n scale,\n extent,\n coordinates,\n margin,\n padding,\n) => {\n return new Promise((resolve) => {\n mapToExport.once(\"rendercomplete\", () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName(\"canvas\");\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = calculatePixelsToExport(\n mapToExport,\n extent,\n coordinates,\n ) || {\n x: 0,\n y: 0,\n w: canvas.width,\n h: canvas.height,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement(\"canvas\");\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext(\"2d\");\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n margin = margin || getMargin(destCanvas);\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = drawElement(\n extraData.logo,\n destCanvas,\n scale,\n margin,\n padding,\n );\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n scale,\n margin,\n padding,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth =\n extraData.copyright.maxWidth ||\n (widestElement\n ? destContext.canvas.width - widestElement - margin\n : destContext.canvas.width);\n drawCopyright(\n destContext,\n destCanvas,\n maxWidth,\n extraData,\n scale,\n margin,\n padding,\n );\n }\n let qrCodePromise = Promise.resolve();\n if (destContext && extraData && extraData.qrCode) {\n qrCodePromise = drawElement(\n extraData.qrCode,\n destCanvas,\n scale,\n margin,\n padding,\n undefined,\n \"left\",\n );\n }\n qrCodePromise.then(() => {\n return resolve(destCanvas);\n });\n });\n });\n });\n mapToExport.renderSync();\n });\n};\n\nconst downloadCanvasImage = (canvas, format, getDownloadImageName) => {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open(\"about:blank\", \"\");\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, getDownloadImageName(format));\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement(\"a\");\n link.download = getDownloadImageName(format);\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nfunction CanvasSaveButton({\n margin = null,\n padding = 5,\n autoDownload = true,\n children = null,\n map = null,\n format = \"image/png\",\n extraData = null,\n extent = null,\n coordinates = null,\n scale = 1,\n getDownloadImageName = getDefaultDownloadImageName,\n onSaveStart = (mapp) => {\n return Promise.resolve(mapp);\n },\n onSaveEnd = () => {},\n}) {\n const onClick = useCallback(\n (evt) => {\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n multilineCopyright = false;\n copyrightY = 0;\n onSaveStart(map).then((mapToExport) => {\n return createCanvasImage(\n mapToExport || map,\n extraData,\n scale,\n extent,\n coordinates,\n margin,\n padding,\n )\n .then((canvas) => {\n if (autoDownload) {\n downloadCanvasImage(canvas, format, getDownloadImageName).then(\n (blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n },\n );\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n },\n [\n autoDownload,\n coordinates,\n extent,\n extraData,\n format,\n map,\n margin,\n onSaveEnd,\n onSaveStart,\n padding,\n scale,\n getDownloadImageName,\n ],\n );\n\n return (\n <>\n {React.Children.map(children, (child) => {\n return React.cloneElement(child, { onClick });\n })}\n </>\n );\n}\n\nCanv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A,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF,EACG,KAAK,CAAC,WAAW;AAChB,cAAI,cAAc;AAChB,gCAAoB,QAAQ,QAAQ,oBAAoB,EAAE;AAAA,cACxD,CAAC,SAAS;AACR,0BAAU,aAAa,QAAQ,IAAI;AAAA,cACrC;AAAA,YACF;AAAA,UACF,OAAO;AACL,sBAAU,aAAa,MAAM;AAAA,UAC/B;AAAA,QACF,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAI,KAAK;AAEP,oBAAQ,MAAM,GAAG;AAAA,UACnB;AACA,oBAAU,aAAa,GAAG;AAAA,QAC5B,CAAC;AAAA,MACL,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SACE,0DACG,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,WAAO,MAAM,aAAa,OAAO,EAAE,QAAQ,CAAC;AAAA,EAC9C,CAAC,CACH;AAEJ;AAEA,iBAAiB,YAAY;AAE7B,eAAe;",
4
+ "sourcesContent": ["/* eslint-disable no-param-reassign */\nimport { getBottomRight, getTopLeft } from \"ol/extent\";\nimport OLMap from \"ol/Map\";\nimport PropTypes from \"prop-types\";\nimport React, { useCallback } from \"react\";\n\nimport NorthArrowSimple from \"../../images/northArrow.url.svg\";\nimport NorthArrowCircle from \"../../images/northArrowCircle.url.svg\";\n\nconst extraDataImgPropType = PropTypes.shape({\n circled: PropTypes.bool,\n height: PropTypes.number,\n rotation: PropTypes.oneOfType([PropTypes.number, PropTypes.func]),\n src: PropTypes.string,\n width: PropTypes.number,\n});\n\n// support server-side rendering where `Element` will not be defined\nconst CanvasPatternType =\n typeof CanvasPattern === \"undefined\" ? Function : CanvasPattern;\n\nconst propTypes = {\n /**\n * Automatically download the image saved.\n */\n autoDownload: PropTypes.bool,\n\n /**\n * Children content of the button.\n */\n children: PropTypes.node,\n\n /**\n * Array of 4 [ol/Coordinate](https://openlayers.org/en/latest/apidoc/module-ol_coordinate.html#~Coordinate).\n * If no coordinates and no extent are given, the whole map is exported.\n * This property must be used to export rotated map.\n * If you don't need to export rotated map the extent property can be used as well.\n * If extent is specified, coordinates property is ignored.\n */\n coordinates: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.number)),\n\n /**\n * Extent for the export. If no extent is given, the whole map is exported.\n */\n extent: PropTypes.arrayOf(PropTypes.number),\n\n /**\n * Extra data, such as copyright, north arrow configuration.\n * All extra data is optional.\n *\n * Example 1:\n *\n {\n copyright: {\n text: 'Example copyright', // Copyright text or function\n font: '10px Arial', // Font, default is '12px Arial'\n fillStyle: 'blue', // Fill style, default is 'black'\n },\n northArrow, // True if the north arrow\n // should be placed with default configuration\n // (default image, rotation=0, circled=false)\n }\n * Example 2:\n *\n {\n northArrow: {\n src: NorthArrowCustom,\n width: 60, // Width in px, default is 80\n height: 100, // Height in px, default is 80\n rotation: 25, // Absolute rotation in degrees as number or function\n\n }\n }\n * Example 3:\n *\n {\n copyright: {\n text: () => { // Copyright as function\n return this.copyright;\n },\n },\n northArrow: {\n rotation: () => { // Rotation as function\n return NorthArrow.radToDeg(this.map.getView().getRotation());\n },\n circled, // Display circle around the north arrow (Does not work for custom src)\n },\n }\n */\n extraData: PropTypes.shape({\n copyright: PropTypes.shape({\n background: PropTypes.bool,\n fillStyle: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.instanceOf(CanvasPatternType),\n ]),\n font: PropTypes.string,\n maxWidth: PropTypes.number,\n paddingBackground: PropTypes.number,\n paddingBottom: PropTypes.number,\n text: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),\n }),\n logo: extraDataImgPropType,\n northArrow: extraDataImgPropType,\n qrCode: extraDataImgPropType,\n }),\n\n /**\n * Output format of the image.\n */\n format: PropTypes.oneOf([\"image/jpeg\", \"image/png\"]),\n\n /**\n * Return the file name of the image to download.\n */\n getDownloadImageName: PropTypes.func,\n\n /** An [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html). */\n map: PropTypes.instanceOf(OLMap),\n\n /**\n * Space (in pixels) between the border of the canvas and the elements.\n * Default to 1% of the canvas width.\n */\n margin: PropTypes.number,\n\n /**\n * Function called after the dowload process ends.\n *\n * @param {object} error Error message the process fails.\n */\n onSaveEnd: PropTypes.func,\n\n /**\n * Function called before the dowload process begins.\n */\n onSaveStart: PropTypes.func,\n\n /**\n * Space (in pixels) between elements.\n * Default to 5px.\n */\n padding: PropTypes.number,\n\n /**\n * Scale the map for better quality. Possible values: 1, 2 or 3.\n * WARNING: The tiled layer with a WMTS or XYZ source must provides an url\n * for each scale in the config file.\n */\n scale: PropTypes.number,\n};\n\nconst getMargin = (destCanvas) => {\n const newMargin = destCanvas.width / 100; // 1% of the canvas width\n return newMargin;\n};\n\nconst getDefaultDownloadImageName = (format) => {\n const fileExt = format === \"image/jpeg\" ? \"jpg\" : \"png\";\n return `${window.document.title.replace(/ /g, \"_\").toLowerCase()}.${fileExt}`;\n};\n\nlet multilineCopyright = false;\nlet copyrightY = 0;\n\n// Ensure the font size fita with the image width.\nconst decreaseFontSize = (destContext, maxWidth, copyright, scale) => {\n const minFontSize = 8;\n let sizeMatch;\n let fontSize;\n do {\n sizeMatch = destContext.font.match(/[0-9]+(?:\\.[0-9]+)?(px)/i);\n fontSize = parseInt(sizeMatch[0].replace(sizeMatch[1], \"\"), 10);\n\n // eslint-disable-next-line no-param-reassign\n destContext.font = destContext.font.replace(fontSize, fontSize - 1);\n\n multilineCopyright = false;\n\n if (fontSize - 1 === minFontSize) {\n multilineCopyright = true;\n }\n } while (\n fontSize - 1 > minFontSize &&\n destContext.measureText(copyright).width * scale > maxWidth\n );\n\n return destContext.font;\n};\n\n// eslint-disable-next-line class-methods-use-this\nconst drawTextBackground = (\n destContext,\n x,\n y,\n width,\n height,\n styleOptions = {},\n) => {\n destContext.save();\n // Dflt is a white background\n destContext.fillStyle = \"rgba(255,255,255,.8)\";\n\n // To simplify usability the user could pass a boolean to use only default values.\n if (typeof styleOptions === \"object\") {\n Object.entries(styleOptions).forEach(([key, value]) => {\n destContext[key] = value;\n });\n }\n\n /// draw background rect assuming height of font\n destContext.fillRect(x, y, width, height);\n destContext.restore();\n};\n\nconst drawCopyright = (\n destContext,\n destCanvas,\n maxWidth,\n extraData,\n scale,\n margin,\n padding,\n) => {\n const { background, fillStyle, font, text } = extraData.copyright;\n const { paddingBackground = 2, paddingBottom = padding } =\n extraData.copyright;\n\n let copyright = typeof text === \"function\" ? text() : text?.trim();\n\n if (Array.isArray(copyright)) {\n copyright = copyright.join();\n }\n\n destContext.save();\n destContext.scale(scale, scale);\n destContext.font = font || \"12px Arial\";\n destContext.font = decreaseFontSize(destContext, maxWidth, copyright, scale);\n destContext.textBaseline = \"bottom\";\n destContext.scale(scale, scale);\n destContext.fillStyle = fillStyle || \"black\";\n\n // We search if the display on 2 line is necessary\n let firstLine = copyright;\n let firstLineMetrics = destContext.measureText(firstLine);\n\n // If the text is bigger than the max width we split it into 2 lines\n if (multilineCopyright) {\n const wordNumber = copyright.split(\" \").length;\n for (let i = 0; i < wordNumber; i += 1) {\n // Stop removing word when fits within one line.\n if (firstLineMetrics.width * scale < maxWidth) {\n break;\n }\n firstLine = firstLine.substring(0, firstLine.lastIndexOf(\" \"));\n firstLineMetrics = destContext.measureText(firstLine);\n }\n }\n\n // Define second line if necessary\n const secondLine = copyright.replace(firstLine, \"\").trim();\n\n // At this point we the number of lines to display.\n const lines = [firstLine, secondLine].filter((l) => !!l).reverse();\n\n // We draw from bottom to top because textBaseline is 'bottom\n let lineX = margin;\n let lineY = destCanvas.height - paddingBottom; // we apply the margin only on the left side\n\n lines.forEach((line) => {\n const { fontBoundingBoxAscent, fontBoundingBoxDescent, width } =\n destContext.measureText(line);\n const height = fontBoundingBoxAscent + fontBoundingBoxDescent; // we include paddingBackground to have a bit of distance between lines\n let lineTop = lineY - height;\n\n if (background) {\n const backgroundX = margin;\n lineTop -= paddingBackground * 2;\n drawTextBackground(\n destContext,\n backgroundX,\n lineTop,\n width + paddingBackground * 2,\n height + paddingBackground * 2,\n background,\n );\n lineX += paddingBackground;\n lineY -= paddingBackground;\n }\n\n destContext.fillText(line, lineX, lineY);\n lineY = lineTop;\n });\n\n copyrightY = lineY;\n destContext.restore();\n};\n\nconst drawElement = (\n data,\n destCanvas,\n scale,\n margin,\n padding,\n previousItemSize = [0, 0],\n side = \"right\",\n) => {\n const destContext = destCanvas.getContext(\"2d\");\n const { height, rotation, src, width } = data;\n\n return new Promise((resolve) => {\n const img = new Image();\n img.crossOrigin = \"Anonymous\";\n img.src = src;\n img.onload = () => {\n destContext.save();\n const elementWidth = (width || 80) * scale;\n const elementHeight = (height || 80) * scale;\n const left =\n side === \"left\"\n ? margin + elementWidth / 2\n : destCanvas.width - margin - elementWidth / 2;\n const top =\n (side === \"left\" && copyrightY\n ? copyrightY - padding\n : destCanvas.height) -\n margin -\n elementHeight / 2 -\n previousItemSize[1];\n\n destContext.translate(left, top);\n\n if (rotation) {\n const angle = typeof rotation === \"function\" ? rotation() : rotation;\n destContext.rotate(angle * (Math.PI / 180));\n }\n\n destContext.drawImage(\n img,\n -elementWidth / 2,\n -elementHeight / 2,\n elementWidth,\n elementHeight,\n );\n destContext.restore();\n\n // Return the pixels width of the arrow and the margin right,\n // that must not be occupied by the copyright.\n resolve([elementWidth + 2 * padding, elementHeight + 2 * padding]);\n };\n\n img.onerror = () => {\n resolve();\n };\n });\n};\n\nconst calculatePixelsToExport = (mapToExport, extent, coordinates) => {\n let firstCoordinate;\n let oppositeCoordinate;\n\n if (extent) {\n firstCoordinate = getTopLeft(extent);\n oppositeCoordinate = getBottomRight(extent);\n } else if (coordinates) {\n // In case of coordinates coming from DragBox interaction:\n // firstCoordinate is the first coordinate drawn by the user.\n // oppositeCoordinate is the coordinate of the point dragged by the user.\n [firstCoordinate, , oppositeCoordinate] = coordinates;\n }\n\n if (firstCoordinate && oppositeCoordinate) {\n const firstPixel = mapToExport.getPixelFromCoordinate(firstCoordinate);\n const oppositePixel =\n mapToExport.getPixelFromCoordinate(oppositeCoordinate);\n const pixelTopLeft = [\n firstPixel[0] <= oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] <= oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n const pixelBottomRight = [\n firstPixel[0] > oppositePixel[0] ? firstPixel[0] : oppositePixel[0],\n firstPixel[1] > oppositePixel[1] ? firstPixel[1] : oppositePixel[1],\n ];\n\n return {\n h: pixelBottomRight[1] - pixelTopLeft[1],\n w: pixelBottomRight[0] - pixelTopLeft[0],\n x: pixelTopLeft[0],\n y: pixelTopLeft[1],\n };\n }\n return null;\n};\n\nconst createCanvasImage = (\n mapToExport,\n extraData,\n scale,\n extent,\n coordinates,\n margin,\n padding,\n) => {\n return new Promise((resolve) => {\n mapToExport.once(\"rendercomplete\", () => {\n // Find all layer canvases and add it to dest canvas.\n const canvases = mapToExport\n .getTargetElement()\n .getElementsByTagName(\"canvas\");\n\n // Create the canvas to export with the good size.\n let destCanvas;\n let destContext;\n\n // canvases is an HTMLCollection, we don't try to transform to array because some compilers like cra doesn't translate it right.\n for (let i = 0; i < canvases.length; i += 1) {\n const canvas = canvases[i];\n if (!canvas.width || !canvas.height) {\n // eslint-disable-next-line no-continue\n continue;\n }\n const clip = calculatePixelsToExport(\n mapToExport,\n extent,\n coordinates,\n ) || {\n h: canvas.height,\n w: canvas.width,\n x: 0,\n y: 0,\n };\n\n if (!destCanvas) {\n destCanvas = document.createElement(\"canvas\");\n destCanvas.width = clip.w;\n destCanvas.height = clip.h;\n destContext = destCanvas.getContext(\"2d\");\n }\n\n // Draw canvas to the canvas to export.\n destContext.drawImage(\n canvas,\n clip.x,\n clip.y,\n clip.w,\n clip.h,\n 0,\n 0,\n destCanvas.width,\n destCanvas.height,\n );\n }\n\n margin = margin || getMargin(destCanvas);\n\n // Custom info\n let logoPromise = Promise.resolve();\n if (destContext && extraData && extraData.logo) {\n logoPromise = drawElement(\n extraData.logo,\n destCanvas,\n scale,\n margin,\n padding,\n );\n }\n\n logoPromise.then((logoSize = [0, 0]) => {\n // North arrow\n let arrowPromise = Promise.resolve();\n if (destContext && extraData && extraData.northArrow) {\n arrowPromise = drawElement(\n {\n src: extraData.northArrow.circled\n ? NorthArrowCircle\n : NorthArrowSimple,\n ...extraData.northArrow,\n },\n destCanvas,\n scale,\n margin,\n padding,\n logoSize,\n );\n }\n\n // Copyright\n arrowPromise.then((arrowSize = [0, 0]) => {\n const widestElement = Math.max(logoSize[0], arrowSize[0]);\n if (\n destContext &&\n extraData &&\n extraData.copyright &&\n extraData.copyright.text\n ) {\n const maxWidth =\n extraData.copyright.maxWidth ||\n (widestElement\n ? destContext.canvas.width - widestElement - margin\n : destContext.canvas.width);\n drawCopyright(\n destContext,\n destCanvas,\n maxWidth,\n extraData,\n scale,\n margin,\n padding,\n );\n }\n let qrCodePromise = Promise.resolve();\n if (destContext && extraData && extraData.qrCode) {\n qrCodePromise = drawElement(\n extraData.qrCode,\n destCanvas,\n scale,\n margin,\n padding,\n undefined,\n \"left\",\n );\n }\n qrCodePromise.then(() => {\n return resolve(destCanvas);\n });\n });\n });\n });\n mapToExport.renderSync();\n });\n};\n\nconst downloadCanvasImage = (canvas, format, getDownloadImageName) => {\n // Use blob for large images\n const promise = new Promise((resolve) => {\n if (/msie (9|10)/gi.test(window.navigator.userAgent.toLowerCase())) {\n // ie 9 and 10\n const url = canvas.toDataURL(format);\n const w = window.open(\"about:blank\", \"\");\n w.document.write(`<img src=\"${url}\" alt=\"from canvas\"/>`);\n resolve(url);\n }\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n let image;\n try {\n image = canvas.msToBlob();\n } catch (e) {\n // eslint-disable-next-line no-console\n console.log(e);\n }\n const blob = new Blob([image], {\n type: format,\n });\n resolve(blob);\n window.navigator.msSaveBlob(blob, getDownloadImageName(format));\n } else {\n canvas.toBlob((blob) => {\n const link = document.createElement(\"a\");\n link.download = getDownloadImageName(format);\n link.href = URL.createObjectURL(blob);\n // append child to document for firefox to be able to download.\n document.body.appendChild(link);\n link.click();\n resolve(blob);\n }, format);\n }\n });\n return promise;\n};\n\n/**\n * The CanvasSaveButton component creates a button to save\n * an [ol/map](https://openlayers.org/en/latest/apidoc/module-ol_Map-Map.html)\n * canvas as an image.\n */\nfunction CanvasSaveButton({\n autoDownload = true,\n children = null,\n coordinates = null,\n extent = null,\n extraData = null,\n format = \"image/png\",\n getDownloadImageName = getDefaultDownloadImageName,\n map = null,\n margin = null,\n onSaveEnd = () => {},\n onSaveStart = (mapp) => {\n return Promise.resolve(mapp);\n },\n padding = 5,\n scale = 1,\n}) {\n const onClick = useCallback(\n (evt) => {\n if (window.navigator.msSaveBlob) {\n // ie only\n evt.preventDefault();\n evt.stopPropagation();\n }\n multilineCopyright = false;\n copyrightY = 0;\n onSaveStart(map).then((mapToExport) => {\n return createCanvasImage(\n mapToExport || map,\n extraData,\n scale,\n extent,\n coordinates,\n margin,\n padding,\n )\n .then((canvas) => {\n if (autoDownload) {\n downloadCanvasImage(canvas, format, getDownloadImageName).then(\n (blob) => {\n onSaveEnd(mapToExport, canvas, blob);\n },\n );\n } else {\n onSaveEnd(mapToExport, canvas);\n }\n })\n .catch((err) => {\n if (err) {\n // eslint-disable-next-line no-console\n console.error(err);\n }\n onSaveEnd(mapToExport, err);\n });\n });\n },\n [\n autoDownload,\n coordinates,\n extent,\n extraData,\n format,\n map,\n margin,\n onSaveEnd,\n onSaveStart,\n padding,\n scale,\n getDownloadImageName,\n ],\n );\n\n return (\n <>\n {React.Children.map(children, (child) => {\n return React.cloneElement(child, { onClick });\n })}\n </>\n );\n}\n\nCanvasSaveButton.propTypes = propTypes;\n\nexport default CanvasSaveButton;\n"],
5
+ "mappings": "AACA,SAAS,gBAAgB,kBAAkB;AAC3C,OAAO,WAAW;AAClB,OAAO,eAAe;AACtB,OA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EAAE;AAAA,cACxD,CAAC,SAAS;AACR,0BAAU,aAAa,QAAQ,IAAI;AAAA,cACrC;AAAA,YACF;AAAA,UACF,OAAO;AACL,sBAAU,aAAa,MAAM;AAAA,UAC/B;AAAA,QACF,CAAC,EACA,MAAM,CAAC,QAAQ;AACd,cAAI,KAAK;AAEP,oBAAQ,MAAM,GAAG;AAAA,UACnB;AACA,oBAAU,aAAa,GAAG;AAAA,QAC5B,CAAC;AAAA,MACL,CAAC;AAAA,IACH;AAAA,IACA;AAAA,MACE;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SACE,0DACG,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,WAAO,MAAM,aAAa,OAAO,EAAE,QAAQ,CAAC;AAAA,EAC9C,CAAC,CACH;AAEJ;AAEA,iBAAiB,YAAY;AAE7B,eAAe;",
6
6
  "names": []
7
7
  }
@@ -1,46 +1,46 @@
1
- import React, { useMemo, useEffect, useState } from "react";
2
- import PropTypes from "prop-types";
3
- import { Map } from "ol";
4
1
  import { CopyrightControl } from "mobility-toolbox-js/ol";
2
+ import { Map } from "ol";
3
+ import PropTypes from "prop-types";
4
+ import React, { useEffect, useMemo, useState } from "react";
5
5
  const propTypes = {
6
6
  /**
7
- * A map.
7
+ * CSS class of th root element
8
8
  */
9
- map: PropTypes.instanceOf(Map).isRequired,
9
+ className: PropTypes.string,
10
10
  /**
11
11
  * Format function. Called with an array of copyrights from visible layers
12
12
  * and returns the copyright.
13
13
  */
14
14
  format: PropTypes.func,
15
15
  /**
16
- * CSS class of th root element
16
+ * A map.
17
17
  */
18
- className: PropTypes.string
18
+ map: PropTypes.instanceOf(Map).isRequired
19
19
  };
20
20
  const defaultProps = {
21
+ className: "rs-copyright",
21
22
  format: (copyrights) => {
22
23
  return copyrights.join(" | ");
23
- },
24
- className: "rs-copyright"
24
+ }
25
25
  };
26
26
  function Copyright({
27
- map,
28
27
  className = defaultProps.className,
29
28
  format = defaultProps.format,
29
+ map,
30
30
  ...other
31
31
  }) {
32
32
  const [copyrights, setCopyrights] = useState([]);
33
33
  const control = useMemo(
34
34
  () => {
35
35
  return new CopyrightControl({
36
- target: document.createElement("div"),
37
36
  element: document.createElement("div"),
38
37
  render() {
39
38
  const newCopyrights = this.getCopyrights();
40
39
  if (copyrights.toString() !== newCopyrights.toString()) {
41
40
  setCopyrights(newCopyrights);
42
41
  }
43
- }
42
+ },
43
+ target: document.createElement("div")
44
44
  });
45
45
  },
46
46
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/Copyright/Copyright.js"],
4
- "sourcesContent": ["import React, { useMemo, useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport { Map } from \"ol\";\nimport { CopyrightControl } from \"mobility-toolbox-js/ol\";\n\nconst propTypes = {\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n\n /**\n * Format function. Called with an array of copyrights from visible layers\n * and returns the copyright.\n */\n format: PropTypes.func,\n\n /**\n * CSS class of th root element\n */\n className: PropTypes.string,\n};\n\nconst defaultProps = {\n format: (copyrights) => {\n return copyrights.join(\" | \");\n },\n className: \"rs-copyright\",\n};\n\n/**\n * The Copyright component uses the\n * [mobility-toolbox-js CopyrightControl](https://mobility-toolbox-js.geops.io/api/class/src/mapbox/controls/CopyrightControl%20js~CopyrightControl%20html-offset-anchor)\n * to render the layer copyrights.\n */\nfunction Copyright({\n map,\n className = defaultProps.className,\n format = defaultProps.format,\n ...other\n}) {\n const [copyrights, setCopyrights] = useState([]);\n\n const control = useMemo(\n () => {\n return new CopyrightControl({\n target: document.createElement(\"div\"),\n element: document.createElement(\"div\"),\n render() {\n // eslint-disable-next-line react/no-this-in-sfc\n const newCopyrights = this.getCopyrights();\n if (copyrights.toString() !== newCopyrights.toString()) {\n setCopyrights(newCopyrights);\n }\n },\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control || !control.getCopyrights().length) {\n return null;\n }\n\n return (\n <div\n className={className}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: format(copyrights) || \"\",\n }}\n />\n );\n}\n\nCopyright.propTypes = propTypes;\n\nexport default React.memo(Copyright);\n"],
5
- "mappings": "AAAA,OAAO,SAAS,SAAS,WAAW,gBAAgB;AACpD,OAAO,eAAe;AACtB,SAAS,WAAW;AACpB,SAAS,wBAAwB;AAEjC,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,KAAK,UAAU,WAAW,GAAG,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/B,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA,EAKlB,WAAW,UAAU;AACvB;AAEA,MAAM,eAAe;AAAA,EACnB,QAAQ,CAAC,eAAe;AACtB,WAAO,WAAW,KAAK,KAAK;AAAA,EAC9B;AAAA,EACA,WAAW;AACb;AAOA,SAAS,UAAU;AAAA,EACjB;AAAA,EACA,YAAY,aAAa;AAAA,EACzB,SAAS,aAAa;AAAA,EACtB,GAAG;AACL,GAAG;AACD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC,CAAC;AAE/C,QAAM,UAAU;AAAA,IACd,MAAM;AACJ,aAAO,IAAI,iBAAiB;AAAA,QAC1B,QAAQ,SAAS,cAAc,KAAK;AAAA,QACpC,SAAS,SAAS,cAAc,KAAK;AAAA,QACrC,SAAS;AAEP,gBAAM,gBAAgB,KAAK,cAAc;AACzC,cAAI,WAAW,SAAS,MAAM,cAAc,SAAS,GAAG;AACtD,0BAAc,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA;AAAA,IAEA,CAAC;AAAA,EACH;AAGA,YAAU,MAAM;AACd,QAAI,CAAC,SAAS;AACZ,aAAO,MAAM;AAAA,MAAC;AAAA,IAChB;AAEA,YAAQ,MAAM;AAEd,WAAO,MAAM;AACX,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AAEjB,MAAI,CAAC,WAAW,CAAC,QAAQ,cAAc,EAAE,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MAEC,GAAG;AAAA,MAEJ,yBAAyB;AAAA,QACvB,QAAQ,OAAO,UAAU,KAAK;AAAA,MAChC;AAAA;AAAA,EACF;AAEJ;AAEA,UAAU,YAAY;AAEtB,eAAe,MAAM,KAAK,SAAS;",
4
+ "sourcesContent": ["import { CopyrightControl } from \"mobility-toolbox-js/ol\";\nimport { Map } from \"ol\";\nimport PropTypes from \"prop-types\";\nimport React, { useEffect, useMemo, useState } from \"react\";\n\nconst propTypes = {\n /**\n * CSS class of th root element\n */\n className: PropTypes.string,\n\n /**\n * Format function. Called with an array of copyrights from visible layers\n * and returns the copyright.\n */\n format: PropTypes.func,\n\n /**\n * A map.\n */\n map: PropTypes.instanceOf(Map).isRequired,\n};\n\nconst defaultProps = {\n className: \"rs-copyright\",\n format: (copyrights) => {\n return copyrights.join(\" | \");\n },\n};\n\n/**\n * The Copyright component uses the\n * [mobility-toolbox-js CopyrightControl](https://mobility-toolbox-js.geops.io/api/class/src/mapbox/controls/CopyrightControl%20js~CopyrightControl%20html-offset-anchor)\n * to render the layer copyrights.\n */\nfunction Copyright({\n className = defaultProps.className,\n format = defaultProps.format,\n map,\n ...other\n}) {\n const [copyrights, setCopyrights] = useState([]);\n\n const control = useMemo(\n () => {\n return new CopyrightControl({\n element: document.createElement(\"div\"),\n render() {\n // eslint-disable-next-line react/no-this-in-sfc\n const newCopyrights = this.getCopyrights();\n if (copyrights.toString() !== newCopyrights.toString()) {\n setCopyrights(newCopyrights);\n }\n },\n target: document.createElement(\"div\"),\n });\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [],\n );\n\n // Ensure the control is not associated to the wrong map\n useEffect(() => {\n if (!control) {\n return () => {};\n }\n\n control.map = map;\n\n return () => {\n control.map = null;\n };\n }, [map, control]);\n\n if (!control || !control.getCopyrights().length) {\n return null;\n }\n\n return (\n <div\n className={className}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: format(copyrights) || \"\",\n }}\n />\n );\n}\n\nCopyright.propTypes = propTypes;\n\nexport default React.memo(Copyright);\n"],
5
+ "mappings": "AAAA,SAAS,wBAAwB;AACjC,SAAS,WAAW;AACpB,OAAO,eAAe;AACtB,OAAO,SAAS,WAAW,SAAS,gBAAgB;AAEpD,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,WAAW,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMrB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA,EAKlB,KAAK,UAAU,WAAW,GAAG,EAAE;AACjC;AAEA,MAAM,eAAe;AAAA,EACnB,WAAW;AAAA,EACX,QAAQ,CAAC,eAAe;AACtB,WAAO,WAAW,KAAK,KAAK;AAAA,EAC9B;AACF;AAOA,SAAS,UAAU;AAAA,EACjB,YAAY,aAAa;AAAA,EACzB,SAAS,aAAa;AAAA,EACtB;AAAA,EACA,GAAG;AACL,GAAG;AACD,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,CAAC,CAAC;AAE/C,QAAM,UAAU;AAAA,IACd,MAAM;AACJ,aAAO,IAAI,iBAAiB;AAAA,QAC1B,SAAS,SAAS,cAAc,KAAK;AAAA,QACrC,SAAS;AAEP,gBAAM,gBAAgB,KAAK,cAAc;AACzC,cAAI,WAAW,SAAS,MAAM,cAAc,SAAS,GAAG;AACtD,0BAAc,aAAa;AAAA,UAC7B;AAAA,QACF;AAAA,QACA,QAAQ,SAAS,cAAc,KAAK;AAAA,MACtC,CAAC;AAAA,IACH;AAAA;AAAA,IAEA,CAAC;AAAA,EACH;AAGA,YAAU,MAAM;AACd,QAAI,CAAC,SAAS;AACZ,aAAO,MAAM;AAAA,MAAC;AAAA,IAChB;AAEA,YAAQ,MAAM;AAEd,WAAO,MAAM;AACX,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AAEjB,MAAI,CAAC,WAAW,CAAC,QAAQ,cAAc,EAAE,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MAEC,GAAG;AAAA,MAEJ,yBAAyB;AAAA,QACvB,QAAQ,OAAO,UAAU,KAAK;AAAA,MAChC;AAAA;AAAA,EACF;AAEJ;AAEA,UAAU,YAAY;AAEtB,eAAe,MAAM,KAAK,SAAS;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
- import React, { PureComponent } from "react";
2
- import PropTypes from "prop-types";
3
- import KMLFormat from "ol/format/KML";
4
1
  import { Layer } from "mobility-toolbox-js/ol";
2
+ import KMLFormat from "ol/format/KML";
3
+ import PropTypes from "prop-types";
4
+ import React, { PureComponent } from "react";
5
5
  import KML from "../../utils/KML";
6
6
  const propTypes = {
7
7
  /**
@@ -56,12 +56,12 @@ class FeatureExportButton extends PureComponent {
56
56
  }
57
57
  }
58
58
  render() {
59
- const { children, layer, projection, format, ...other } = this.props;
59
+ const { children, format, layer, projection, ...other } = this.props;
60
60
  return /* @__PURE__ */ React.createElement(
61
61
  "div",
62
62
  {
63
- role: "button",
64
63
  className: "rs-feature-export-button",
64
+ role: "button",
65
65
  tabIndex: 0,
66
66
  ...other,
67
67
  onClick: () => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/FeatureExportButton/FeatureExportButton.js"],
4
- "sourcesContent": ["import React, { PureComponent } from \"react\";\nimport PropTypes from \"prop-types\";\nimport KMLFormat from \"ol/format/KML\";\nimport { Layer } from \"mobility-toolbox-js/ol\";\nimport KML from \"../../utils/KML\";\n\nconst propTypes = {\n /**\n * Children content of the Feature export button.\n */\n children: PropTypes.node,\n\n /**\n * Format to export features (function).\n * Supported formats: https://openlayers.org/en/latest/apidoc/module-ol_format_Feature-FeatureFormat.html\n */\n format: PropTypes.func,\n\n /**\n * An existing [mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers),\n * using a valid [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html)\n */\n layer: PropTypes.instanceOf(Layer).isRequired,\n\n /**\n * Map projection.\n */\n projection: PropTypes.string,\n};\n\nconst defaultProps = {\n children: null,\n format: KMLFormat,\n projection: \"EPSG:3857\",\n};\n\n/**\n * The FeatureExportButton component creates a button that exports feature geometries\n * from a [[mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)]\n * containing an [ol/layer/Vector](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\n * with a [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html) on click.<br>\n * The default export format is KML, which supports the features' style export.<br>\n * Other formats do not always support style export (See specific format specs).\n */\nclass FeatureExportButton extends PureComponent {\n static createFeatureString(layer, projection, format) {\n if (format === KMLFormat) {\n return KML.writeFeatures(layer, projection);\n }\n\n // eslint-disable-next-line new-cap\n return new format().writeFeatures(layer.olLayer.getSource().getFeatures(), {\n featureProjection: projection,\n });\n }\n\n static exportFeatures(layer, projection, format) {\n const now = new Date()\n .toJSON()\n .slice(0, 20)\n .replace(/[.:T-]+/g, \"\");\n const featString = this.createFeatureString(layer, projection, format);\n\n const formatString = featString\n ? featString.match(/<(\\w+)\\s+\\w+.*?>/)[1]\n : \"xml\";\n\n const fileName = `exported_features_${now}.${formatString}`;\n const charset = document.characterSet || \"UTF-8\";\n const type = `${\n formatString === \"kml\"\n ? \"data:application/vnd.google-earth.kml+xml\"\n : \"data:text/xml\"\n };charset=${charset}`;\n\n if (featString) {\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n window.navigator.msSaveBlob(new Blob([featString], { type }), fileName);\n } else {\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = `${type},${encodeURIComponent(featString)}`;\n link.click();\n }\n }\n }\n\n render() {\n const { children, layer, projection, format, ...other } = this.props;\n\n return (\n <div\n role=\"button\"\n className=\"rs-feature-export-button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={() => {\n return FeatureExportButton.exportFeatures(layer, projection, format);\n }}\n onKeyPress={(evt) => {\n return (\n evt.which === 13 &&\n FeatureExportButton.exportFeatures(layer, projection, format)\n );\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nFeatureExportButton.propTypes = propTypes;\nFeatureExportButton.defaultProps = defaultProps;\n\nexport default FeatureExportButton;\n"],
5
- "mappings": "AAAA,OAAO,SAAS,qBAAqB;AACrC,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,SAAS,aAAa;AACtB,OAAO,SAAS;AAEhB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,OAAO,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKnC,YAAY,UAAU;AACxB;AAEA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,YAAY;AACd;AAUA,MAAM,4BAA4B,cAAc;AAAA,EAC9C,OAAO,oBAAoB,OAAO,YAAY,QAAQ;AACpD,QAAI,WAAW,WAAW;AACxB,aAAO,IAAI,cAAc,OAAO,UAAU;AAAA,IA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;AACF;AAEA,oBAAoB,YAAY;AAChC,oBAAoB,eAAe;AAEnC,eAAe;",
4
+ "sourcesContent": ["import { Layer } from \"mobility-toolbox-js/ol\";\nimport KMLFormat from \"ol/format/KML\";\nimport PropTypes from \"prop-types\";\nimport React, { PureComponent } from \"react\";\n\nimport KML from \"../../utils/KML\";\n\nconst propTypes = {\n /**\n * Children content of the Feature export button.\n */\n children: PropTypes.node,\n\n /**\n * Format to export features (function).\n * Supported formats: https://openlayers.org/en/latest/apidoc/module-ol_format_Feature-FeatureFormat.html\n */\n format: PropTypes.func,\n\n /**\n * An existing [mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers),\n * using a valid [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html)\n */\n layer: PropTypes.instanceOf(Layer).isRequired,\n\n /**\n * Map projection.\n */\n projection: PropTypes.string,\n};\n\nconst defaultProps = {\n children: null,\n format: KMLFormat,\n projection: \"EPSG:3857\",\n};\n\n/**\n * The FeatureExportButton component creates a button that exports feature geometries\n * from a [[mobility-toolbox-js Layer](https://mobility-toolbox-js.geops.io/api/identifiers%20html#ol-layers)]\n * containing an [ol/layer/Vector](https://openlayers.org/en/latest/apidoc/module-ol_layer_Vector-VectorLayer.html)\n * with a [ol/source/Vector](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector.html) on click.<br>\n * The default export format is KML, which supports the features' style export.<br>\n * Other formats do not always support style export (See specific format specs).\n */\nclass FeatureExportButton extends PureComponent {\n static createFeatureString(layer, projection, format) {\n if (format === KMLFormat) {\n return KML.writeFeatures(layer, projection);\n }\n\n // eslint-disable-next-line new-cap\n return new format().writeFeatures(layer.olLayer.getSource().getFeatures(), {\n featureProjection: projection,\n });\n }\n\n static exportFeatures(layer, projection, format) {\n const now = new Date()\n .toJSON()\n .slice(0, 20)\n .replace(/[.:T-]+/g, \"\");\n const featString = this.createFeatureString(layer, projection, format);\n\n const formatString = featString\n ? featString.match(/<(\\w+)\\s+\\w+.*?>/)[1]\n : \"xml\";\n\n const fileName = `exported_features_${now}.${formatString}`;\n const charset = document.characterSet || \"UTF-8\";\n const type = `${\n formatString === \"kml\"\n ? \"data:application/vnd.google-earth.kml+xml\"\n : \"data:text/xml\"\n };charset=${charset}`;\n\n if (featString) {\n if (window.navigator.msSaveBlob) {\n // ie 11 and higher\n window.navigator.msSaveBlob(new Blob([featString], { type }), fileName);\n } else {\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = `${type},${encodeURIComponent(featString)}`;\n link.click();\n }\n }\n }\n\n render() {\n const { children, format, layer, projection, ...other } = this.props;\n\n return (\n <div\n className=\"rs-feature-export-button\"\n role=\"button\"\n tabIndex={0}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...other}\n onClick={() => {\n return FeatureExportButton.exportFeatures(layer, projection, format);\n }}\n onKeyPress={(evt) => {\n return (\n evt.which === 13 &&\n FeatureExportButton.exportFeatures(layer, projection, format)\n );\n }}\n >\n {children}\n </div>\n );\n }\n}\n\nFeatureExportButton.propTypes = propTypes;\nFeatureExportButton.defaultProps = defaultProps;\n\nexport default FeatureExportButton;\n"],
5
+ "mappings": "AAAA,SAAS,aAAa;AACtB,OAAO,eAAe;AACtB,OAAO,eAAe;AACtB,OAAO,SAAS,qBAAqB;AAErC,OAAO,SAAS;AAEhB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA,EAIhB,UAAU,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMpB,QAAQ,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,OAAO,UAAU,WAAW,KAAK,EAAE;AAAA;AAAA;AAAA;AAAA,EAKnC,YAAY,UAAU;AACxB;AAEA,MAAM,eAAe;AAAA,EACnB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,YAAY;AACd;AAUA,MAAM,4BAA4B,cAAc;AAAA,EAC9C,OAAO,oBAAoB,OAAO,YAAY,QAAQ;AACpD,QAAI,WAAW,WAAW;AACxB,aA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