react-spatial 1.7.0 → 1.7.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -108,7 +108,7 @@ function RouteStop({
108
108
  return e.which === 13 && onStationClick(stop, e);
109
109
  }
110
110
  },
111
- /* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, typeof arrivalDelay === "undefined" || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
111
+ /* @__PURE__ */ React.createElement("div", { className: "rt-route-delay" }, arrivalDelay === void 0 || arrivalDelay === null || isFirstStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
112
112
  "span",
113
113
  {
114
114
  className: `rt-route-delay-arrival${` ${getDelayColor(
@@ -116,7 +116,7 @@ function RouteStop({
116
116
  )}`}`
117
117
  },
118
118
  `+${getDelayString(arrivalDelay)}`
119
- ), typeof departureDelay === "undefined" || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
119
+ ), departureDelay === void 0 || departureDelay === null || isLastStation || cancelled ? "" : /* @__PURE__ */ React.createElement(
120
120
  "span",
121
121
  {
122
122
  className: `rt-route-delay-departure${` ${getDelayColor(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/RouteSchedule/RouteSchedule.js"],
4
- "sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from \"mobility-toolbox-js/ol\";\nimport { getHoursAndMinutes, getDelayString } from \"../../utils/timeUtils\";\nimport ReactTransitPropTypes from \"../../propTypes\";\nimport firstStation from \"../../images/RouteSchedule/firstStation.png\";\nimport station from \"../../images/RouteSchedule/station.png\";\nimport lastStation from \"../../images/RouteSchedule/lastStation.png\";\nimport line from \"../../images/RouteSchedule/line.png\";\n\nconst { getBgColor } = realtimeConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return \"dark-red\";\n }\n if (secs >= 500) {\n return \"middle-red\";\n }\n if (secs >= 300) {\n return \"light-red\";\n }\n if (secs >= 180) {\n return \"orange\";\n }\n return \"green\";\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nfunction RouteStop({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) {\n const {\n arrivalDelay,\n departureDelay,\n state,\n stationName,\n aimedArrivalTime,\n aimedDepartureTime,\n } = stop;\n const cancelled = state === \"JOURNEY_CANCELLED\" || state === \"STOP_CANCELLED\";\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\n role=\"button\"\n className={[\n \"rt-route-station\",\n isStationPassed ? \" rt-passed\" : \"\",\n isNotStation ? \" rt-no-stop\" : \"\",\n ].join(\"\")}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {typeof arrivalDelay === \"undefined\" || isFirstStation || cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {typeof departureDelay === \"undefined\" || isLastStation || cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { stationId, arrivalTime, departureTime, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split(\".\")[0], 10);\n if (!longName.includes(id) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons,\n renderRouteIdentifier,\n}) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || \"black\",\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n text\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span>&nbsp;-&nbsp;</span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span>&nbsp;(</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && \")\"}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the route identifier in the header\n */\n renderRouteIdentifier: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: \"rt-route-schedule\",\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderRouteIdentifier: defaultRenderRouteIdentifier,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
5
- "mappings": "AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9B,QAAM,OAAO,KAAK,MAAQ,OAAO,OAAO,IAAK,OAAQ,GAAI;AACzD,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,MAAM,YAAY,CAAC,SAAS;AAC1B,SAAO,CAAC,KAAK,eAAe,CAAC,KAAK;AACpC;AASA,MAAM,WAAW,CAAC,MAAM,MAAM,OAAO,QAAQ;AAG3C,MAAI,UAAU,IAAI,GAAG;AACnB,QAAI,MAAM,MAAM,CAAC,KAAK,MAAM,GAAG;AAC7B,aAAO,SA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AAe;AAAA,EACf,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,qBAAqB,MAAM;AACzB,WAAO;AAAA,EACT;AAAA,EACA,gBAAgB,MAAM;AAAA,EAAC;AACzB;AAKA,SAAS,cAAc,OAAO;AAC5B,QAAM,EAAE,WAAW,WAAW,eAAe,cAAc,aAAa,IACtE;AAEF,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,oCAAC,SAAI,aACF,aAAa,EAAE,GAAG,MAAM,CAAC,GAC1B,oCAAC,SAAI,WAAU,mBACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe,MAAM,KAAK,aAAa;",
4
+ "sourcesContent": ["/* eslint-disable react/no-unused-prop-types */\n/* eslint-disable react/prop-types */\nimport React, { useEffect, useState } from \"react\";\nimport PropTypes from \"prop-types\";\nimport {\n RealtimeLayer as TrackerLayer,\n realtimeConfig,\n} from \"mobility-toolbox-js/ol\";\nimport { getHoursAndMinutes, getDelayString } from \"../../utils/timeUtils\";\nimport ReactTransitPropTypes from \"../../propTypes\";\nimport firstStation from \"../../images/RouteSchedule/firstStation.png\";\nimport station from \"../../images/RouteSchedule/station.png\";\nimport lastStation from \"../../images/RouteSchedule/lastStation.png\";\nimport line from \"../../images/RouteSchedule/line.png\";\n\nconst { getBgColor } = realtimeConfig;\n\n/**\n * Returns a color class to display the delay.\n * @param {Number} time Delay time in milliseconds.\n */\nconst getDelayColor = (time) => {\n const secs = Math.round(((time / 1800 / 2) * 3600) / 1000);\n if (secs >= 3600) {\n return \"dark-red\";\n }\n if (secs >= 500) {\n return \"middle-red\";\n }\n if (secs >= 300) {\n return \"light-red\";\n }\n if (secs >= 180) {\n return \"orange\";\n }\n return \"green\";\n};\n\n/**\n * Returns true if the train doesn't stop to the station.\n * @param {Object} stop Station information.\n */\nconst isNotStop = (stop) => {\n return !stop.arrivalTime && !stop.departureTime;\n};\n\n/**\n * Returns if the station has already been passed by the vehicule.\n * @param {Object} stop Station information.\n * @param {number} time The current time to test in ms.\n * @param {Array<Object>} stops the list of all stops of the train.\n * @param {idx} idx The index of the stop object in the stops array.\n */\nconst isPassed = (stop, time, stops, idx) => {\n // If the train doesn't stop to the stop object, we test if the stop just before has been passed or not.\n // if yes the current stop is considered as passed.\n if (isNotStop(stop)) {\n if (stops[idx - 1] && idx > 0) {\n return isPassed(stops[idx - 1], time, stops, idx);\n }\n return true;\n }\n\n // Sometimes stop.departureDelay is undefined.\n const timeToCompare = stop.aimedDepartureTime || stop.aimedArrivalTime || 0;\n let delayToCompare = stop.departureDelay || stop.arrivalDelay || 0;\n\n // It could happens that the delay is negative we simply ignores it.\n if (delayToCompare < 0) {\n delayToCompare = 0;\n }\n\n return timeToCompare + delayToCompare <= time;\n};\n\n/**\n * Returns an image for first, middle or last stations.\n * @param {Number} stations The stations list.\n * @param {Number} index Index of the station in the list.\n * @param {Boolean} isStationPassed If the train is already passed at this station.\n * @param {Boolean} isNotStation If the train doesn't stop to this station.\n */\nconst defaultRenderStationImg = (\n stations,\n index,\n isStationPassed,\n isNotStation,\n) => {\n const { length } = stations;\n let src = station.src || station;\n if (index === 0) {\n src = firstStation.src || firstStation;\n } else if (index === length - 1) {\n src = lastStation.src || lastStation;\n } else if (isNotStation) {\n src = line.src || line;\n }\n return <img src={src} alt=\"routeScheduleLine\" className=\"rt-route-icon\" />;\n};\n\nfunction RouteStop({\n lineInfos,\n onStationClick,\n trackerLayer,\n renderStationImg,\n stop,\n idx,\n}) {\n const {\n arrivalDelay,\n departureDelay,\n state,\n stationName,\n aimedArrivalTime,\n aimedDepartureTime,\n } = stop;\n const cancelled = state === \"JOURNEY_CANCELLED\" || state === \"STOP_CANCELLED\";\n const { stations } = lineInfos;\n const isFirstStation = idx === 0;\n const isLastStation = idx === stations.length - 1;\n const isNotStation = isNotStop(stop);\n const [isStationPassed, setIsStationPassed] = useState(false);\n\n useEffect(() => {\n let timeout = null;\n\n const isStopPassed = isPassed(stop, trackerLayer.time, stations, idx);\n setIsStationPassed(isStopPassed);\n\n // We have to refresh the stop when the state it's time_based\n if (stop.state === \"TIME_BASED\" && !isStopPassed) {\n timeout = setInterval(() => {\n setIsStationPassed(isPassed(stop, trackerLayer.time, stations, idx));\n }, 20000);\n }\n return () => {\n clearInterval(timeout);\n };\n }, [stop, trackerLayer, stations, idx]);\n\n return (\n <div\n role=\"button\"\n className={[\n \"rt-route-station\",\n isStationPassed ? \" rt-passed\" : \"\",\n isNotStation ? \" rt-no-stop\" : \"\",\n ].join(\"\")}\n onClick={(e) => {\n return onStationClick(stop, e);\n }}\n tabIndex={0}\n onKeyPress={(e) => {\n return e.which === 13 && onStationClick(stop, e);\n }}\n >\n <div className=\"rt-route-delay\">\n {arrivalDelay === undefined ||\n arrivalDelay === null ||\n isFirstStation ||\n cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-arrival${` ${getDelayColor(\n arrivalDelay,\n )}`}`}\n >\n {`+${getDelayString(arrivalDelay)}`}\n </span>\n )}\n {departureDelay === undefined ||\n departureDelay === null ||\n isLastStation ||\n cancelled ? (\n \"\"\n ) : (\n <span\n className={`rt-route-delay-departure${` ${getDelayColor(\n departureDelay,\n )}`}`}\n >\n {`+${getDelayString(departureDelay)}`}\n </span>\n )}\n </div>\n <div className=\"rt-route-times\">\n <span\n className={`rt-route-time-arrival ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedArrivalTime)}\n </span>\n <span\n className={`rt-route-time-departure ${\n cancelled ? \"rt-route-cancelled\" : \"\"\n }`}\n >\n {getHoursAndMinutes(aimedDepartureTime)}\n </span>\n </div>\n {renderStationImg(stations, idx, isStationPassed, isNotStation)}\n <div className={cancelled ? \"rt-route-cancelled\" : \"\"}>{stationName}</div>\n </div>\n );\n}\n\nconst defaultRenderStation = (props) => {\n const { stationId, arrivalTime, departureTime, stationName } = props.stop;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return (\n <RouteStop\n // Train line can go in circle so begin and end have the same id,\n // using the time in the key should fix the issue.\n key={(stationId || stationName) + arrivalTime + departureTime}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n />\n );\n};\n\nconst defaultRenderRouteIdentifier = ({ routeIdentifier, longName }) => {\n if (routeIdentifier) {\n // first part of the id, without leading zeros.\n const id = parseInt(routeIdentifier.split(\".\")[0], 10);\n if (!longName.includes(id) && !Number.isNaN(id)) {\n return ` (${id})`;\n }\n }\n return null;\n};\n\nconst defaultRenderHeader = ({\n lineInfos,\n renderHeaderButtons,\n renderRouteIdentifier,\n}) => {\n const {\n type,\n vehicleType,\n shortName,\n longName,\n stroke,\n destination,\n routeIdentifier,\n text_color: textColor,\n } = lineInfos;\n return (\n <div className=\"rt-route-header\">\n <span\n className=\"rt-route-icon\"\n style={{\n /* stylelint-disable-next-line value-keyword-case */\n backgroundColor: stroke || getBgColor(type || vehicleType),\n color: textColor || \"black\",\n }}\n >\n {shortName}\n </span>\n <div className=\"rt-route-title\">\n <span className=\"rt-route-name\">{destination}</span>\n <span>\n {longName}\n {renderRouteIdentifier(lineInfos)}\n </span>\n </div>\n <div className=\"rt-route-buttons\">\n {renderHeaderButtons(routeIdentifier)}\n </div>\n </div>\n );\n};\n\nconst defaultRenderFooter = (props) => {\n const { lineInfos, renderCopyright } = props;\n if (!lineInfos.operator && !lineInfos.publisher) {\n return null;\n }\n return <div className=\"rt-route-footer\">{renderCopyright({ ...props })}</div>;\n};\n\nconst defaultRenderLink = (text, url) => {\n return (\n <div className=\"rt-route-copyright-link\">\n {url ? (\n <a href={url} target=\"_blank\" rel=\"noreferrer\">\n {text}\n </a>\n ) : (\n text\n )}\n </div>\n );\n};\n\nconst defaultRenderCopyright = ({ lineInfos }) => {\n return (\n <span className=\"rt-route-copyright\">\n {lineInfos.operator &&\n defaultRenderLink(lineInfos.operator, lineInfos.operatorUrl)}\n {lineInfos.operator && lineInfos.publisher && <span>&nbsp;-&nbsp;</span>}\n {lineInfos.publisher &&\n defaultRenderLink(lineInfos.publisher, lineInfos.publisherUrl)}\n {lineInfos.license && <span>&nbsp;(</span>}\n {lineInfos.license &&\n defaultRenderLink(lineInfos.license, lineInfos.licenseUrl)}\n {lineInfos.license && \")\"}\n </span>\n );\n};\n\nconst propTypes = {\n /**\n * CSS class of the route schedule wrapper.\n */\n className: PropTypes.string,\n\n /**\n * Trajectory stations informations.\n */\n lineInfos: ReactTransitPropTypes.lineInfos,\n\n /**\n * Trackerlayer.\n */\n trackerLayer: PropTypes.instanceOf(TrackerLayer).isRequired,\n\n /**\n * Render Header of the route scheduler.\n */\n renderHeader: PropTypes.func,\n\n /**\n * Render Footer of the route scheduler.\n */\n renderFooter: PropTypes.func,\n\n /**\n * Render Copyright of the route scheduler.\n */\n renderCopyright: PropTypes.func,\n\n /**\n * Render the route identifier in the header\n */\n renderRouteIdentifier: PropTypes.func,\n\n /**\n * Render the status of the station image.\n */\n renderStationImg: PropTypes.func,\n\n /**\n * Render a station.\n */\n renderStation: PropTypes.func,\n\n /**\n * Function triggered on station's click event.\n */\n onStationClick: PropTypes.func,\n\n /**\n * Function to render header buttons.\n */\n renderHeaderButtons: PropTypes.func,\n};\n\nconst defaultProps = {\n className: \"rt-route-schedule\",\n lineInfos: null,\n renderHeader: defaultRenderHeader,\n renderStation: defaultRenderStation,\n renderStationImg: defaultRenderStationImg,\n renderCopyright: defaultRenderCopyright,\n renderFooter: defaultRenderFooter,\n renderRouteIdentifier: defaultRenderRouteIdentifier,\n renderHeaderButtons: () => {\n return null;\n },\n onStationClick: () => {},\n};\n\n/**\n * RouteSchedule displays information, stops and punctuality about the clicked route.\n */\nfunction RouteSchedule(props) {\n const { lineInfos, className, renderStation, renderHeader, renderFooter } =\n props;\n\n if (!lineInfos) {\n return null;\n }\n\n return (\n <div className={className}>\n {renderHeader({ ...props })}\n <div className=\"rt-route-body\">\n {lineInfos.stations.map((stop, idx) => {\n return renderStation({ ...props, stop, idx });\n })}\n </div>\n {renderFooter({ ...props })}\n </div>\n );\n}\n\nRouteSchedule.propTypes = propTypes;\nRouteSchedule.defaultProps = defaultProps;\n\nexport default React.memo(RouteSchedule);\n"],
5
+ "mappings": "AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,OAAO,eAAe;AACtB;AAAA,EACE,iBAAiB;AAAA,EACjB;AAAA,OACK;AACP,SAAS,oBAAoB,sBAAsB;AACnD,OAAO,2BAA2B;AAClC,OAAO,kBAAkB;AACzB,OAAO,aAAa;AACpB,OAAO,iBAAiB;AACxB,OAAO,UAAU;AAEjB,MAAM,EAAE,WAAW,IAAI;AAMvB,MAAM,gBAAgB,CAAC,SAAS;AAC9B,QAAM,OAAO,KAAK,MAAQ,OAAO,OAAO,IAAK,OAAQ,GAAI;AACzD,MAAI,QAAQ,MAAM;AAChB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,KAAK;AACf,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAMA,MAAM,YAAY,CAAC,SAAS;AAC1B,SAAO,CAAC,KAAK,eAAe,CAAC,KAAK;AACpC;AASA,MAAM,WAAW,CAAC,MAAM,MAAM,OAAO,QAAQ;AAG3C,MAAI,UAAU,IAAI,GAAG;AACnB,QAAI,MAAM,MAAM,CAAC,KAAK,MAAM,GAAG;AAC7B,aAAO,SAAS,MAAM,MAAM,CAAC,GAAG,MAAM,OAAO,GAAG;AAAA,IAClD;AACA,WAAO;AAAA,EACT;AAGA,QAAM,gBAAgB,KAAK,sBAAsB,KAAK,oBAAoB;AAC1E,MAAI,iBAAiB,KAAK,kBAAkB,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;AAAA,EAAC;AACzB;AAKA,SAAS,cAAc,OAAO;AAC5B,QAAM,EAAE,WAAW,WAAW,eAAe,cAAc,aAAa,IACtE;AAEF,MAAI,CAAC,WAAW;AACd,WAAO;AAAA,EACT;AAEA,SACE,oCAAC,SAAI,aACF,aAAa,EAAE,GAAG,MAAM,CAAC,GAC1B,oCAAC,SAAI,WAAU,mBACZ,UAAU,SAAS,IAAI,CAAC,MAAM,QAAQ;AACrC,WAAO,cAAc,EAAE,GAAG,OAAO,MAAM,IAAI,CAAC;AAAA,EAC9C,CAAC,CACH,GACC,aAAa,EAAE,GAAG,MAAM,CAAC,CAC5B;AAEJ;AAEA,cAAc,YAAY;AAC1B,cAAc,eAAe;AAE7B,eAAe,MAAM,KAAK,aAAa;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "name": "react-spatial",
3
3
  "license": "MIT",
4
4
  "description": "Components to build React map apps.",
5
- "version": "1.7.0",
5
+ "version": "1.7.2-beta.0",
6
6
  "dependencies": {
7
7
  "@geops/geops-ui": "0.1.18",
8
8
  "@material-ui/core": "4.12.4",
9
9
  "@material-ui/icons": "4.11.3",
10
10
  "@material-ui/lab": "4.0.0-alpha.61",
11
11
  "re-resizable": "6.9.11",
12
- "react-icons": "4.11.0",
12
+ "react-icons": "4.12.0",
13
13
  "resize-observer-polyfill": "1.5.1"
14
14
  },
15
15
  "peerDependencies": {
@@ -21,29 +21,29 @@
21
21
  "react-dom": "^18"
22
22
  },
23
23
  "devDependencies": {
24
- "@babel/preset-env": "7.22.20",
25
- "@babel/preset-react": "7.22.15",
24
+ "@babel/preset-env": "7.23.5",
25
+ "@babel/preset-react": "7.23.3",
26
26
  "@cfaester/enzyme-adapter-react-18": "0.7.1",
27
- "@commitlint/cli": "17.7.2",
28
- "@commitlint/config-conventional": "17.7.0",
27
+ "@commitlint/cli": "18.4.3",
28
+ "@commitlint/config-conventional": "18.4.3",
29
29
  "@svgr/plugin-jsx": "^8.1.0",
30
30
  "@svgr/webpack": "8.1.0",
31
- "@testing-library/jest-dom": "6.1.3",
32
- "@testing-library/react": "14.0.0",
31
+ "@testing-library/jest-dom": "6.1.4",
32
+ "@testing-library/react": "14.1.2",
33
33
  "@testing-library/user-event": "14.5.1",
34
34
  "babel-jest": "29.7.0",
35
35
  "babel-loader": "9.1.3",
36
36
  "canvas": "2.11.2",
37
37
  "css-loader": "6.8.1",
38
38
  "enzyme": "3.11.0",
39
- "esbuild": "^0.19.4",
39
+ "esbuild": "^0.19.8",
40
40
  "esbuild-loader": "^4.0.2",
41
- "eslint": "8.50.0",
41
+ "eslint": "8.54.0",
42
42
  "eslint-config-airbnb": "19.0.4",
43
43
  "eslint-config-prettier": "9.0.0",
44
- "eslint-plugin-import": "2.28.1",
45
- "eslint-plugin-jsx-a11y": "6.7.1",
46
- "eslint-plugin-prettier": "5.0.0",
44
+ "eslint-plugin-import": "2.29.0",
45
+ "eslint-plugin-jsx-a11y": "6.8.0",
46
+ "eslint-plugin-prettier": "5.0.1",
47
47
  "eslint-plugin-react": "7.33.2",
48
48
  "eslint-plugin-react-hooks": "4.6.0",
49
49
  "file-loader": "6.2.0",
@@ -61,33 +61,33 @@
61
61
  "jest-transform-file": "1.1.1",
62
62
  "jest-transformer-svg": "^2.0.1",
63
63
  "jsts": "2.11.0",
64
- "lint-staged": "14.0.1",
64
+ "lint-staged": "15.1.0",
65
65
  "mapbox-gl": "1.13.1",
66
- "maplibre-gl": "2.4.0",
67
- "mobility-toolbox-js": "2.1.0",
68
- "ol": "8.1.0",
66
+ "maplibre-gl": "3.6.2",
67
+ "mobility-toolbox-js": "2.3.5",
68
+ "ol": "8.2.0",
69
69
  "postcss": "^8.4.31",
70
- "prettier": "3.0.3",
71
- "proj4": "2.9.0",
70
+ "prettier": "3.1.0",
71
+ "proj4": "2.9.2",
72
72
  "prop-types": "15.8.1",
73
73
  "react": "18",
74
74
  "react-dom": "18",
75
75
  "react-styleguidist": "13.1.1",
76
76
  "react-svg-loader": "3.0.3",
77
77
  "react-test-renderer": "18.2.0",
78
- "sass": "1.69.0",
78
+ "sass": "1.69.5",
79
79
  "sass-loader": "13.3.2",
80
80
  "standard-version": "9.5.0",
81
81
  "stream-array": "1.1.2",
82
82
  "style-loader": "3.3.3",
83
- "stylelint": "15.10.3",
84
- "stylelint-config-recommended-scss": "13.0.0",
83
+ "stylelint": "15.11.0",
84
+ "stylelint-config-recommended-scss": "13.1.0",
85
85
  "stylelint-config-standard": "34.0.0",
86
- "stylelint-scss": "5.2.1",
86
+ "stylelint-scss": "5.3.1",
87
87
  "terser-webpack-plugin": "^5.3.9",
88
88
  "url-loader": "4.1.1",
89
89
  "vinyl-fs": "4.0.0",
90
- "webpack": "^5.88.2",
90
+ "webpack": "^5.89.0",
91
91
  "xml-beautifier": "0.5.0"
92
92
  },
93
93
  "scripts": {
@@ -102,9 +102,9 @@
102
102
  "postbuild": "cp package.json build/ && cd src && find . -name '*.scss' | cpio -pdm ../build",
103
103
  "prebuild": "rm -rf build/",
104
104
  "prepare": "is-ci || husky install",
105
- "publish:beta": "yarn release -- --prerelease beta --skip.changelog && git push origin HEAD && yarn run build && git push --tags && HUSKY=0 yarn publish build/ --tag beta",
105
+ "publish:beta": "yarn release -- --prerelease beta --skip.changelog && yarn run build && HUSKY=0 yarn publish build/ --tag beta && git push origin HEAD && git push --tags",
106
106
  "publish:beta:dryrun": "yarn release -- --prerelease beta --dry-run --skip.changelog",
107
- "publish:public": "yarn release && git push origin HEAD && yarn build && git push --tags && HUSKY=0 yarn publish build/",
107
+ "publish:public": "yarn release && yarn build && HUSKY=0 yarn publish build/ && git push origin HEAD && git push --tags",
108
108
  "publish:public:dryrun": "yarn release --dry-run",
109
109
  "release": "standard-version",
110
110
  "start": "styleguidist server",
@@ -166,7 +166,7 @@
166
166
  ".+\\.svg$": "jest-transformer-svg"
167
167
  },
168
168
  "transformIgnorePatterns": [
169
- "node_modules/(?!(jsts|ol|mobility-toolbox-js)|@geops|geotiff|quick-lru)"
169
+ "node_modules/(?!(color-*|jsts|ol|mobility-toolbox-js)|@geops|geotiff|quick-lru)"
170
170
  ],
171
171
  "testMatch": [
172
172
  "<rootDir>/src/**/?(*.)+(spec|test).[jt]s?(x)"
package/utils/KML.js CHANGED
@@ -6,8 +6,13 @@ import GeometryCollection from "ol/geom/GeometryCollection";
6
6
  import { Style, Text, Icon, Circle, Fill, Stroke } from "ol/style";
7
7
  import { asString } from "ol/color";
8
8
  import { parse } from "ol/xml";
9
+ import VectorSource from "ol/source/Vector";
10
+ import VectorLayer from "ol/layer/Vector";
9
11
  import { kmlStyle } from "./Styles";
10
12
  import getPolygonPattern from "./getPolygonPattern";
13
+ const scaleForSize = (size) => {
14
+ return 32 / Math.min(size[0], size[1]);
15
+ };
11
16
  const applyTextStyleForIcon = (olIcon, olText) => {
12
17
  const size = olIcon.getSize() || [48, 48];
13
18
  const scale = olIcon.getScale() || 1;
@@ -52,7 +57,7 @@ const getLineIcon = (feature, icon, color, start = true) => {
52
57
  zIndex: icon.zIndex
53
58
  });
54
59
  };
55
- const sanitizeFeature = (feature) => {
60
+ const sanitizeFeature = (feature, fixGxwAndGxh) => {
56
61
  const geom = feature.getGeometry();
57
62
  let styles = feature.getStyleFunction();
58
63
  if (feature.get("maxZoom")) {
@@ -145,6 +150,10 @@ const sanitizeFeature = (feature) => {
145
150
  }
146
151
  if (image instanceof Icon) {
147
152
  image.setRotation(parseFloat(feature.get("iconRotation")) || 0);
153
+ if (fixGxwAndGxh) {
154
+ const resizeScale = scaleForSize(image.getSize());
155
+ image.setScale(image.getScaleArray()[0] / resizeScale);
156
+ }
148
157
  }
149
158
  fill = void 0;
150
159
  stroke = void 0;
@@ -212,16 +221,17 @@ const sanitizeFeature = (feature) => {
212
221
  }
213
222
  feature.setStyle(styles);
214
223
  };
215
- const readFeatures = (kmlString, featureProjection) => {
224
+ const readFeatures = (kmlString, featureProjection, fixGxwAndGxh) => {
225
+ const containsGxwAndGxh = /(gx:h|gx:w)/.test(kmlString);
216
226
  const features = new KML().readFeatures(kmlString, {
217
227
  featureProjection
218
228
  });
219
229
  features.forEach((feature) => {
220
- sanitizeFeature(feature);
230
+ sanitizeFeature(feature, containsGxwAndGxh && fixGxwAndGxh);
221
231
  });
222
232
  return features;
223
233
  };
224
- const writeFeatures = (layer, featureProjection, mapResolution) => {
234
+ const writeFeatures = (layer, featureProjection, mapResolution, fixGxwAndGxh) => {
225
235
  let featString;
226
236
  const { olLayer } = layer;
227
237
  const exportFeatures = [];
@@ -309,6 +319,12 @@ const writeFeatures = (layer, featureProjection, mapResolution) => {
309
319
  if (newStyle.image.getRotation()) {
310
320
  clone.set("iconRotation", newStyle.image.getRotation());
311
321
  }
322
+ if (fixGxwAndGxh) {
323
+ const resizeScale = scaleForSize(newStyle.image.getSize());
324
+ newStyle.image.setScale(
325
+ newStyle.image.getScaleArray()[0] * resizeScale
326
+ );
327
+ }
312
328
  if (feature.get("pictureOptions")) {
313
329
  clone.set(
314
330
  "pictureOptions",
@@ -412,6 +428,10 @@ const writeDocumentCamera = (kmlString, cameraAttributes) => {
412
428
  }
413
429
  return new XMLSerializer().serializeToString(kmlDoc);
414
430
  };
431
+ window.VectorLayer = VectorLayer;
432
+ window.VectorSource = VectorSource;
433
+ window.writeFeatures = writeFeatures;
434
+ window.readFeatures = readFeatures;
415
435
  export default {
416
436
  readFeatures,
417
437
  writeFeatures,
package/utils/KML.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/KML.js"],
4
- "sourcesContent": ["import KML from \"ol/format/KML\";\nimport { Feature } from \"ol\";\nimport Point from \"ol/geom/Point\";\nimport MultiPoint from \"ol/geom/MultiPoint\";\nimport GeometryCollection from \"ol/geom/GeometryCollection\";\nimport { Style, Text, Icon, Circle, Fill, Stroke } from \"ol/style\";\nimport { asString } from \"ol/color\";\nimport { parse } from \"ol/xml\";\nimport { kmlStyle } from \"./Styles\";\nimport getPolygonPattern from \"./getPolygonPattern\";\n\nconst applyTextStyleForIcon = (olIcon, olText) => {\n const size = olIcon.getSize() || [48, 48];\n const scale = olIcon.getScale() || 1;\n const anchor = olIcon.getAnchor() || [\n (size[0] * scale) / 2,\n (size[1] * scale) / 2,\n ];\n const offset = [\n scale * (size[0] - anchor[0]) + 5,\n scale * (size[1] / 2 - anchor[1]),\n ];\n olText.setOffsetX(offset[0]);\n olText.setOffsetY(offset[1]);\n olText.setTextAlign(\"left\");\n};\n\nconst getVertexCoord = (geom, start = true, index = 0) => {\n const coords = geom.getCoordinates();\n const len = coords.length - 1;\n return start ? coords[index] : coords[len - index];\n};\n\nconst getLineIcon = (feature, icon, color, start = true) => {\n const geom = feature.getGeometry();\n const coordA = getVertexCoord(geom, start, 1);\n const coordB = getVertexCoord(geom, start);\n const dx = start ? coordA[0] - coordB[0] : coordB[0] - coordA[0];\n const dy = start ? coordA[1] - coordB[1] : coordB[1] - coordA[1];\n const rotation = Math.atan2(dy, dx);\n\n return new Style({\n geometry: (feat) => {\n const ge = feat.getGeometry();\n return new Point(getVertexCoord(ge, start));\n },\n image: new Icon({\n src: icon.url,\n color,\n rotation: -rotation,\n rotateWithView: true,\n scale: icon.scale,\n size: icon.size, // ie 11\n }),\n zIndex: icon.zIndex,\n });\n};\n\n// Clean the unneeded feature's style and properties created by the KML parser.\nconst sanitizeFeature = (feature) => {\n const geom = feature.getGeometry();\n let styles = feature.getStyleFunction();\n\n // Store maxZoom in properties\n if (feature.get(\"maxZoom\")) {\n feature.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // Store minZoom in properties\n if (feature.get(\"minZoom\")) {\n feature.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // The use of clone is part of the scale fix line 156\n const tmpStyles = styles(feature);\n const style = (Array.isArray(tmpStyles) ? tmpStyles[0] : tmpStyles).clone();\n\n let stroke = style.getStroke();\n if (stroke && feature.get(\"lineDash\")) {\n stroke.setLineDash(\n feature\n .get(\"lineDash\")\n .split(\",\")\n .map((l) => {\n return parseInt(l, 10);\n }),\n );\n }\n\n // The canvas draws a stroke width=1 by default if width=0, so we\n // remove the stroke style in that case.\n if (stroke && stroke.getWidth() === 0) {\n stroke = undefined;\n }\n\n if (feature.get(\"zIndex\")) {\n style.setZIndex(parseInt(feature.get(\"zIndex\"), 10));\n }\n\n // if the feature is a Point and we are offline, we use default vector\n // style.\n // if the feature is a Point and has a name with a text style, we\n // create a correct text style.\n // TODO Handle GeometryCollection displaying name on the first Point\n // geometry.\n if (style && (geom instanceof Point || geom instanceof MultiPoint)) {\n let image = style.getImage();\n let text = null;\n let fill = style.getFill();\n\n // If the feature has name we display it on the map as Google does\n if (\n feature.get(\"name\") &&\n style.getText() &&\n style.getText().getScale() !== 0\n ) {\n if (image && image.getScale() === 0) {\n // transparentCircle is used to allow selection\n image = new Circle({\n radius: 1,\n fill: new Fill({ color: [0, 0, 0, 0] }),\n stroke: new Stroke({ color: [0, 0, 0, 0] }),\n });\n }\n\n // We replace empty white spaces used to keep normal spaces before and after the name.\n let name = feature.get(\"name\");\n if (/\\u200B/g.test(name)) {\n name = name.replace(/\\u200B/g, \"\");\n feature.set(\"name\", name);\n }\n\n text = new Text({\n font: feature.get(\"textFont\") || \"normal 16px Helvetica\",\n text: feature.get(\"name\"),\n fill: style.getText().getFill(),\n // rotation unsupported by KML, taken instead from custom field.\n rotation: feature.get(\"textRotation\") || 0,\n // since ol 6.3.1 : https://github.com/openlayers/openlayers/pull/10613/files#diff-1883da8b57e690db7ea0c35ce53c880aR925\n // a default textstroke is added to mimic google earth.\n // it was not the case before, the stroke was always null. So to keep\n // the same behavior we don't copy the stroke style.\n // TODO : maybe we should use this functionnality in the futur.\n // stroke: style.getText().getStroke(),\n scale: style.getText().getScale(),\n });\n\n if (feature.get(\"textStrokeColor\") && feature.get(\"textStrokeWidth\")) {\n text.setStroke(\n new Stroke({\n color: feature.get(\"textStrokeColor\"),\n width: parseFloat(feature.get(\"textStrokeWidth\")),\n }),\n );\n }\n\n if (feature.get(\"textAlign\")) {\n text.setTextAlign(feature.get(\"textAlign\"));\n }\n\n if (feature.get(\"textOffsetX\")) {\n text.setOffsetX(parseFloat(feature.get(\"textOffsetX\")));\n }\n\n if (feature.get(\"textOffsetY\")) {\n text.setOffsetY(parseFloat(feature.get(\"textOffsetY\")));\n }\n\n if (feature.get(\"textBackgroundFillColor\")) {\n text.setBackgroundFill(\n new Fill({\n color: feature.get(\"textBackgroundFillColor\"),\n }),\n );\n }\n\n if (feature.get(\"textPadding\")) {\n text.setPadding(\n feature\n .get(\"textPadding\")\n .split(\",\")\n .map((n) => {\n return parseFloat(n);\n }),\n );\n }\n\n if (image instanceof Icon) {\n applyTextStyleForIcon(image, text);\n }\n }\n\n if (image instanceof Icon) {\n /* Apply icon rotation if defined (by default only written as\n * <heading> tag, which is not read as rotation value by the ol KML module)\n */\n image.setRotation(parseFloat(feature.get(\"iconRotation\")) || 0);\n }\n\n fill = undefined;\n stroke = undefined;\n\n styles = (feat, resolution) => {\n /* Options to be used for picture scaling with map, should have at least\n * a resolution attribute (this is the map resolution at the zoom level when\n * the picture is created), can take an optional constant for further scale\n * adjustment.\n * e.g. { resolution: 0.123, defaultScale: 1 / 6 }\n */\n\n if (feat.get(\"pictureOptions\")) {\n let pictureOptions = feat.get(\"pictureOptions\");\n if (typeof pictureOptions === \"string\") {\n pictureOptions = JSON.parse(pictureOptions);\n }\n feat.set(\"pictureOptions\", pictureOptions);\n if (pictureOptions.resolution) {\n image.setScale(\n (pictureOptions.resolution / resolution) *\n pictureOptions.defaultScale || 1,\n );\n }\n }\n\n return new Style({\n fill,\n stroke,\n image,\n text,\n zIndex: style.getZIndex(),\n });\n };\n }\n\n // Remove image and text styles for polygons and lines\n if (\n !(\n geom instanceof Point ||\n geom instanceof MultiPoint ||\n geom instanceof GeometryCollection\n )\n ) {\n styles = [\n new Style({\n fill: style.getFill(),\n stroke,\n image: null,\n text: null,\n zIndex: style.getZIndex(),\n }),\n ];\n\n // Parse the fillPattern json string and store parsed object\n let fillPattern = feature.get(\"fillPattern\");\n if (fillPattern) {\n fillPattern = JSON.parse(fillPattern);\n feature.set(\"fillPattern\", fillPattern);\n\n /* We set the fill pattern for polygons */\n if (!style.getFill()) {\n styles[0].setFill(new Fill());\n }\n const patternOrColor = fillPattern.empty\n ? [0, 0, 0, 0]\n : getPolygonPattern(fillPattern.id, fillPattern.color);\n styles[0].getFill().setColor(patternOrColor);\n }\n\n // Add line's icons styles\n if (feature.get(\"lineStartIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineStartIcon\")),\n stroke.getColor(),\n ),\n );\n }\n\n if (feature.get(\"lineEndIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineEndIcon\")),\n stroke.getColor(),\n false,\n ),\n );\n }\n }\n feature.setStyle(styles);\n};\n\n/**\n * Read a KML string.\n * @param {String} kmlString A string representing a KML file.\n * @param {<ol.Projection|String>} featureProjection The projection used by the map.\n */\nconst readFeatures = (kmlString, featureProjection) => {\n const features = new KML().readFeatures(kmlString, {\n featureProjection,\n });\n features.forEach((feature) => {\n sanitizeFeature(feature);\n });\n return features;\n};\n\n/**\n * Create a KML string.\n * @param {VectorLayer} layer A react-spatial VectorLayer.\n * @param {<ol.Projection|String>} featureProjection The current projection used by the features.\n */\nconst writeFeatures = (layer, featureProjection, mapResolution) => {\n let featString;\n const { olLayer } = layer;\n const exportFeatures = [];\n\n olLayer.getSource().forEachFeature((feature) => {\n // We silently ignore Circle elements as they are\n // not supported in kml.\n if (feature.getGeometry().getType() === \"Circle\") {\n return;\n }\n\n const clone = feature.clone();\n clone.setId(feature.getId());\n clone.getGeometry().setProperties(feature.getGeometry().getProperties());\n clone.getGeometry().transform(featureProjection, \"EPSG:4326\");\n\n // We remove all ExtendedData not related to style.\n Object.keys(feature.getProperties()).forEach((key) => {\n if (!/^(geometry|name|description)$/.test(key)) {\n clone.unset(key, true);\n }\n });\n\n let styles;\n\n if (feature.getStyleFunction()) {\n styles = feature.getStyleFunction()(feature, mapResolution);\n } else if (olLayer && olLayer.getStyleFunction()) {\n styles = olLayer.getStyleFunction()(feature, mapResolution);\n }\n\n const mainStyle = styles[0] || styles;\n\n const newStyle = {\n fill: mainStyle.getFill(),\n stroke: mainStyle.getStroke(),\n text: mainStyle.getText(),\n image: mainStyle.getImage(),\n zIndex: mainStyle.getZIndex(),\n };\n\n if (newStyle.zIndex) {\n clone.set(\"zIndex\", newStyle.zIndex);\n }\n\n // If we see spaces at the beginning or at the end we add a empty\n // white space at the beginning and at the end.\n if (newStyle.text && /^\\s|\\s$/g.test(newStyle.text.getText())) {\n newStyle.text.setText(`\\u200B${newStyle.text.getText()}\\u200B`);\n }\n\n // Set custom properties to be converted in extendedData in KML.\n if (newStyle.text && newStyle.text.getRotation()) {\n clone.set(\"textRotation\", newStyle.text.getRotation());\n }\n\n if (newStyle.text && newStyle.text.getFont()) {\n clone.set(\"textFont\", newStyle.text.getFont());\n }\n\n if (newStyle.text && newStyle.text.getTextAlign()) {\n clone.set(\"textAlign\", newStyle.text.getTextAlign());\n }\n\n if (newStyle.text && newStyle.text.getOffsetX()) {\n clone.set(\"textOffsetX\", newStyle.text.getOffsetX());\n }\n\n if (newStyle.text && newStyle.text.getOffsetY()) {\n clone.set(\"textOffsetY\", newStyle.text.getOffsetY());\n }\n\n if (newStyle.text && newStyle.text.getStroke()) {\n if (newStyle.text.getStroke().getColor()) {\n clone.set(\n \"textStrokeColor\",\n asString(newStyle.text.getStroke().getColor()),\n );\n }\n\n if (newStyle.text.getStroke().getWidth()) {\n clone.set(\"textStrokeWidth\", newStyle.text.getStroke().getWidth());\n }\n }\n\n if (newStyle.text && newStyle.text.getBackgroundFill()) {\n clone.set(\n \"textBackgroundFillColor\",\n asString(newStyle.text.getBackgroundFill().getColor()),\n );\n }\n\n if (newStyle.text && newStyle.text.getPadding()) {\n clone.set(\"textPadding\", newStyle.text.getPadding().join());\n }\n\n if (newStyle.stroke && newStyle.stroke.getLineDash()) {\n clone.set(\"lineDash\", newStyle.stroke.getLineDash().join(\",\"));\n }\n\n if (newStyle.image instanceof Circle) {\n newStyle.image = null;\n }\n\n if (newStyle.image) {\n const imgSource = newStyle.image.getSrc();\n if (!/(http(s?)):\\/\\//gi.test(imgSource)) {\n // eslint-disable-next-line no-console\n console.log(\n \"Local image source not supported for KML export.\" +\n \"Should use remote web server\",\n );\n }\n\n if (newStyle.image.getRotation()) {\n // We set the icon rotation as extended data\n clone.set(\"iconRotation\", newStyle.image.getRotation());\n }\n\n // Set map resolution to use for icon-to-map proportional scaling\n if (feature.get(\"pictureOptions\")) {\n clone.set(\n \"pictureOptions\",\n JSON.stringify(feature.get(\"pictureOptions\")),\n );\n }\n }\n\n // In case a fill pattern should be applied (use fillPattern attribute to store pattern id, color etc)\n if (feature.get(\"fillPattern\")) {\n clone.set(\"fillPattern\", JSON.stringify(feature.get(\"fillPattern\")));\n newStyle.fill = null;\n }\n\n // maxZoom: maximum zoom level at which the feature is displayed\n if (feature.get(\"maxZoom\")) {\n clone.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // minZoom: minimum zoom level at which the feature is displayed\n if (feature.get(\"minZoom\")) {\n clone.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // If only text is displayed we must specify an\n // image style with scale=0\n if (newStyle.text && !newStyle.image) {\n newStyle.image = new Icon({\n src: \"noimage\",\n scale: 0,\n });\n }\n\n // In case we use line's icon .\n const extraLineStyles = (Array.isArray(styles) && styles.slice(1)) || [];\n extraLineStyles.forEach((extraLineStyle) => {\n if (\n extraLineStyle &&\n extraLineStyle.getImage() instanceof Icon &&\n extraLineStyle.getGeometry()\n ) {\n const coord = extraLineStyle.getGeometry()(feature).getCoordinates();\n const startCoord = feature.getGeometry().getFirstCoordinate();\n if (coord[0] === startCoord[0] && coord[1] === startCoord[1]) {\n clone.set(\n \"lineStartIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n } else {\n clone.set(\n \"lineEndIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n }\n }\n });\n\n const olStyle = new Style(newStyle);\n clone.setStyle(olStyle);\n\n if (\n !(\n clone.getGeometry() instanceof Point &&\n olStyle.getText() &&\n !olStyle.getText().getText()\n )\n ) {\n exportFeatures.push(clone);\n }\n });\n\n if (exportFeatures.length > 0) {\n if (exportFeatures.length === 1) {\n // force the add of a <Document> node\n exportFeatures.push(new Feature());\n }\n\n featString = new KML({\n extractStyles: true,\n defaultStyle: [kmlStyle],\n }).writeFeatures(exportFeatures);\n\n // Remove no image hack\n featString = featString.replace(\n /<Icon>\\s*<href>noimage<\\/href>\\s*<\\/Icon>/g,\n \"\",\n );\n\n // Remove empty placemark added to have\n // <Document> tag\n featString = featString.replace(/<Placemark\\/>/g, \"\");\n\n // Add KML document name\n if (layer.name) {\n featString = featString.replace(\n /<Document>/,\n `<Document><name>${layer.name}</name>`,\n );\n }\n }\n\n return featString;\n};\n\n/**\n * Removes the <Camera> tag from a KML string. Returns the KML string with removed <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n */\nconst removeDocumentCamera = (kmlString) => {\n const kmlDoc = parse(kmlString);\n // Remove old Camera node\n const oldCameraNode = kmlDoc.getElementsByTagName(\"Camera\")[0];\n if (oldCameraNode) {\n oldCameraNode.remove();\n }\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\n/**\n * Write the <Camera> tag into a KML string. Returns the KML string with added <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n * @param {Object} cameraAttributes Object containing the camera tags (longitude, latitude, altitude, heading, tilt, altitudeMode, roll)\n * as keys with corresponding values. See https://developers.google.com/kml/documentation/kmlreference#camera\n */\nconst writeDocumentCamera = (kmlString, cameraAttributes) => {\n const kmlDoc = parse(removeDocumentCamera(kmlString));\n\n if (cameraAttributes) {\n // Create Camera node with child attributes if the cameraAttributes object is defined\n const cameraNode = kmlDoc.createElement(\"Camera\");\n Object.keys(cameraAttributes).forEach((key) => {\n const cameraAttribute = kmlDoc.createElement(\n `${key.charAt(0).toUpperCase() + key.slice(1)}`,\n );\n cameraAttribute.innerHTML = cameraAttributes[key];\n cameraNode.appendChild(cameraAttribute);\n });\n const documentNode = kmlDoc.getElementsByTagName(\"Document\")[0];\n documentNode.appendChild(cameraNode);\n }\n\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\nexport default {\n readFeatures,\n writeFeatures,\n writeDocumentCamera,\n removeDocumentCamera,\n};\n"],
5
- "mappings": "AAAA,OAAO,SAAS;AAChB,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAC/B,SAAS,OAAO,MAAM,MAAM,QAAQ,MAAM,cAAc;AACxD,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,OAAO,uBAAuB;AAE9B,MAAM,wBAAwB,CAAC,QAAQ,WAAW;AAChD,QAAM,OAAO,OAAO,QAAQ,KAAK,CAAC,IAAI,EAAE;AACxC,QAAM,QAAQ,OAAO,SAAS,KAAK;AACnC,QAAM,SAAS,OAAO,UAAU,KAAK;AAAA,IAClC,KAAK,CAAC,IAAI,QAAS;AAAA,IACnB,KAAK,CAAC,IAAI,QAAS;AAAA,EACtB;AACA,QAAM,SAAS;AAAA,IACb,SAAS,KAAK,CAAC,IAAI,OAAO,CAAC,KAAK;AAAA,IAChC,SAAS,KAAK,CAAC,IAAI,IAAI,OAAO,CAAC;AAAA,EACjC;AACA,SAAO,WAAW,OAAO,CAAC,CAAC;AAC3B,SAAO,WAAW,OAAO,CAAC,CAAC;AAC3B,SAAO,aAAa,MAAM;AAC5B;AAEA,MAAM,iBAAiB,C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AC/C;AACA,sBAAgB,YAAY,iBAAiB,GAAG;AAChD,iBAAW,YAAY,eAAe;AAAA,IACxC,CAAC;AACD,UAAM,eAAe,OAAO,qBAAqB,UAAU,EAAE,CAAC;AAC9D,iBAAa,YAAY,UAAU;AAAA,EACrC;AAEA,SAAO,IAAI,cAAc,EAAE,kBAAkB,MAAM;AACrD;AAEA,eAAe;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
4
+ "sourcesContent": ["import KML from \"ol/format/KML\";\nimport { Feature } from \"ol\";\nimport Point from \"ol/geom/Point\";\nimport MultiPoint from \"ol/geom/MultiPoint\";\nimport GeometryCollection from \"ol/geom/GeometryCollection\";\nimport { Style, Text, Icon, Circle, Fill, Stroke } from \"ol/style\";\nimport { asString } from \"ol/color\";\nimport { parse } from \"ol/xml\";\nimport VectorSource from \"ol/source/Vector\";\nimport VectorLayer from \"ol/layer/Vector\";\nimport { kmlStyle } from \"./Styles\";\nimport getPolygonPattern from \"./getPolygonPattern\";\n\n// Comes from ol >= 6.7,\n// https://github.com/openlayers/openlayers/blob/main/src/ol/format/KML.js#L320\nconst scaleForSize = (size) => {\n return 32 / Math.min(size[0], size[1]);\n};\n\nconst applyTextStyleForIcon = (olIcon, olText) => {\n const size = olIcon.getSize() || [48, 48];\n const scale = olIcon.getScale() || 1;\n const anchor = olIcon.getAnchor() || [\n (size[0] * scale) / 2,\n (size[1] * scale) / 2,\n ];\n const offset = [\n scale * (size[0] - anchor[0]) + 5,\n scale * (size[1] / 2 - anchor[1]),\n ];\n olText.setOffsetX(offset[0]);\n olText.setOffsetY(offset[1]);\n olText.setTextAlign(\"left\");\n};\n\nconst getVertexCoord = (geom, start = true, index = 0) => {\n const coords = geom.getCoordinates();\n const len = coords.length - 1;\n return start ? coords[index] : coords[len - index];\n};\n\nconst getLineIcon = (feature, icon, color, start = true) => {\n const geom = feature.getGeometry();\n const coordA = getVertexCoord(geom, start, 1);\n const coordB = getVertexCoord(geom, start);\n const dx = start ? coordA[0] - coordB[0] : coordB[0] - coordA[0];\n const dy = start ? coordA[1] - coordB[1] : coordB[1] - coordA[1];\n const rotation = Math.atan2(dy, dx);\n\n return new Style({\n geometry: (feat) => {\n const ge = feat.getGeometry();\n return new Point(getVertexCoord(ge, start));\n },\n image: new Icon({\n src: icon.url,\n color,\n rotation: -rotation,\n rotateWithView: true,\n scale: icon.scale,\n size: icon.size, // ie 11\n }),\n zIndex: icon.zIndex,\n });\n};\n\n// Clean the unneeded feature's style and properties created by the KML parser.\nconst sanitizeFeature = (feature, fixGxwAndGxh) => {\n const geom = feature.getGeometry();\n let styles = feature.getStyleFunction();\n\n // Store maxZoom in properties\n if (feature.get(\"maxZoom\")) {\n feature.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // Store minZoom in properties\n if (feature.get(\"minZoom\")) {\n feature.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // The use of clone is part of the scale fix line 156\n const tmpStyles = styles(feature);\n const style = (Array.isArray(tmpStyles) ? tmpStyles[0] : tmpStyles).clone();\n\n let stroke = style.getStroke();\n if (stroke && feature.get(\"lineDash\")) {\n stroke.setLineDash(\n feature\n .get(\"lineDash\")\n .split(\",\")\n .map((l) => {\n return parseInt(l, 10);\n }),\n );\n }\n\n // The canvas draws a stroke width=1 by default if width=0, so we\n // remove the stroke style in that case.\n if (stroke && stroke.getWidth() === 0) {\n stroke = undefined;\n }\n\n if (feature.get(\"zIndex\")) {\n style.setZIndex(parseInt(feature.get(\"zIndex\"), 10));\n }\n\n // if the feature is a Point and we are offline, we use default vector\n // style.\n // if the feature is a Point and has a name with a text style, we\n // create a correct text style.\n // TODO Handle GeometryCollection displaying name on the first Point\n // geometry.\n if (style && (geom instanceof Point || geom instanceof MultiPoint)) {\n let image = style.getImage();\n let text = null;\n let fill = style.getFill();\n\n // If the feature has name we display it on the map as Google does\n if (\n feature.get(\"name\") &&\n style.getText() &&\n style.getText().getScale() !== 0\n ) {\n if (image && image.getScale() === 0) {\n // transparentCircle is used to allow selection\n image = new Circle({\n radius: 1,\n fill: new Fill({ color: [0, 0, 0, 0] }),\n stroke: new Stroke({ color: [0, 0, 0, 0] }),\n });\n }\n\n // We replace empty white spaces used to keep normal spaces before and after the name.\n let name = feature.get(\"name\");\n if (/\\u200B/g.test(name)) {\n name = name.replace(/\\u200B/g, \"\");\n feature.set(\"name\", name);\n }\n\n text = new Text({\n font: feature.get(\"textFont\") || \"normal 16px Helvetica\",\n text: feature.get(\"name\"),\n fill: style.getText().getFill(),\n // rotation unsupported by KML, taken instead from custom field.\n rotation: feature.get(\"textRotation\") || 0,\n // since ol 6.3.1 : https://github.com/openlayers/openlayers/pull/10613/files#diff-1883da8b57e690db7ea0c35ce53c880aR925\n // a default textstroke is added to mimic google earth.\n // it was not the case before, the stroke was always null. So to keep\n // the same behavior we don't copy the stroke style.\n // TODO : maybe we should use this functionnality in the futur.\n // stroke: style.getText().getStroke(),\n scale: style.getText().getScale(),\n });\n\n if (feature.get(\"textStrokeColor\") && feature.get(\"textStrokeWidth\")) {\n text.setStroke(\n new Stroke({\n color: feature.get(\"textStrokeColor\"),\n width: parseFloat(feature.get(\"textStrokeWidth\")),\n }),\n );\n }\n\n if (feature.get(\"textAlign\")) {\n text.setTextAlign(feature.get(\"textAlign\"));\n }\n\n if (feature.get(\"textOffsetX\")) {\n text.setOffsetX(parseFloat(feature.get(\"textOffsetX\")));\n }\n\n if (feature.get(\"textOffsetY\")) {\n text.setOffsetY(parseFloat(feature.get(\"textOffsetY\")));\n }\n\n if (feature.get(\"textBackgroundFillColor\")) {\n text.setBackgroundFill(\n new Fill({\n color: feature.get(\"textBackgroundFillColor\"),\n }),\n );\n }\n\n if (feature.get(\"textPadding\")) {\n text.setPadding(\n feature\n .get(\"textPadding\")\n .split(\",\")\n .map((n) => {\n return parseFloat(n);\n }),\n );\n }\n if (image instanceof Icon) {\n applyTextStyleForIcon(image, text);\n }\n }\n\n if (image instanceof Icon) {\n /* Apply icon rotation if defined (by default only written as\n * <heading> tag, which is not read as rotation value by the ol KML module)\n */\n image.setRotation(parseFloat(feature.get(\"iconRotation\")) || 0);\n\n // Fix scale when gx:h and gx:w are used, this is for Mapset KMLs\n if (fixGxwAndGxh) {\n const resizeScale = scaleForSize(image.getSize());\n image.setScale(image.getScaleArray()[0] / resizeScale);\n }\n }\n\n fill = undefined;\n stroke = undefined;\n\n styles = (feat, resolution) => {\n /* Options to be used for picture scaling with map, should have at least\n * a resolution attribute (this is the map resolution at the zoom level when\n * the picture is created), can take an optional constant for further scale\n * adjustment.\n * e.g. { resolution: 0.123, defaultScale: 1 / 6 }\n */\n\n if (feat.get(\"pictureOptions\")) {\n let pictureOptions = feat.get(\"pictureOptions\");\n if (typeof pictureOptions === \"string\") {\n pictureOptions = JSON.parse(pictureOptions);\n }\n feat.set(\"pictureOptions\", pictureOptions);\n if (pictureOptions.resolution) {\n image.setScale(\n (pictureOptions.resolution / resolution) *\n pictureOptions.defaultScale || 1,\n );\n }\n }\n\n return new Style({\n fill,\n stroke,\n image,\n text,\n zIndex: style.getZIndex(),\n });\n };\n }\n\n // Remove image and text styles for polygons and lines\n if (\n !(\n geom instanceof Point ||\n geom instanceof MultiPoint ||\n geom instanceof GeometryCollection\n )\n ) {\n styles = [\n new Style({\n fill: style.getFill(),\n stroke,\n image: null,\n text: null,\n zIndex: style.getZIndex(),\n }),\n ];\n\n // Parse the fillPattern json string and store parsed object\n let fillPattern = feature.get(\"fillPattern\");\n if (fillPattern) {\n fillPattern = JSON.parse(fillPattern);\n feature.set(\"fillPattern\", fillPattern);\n\n /* We set the fill pattern for polygons */\n if (!style.getFill()) {\n styles[0].setFill(new Fill());\n }\n const patternOrColor = fillPattern.empty\n ? [0, 0, 0, 0]\n : getPolygonPattern(fillPattern.id, fillPattern.color);\n styles[0].getFill().setColor(patternOrColor);\n }\n\n // Add line's icons styles\n if (feature.get(\"lineStartIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineStartIcon\")),\n stroke.getColor(),\n ),\n );\n }\n\n if (feature.get(\"lineEndIcon\")) {\n styles.push(\n getLineIcon(\n feature,\n JSON.parse(feature.get(\"lineEndIcon\")),\n stroke.getColor(),\n false,\n ),\n );\n }\n }\n feature.setStyle(styles);\n};\n\n/**\n * Read a KML string.\n * @param {String} kmlString A string representing a KML file.\n * @param {<ol.Projection|String>} featureProjection The projection used by the map.\n * @param {<boolean>} fixGxyAndGxh If the KML contains gx:w and gx:h, (ol >= 6.7), it will fix the bug introduced by https://github.com/openlayers/openlayers/pull/12695.\n */\nconst readFeatures = (kmlString, featureProjection, fixGxwAndGxh) => {\n // Mapset used gx:w and gx:h to specify the width height of an icon,\n // unfortunately since ol 6.7, the KML follows better the KML spec and GoogleEarth interpretation, see https://github.com/openlayers/openlayers/pull/12695.\n // and gx:w are gx:h are simply ignored.\n // So when fixGxwAndGxh is true we fix back the scale.\n // This has to be fixed in Mapset removing the use of gx:w and gx:h and adapt the scale accordingly like the formula in ol.\n const containsGxwAndGxh = /(gx:h|gx:w)/.test(kmlString);\n const features = new KML().readFeatures(kmlString, {\n featureProjection,\n });\n features.forEach((feature) => {\n sanitizeFeature(feature, containsGxwAndGxh && fixGxwAndGxh);\n });\n return features;\n};\n\n/**\n * Create a KML string.\n * @param {VectorLayer} layer A react-spatial VectorLayer.\n * @param {<ol.Projection|String>} featureProjection The current projection used by the features.\n * @param {<boolean>} fixGxyAndGxh If the KML contains gx:w and gx:h, (ol >= 6.7), it will fix the bug introduced by https://github.com/openlayers/openlayers/pull/12695.\n */\nconst writeFeatures = (\n layer,\n featureProjection,\n mapResolution,\n fixGxwAndGxh,\n) => {\n let featString;\n const { olLayer } = layer;\n const exportFeatures = [];\n\n olLayer.getSource().forEachFeature((feature) => {\n // We silently ignore Circle elements as they are\n // not supported in kml.\n if (feature.getGeometry().getType() === \"Circle\") {\n return;\n }\n\n const clone = feature.clone();\n clone.setId(feature.getId());\n clone.getGeometry().setProperties(feature.getGeometry().getProperties());\n clone.getGeometry().transform(featureProjection, \"EPSG:4326\");\n\n // We remove all ExtendedData not related to style.\n Object.keys(feature.getProperties()).forEach((key) => {\n if (!/^(geometry|name|description)$/.test(key)) {\n clone.unset(key, true);\n }\n });\n\n let styles;\n\n if (feature.getStyleFunction()) {\n styles = feature.getStyleFunction()(feature, mapResolution);\n } else if (olLayer && olLayer.getStyleFunction()) {\n styles = olLayer.getStyleFunction()(feature, mapResolution);\n }\n\n const mainStyle = styles[0] || styles;\n\n const newStyle = {\n fill: mainStyle.getFill(),\n stroke: mainStyle.getStroke(),\n text: mainStyle.getText(),\n image: mainStyle.getImage(),\n zIndex: mainStyle.getZIndex(),\n };\n\n if (newStyle.zIndex) {\n clone.set(\"zIndex\", newStyle.zIndex);\n }\n\n // If we see spaces at the beginning or at the end we add a empty\n // white space at the beginning and at the end.\n if (newStyle.text && /^\\s|\\s$/g.test(newStyle.text.getText())) {\n newStyle.text.setText(`\\u200B${newStyle.text.getText()}\\u200B`);\n }\n\n // Set custom properties to be converted in extendedData in KML.\n if (newStyle.text && newStyle.text.getRotation()) {\n clone.set(\"textRotation\", newStyle.text.getRotation());\n }\n\n if (newStyle.text && newStyle.text.getFont()) {\n clone.set(\"textFont\", newStyle.text.getFont());\n }\n\n if (newStyle.text && newStyle.text.getTextAlign()) {\n clone.set(\"textAlign\", newStyle.text.getTextAlign());\n }\n\n if (newStyle.text && newStyle.text.getOffsetX()) {\n clone.set(\"textOffsetX\", newStyle.text.getOffsetX());\n }\n\n if (newStyle.text && newStyle.text.getOffsetY()) {\n clone.set(\"textOffsetY\", newStyle.text.getOffsetY());\n }\n\n if (newStyle.text && newStyle.text.getStroke()) {\n if (newStyle.text.getStroke().getColor()) {\n clone.set(\n \"textStrokeColor\",\n asString(newStyle.text.getStroke().getColor()),\n );\n }\n\n if (newStyle.text.getStroke().getWidth()) {\n clone.set(\"textStrokeWidth\", newStyle.text.getStroke().getWidth());\n }\n }\n\n if (newStyle.text && newStyle.text.getBackgroundFill()) {\n clone.set(\n \"textBackgroundFillColor\",\n asString(newStyle.text.getBackgroundFill().getColor()),\n );\n }\n\n if (newStyle.text && newStyle.text.getPadding()) {\n clone.set(\"textPadding\", newStyle.text.getPadding().join());\n }\n\n if (newStyle.stroke && newStyle.stroke.getLineDash()) {\n clone.set(\"lineDash\", newStyle.stroke.getLineDash().join(\",\"));\n }\n\n if (newStyle.image instanceof Circle) {\n newStyle.image = null;\n }\n\n if (newStyle.image) {\n const imgSource = newStyle.image.getSrc();\n if (!/(http(s?)):\\/\\//gi.test(imgSource)) {\n // eslint-disable-next-line no-console\n console.log(\n \"Local image source not supported for KML export.\" +\n \"Should use remote web server\",\n );\n }\n\n if (newStyle.image.getRotation()) {\n // We set the icon rotation as extended data\n clone.set(\"iconRotation\", newStyle.image.getRotation());\n }\n\n // Fix scale when gx:h and gx:w are used, this is for Mapset KMLs\n if (fixGxwAndGxh) {\n const resizeScale = scaleForSize(newStyle.image.getSize());\n newStyle.image.setScale(\n newStyle.image.getScaleArray()[0] * resizeScale,\n );\n }\n\n // Set map resolution to use for icon-to-map proportional scaling\n if (feature.get(\"pictureOptions\")) {\n clone.set(\n \"pictureOptions\",\n JSON.stringify(feature.get(\"pictureOptions\")),\n );\n }\n }\n\n // In case a fill pattern should be applied (use fillPattern attribute to store pattern id, color etc)\n if (feature.get(\"fillPattern\")) {\n clone.set(\"fillPattern\", JSON.stringify(feature.get(\"fillPattern\")));\n newStyle.fill = null;\n }\n\n // maxZoom: maximum zoom level at which the feature is displayed\n if (feature.get(\"maxZoom\")) {\n clone.set(\"maxZoom\", parseFloat(feature.get(\"maxZoom\"), 10));\n }\n\n // minZoom: minimum zoom level at which the feature is displayed\n if (feature.get(\"minZoom\")) {\n clone.set(\"minZoom\", parseFloat(feature.get(\"minZoom\"), 10));\n }\n\n // If only text is displayed we must specify an\n // image style with scale=0\n if (newStyle.text && !newStyle.image) {\n newStyle.image = new Icon({\n src: \"noimage\",\n scale: 0,\n });\n }\n\n // In case we use line's icon .\n const extraLineStyles = (Array.isArray(styles) && styles.slice(1)) || [];\n extraLineStyles.forEach((extraLineStyle) => {\n if (\n extraLineStyle &&\n extraLineStyle.getImage() instanceof Icon &&\n extraLineStyle.getGeometry()\n ) {\n const coord = extraLineStyle.getGeometry()(feature).getCoordinates();\n const startCoord = feature.getGeometry().getFirstCoordinate();\n if (coord[0] === startCoord[0] && coord[1] === startCoord[1]) {\n clone.set(\n \"lineStartIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n } else {\n clone.set(\n \"lineEndIcon\",\n JSON.stringify({\n url: extraLineStyle.getImage().getSrc(),\n scale: extraLineStyle.getImage().getScale(),\n size: extraLineStyle.getImage().getSize(),\n zIndex: extraLineStyle.getZIndex(),\n }),\n );\n }\n }\n });\n\n const olStyle = new Style(newStyle);\n clone.setStyle(olStyle);\n\n if (\n !(\n clone.getGeometry() instanceof Point &&\n olStyle.getText() &&\n !olStyle.getText().getText()\n )\n ) {\n exportFeatures.push(clone);\n }\n });\n\n if (exportFeatures.length > 0) {\n if (exportFeatures.length === 1) {\n // force the add of a <Document> node\n exportFeatures.push(new Feature());\n }\n\n featString = new KML({\n extractStyles: true,\n defaultStyle: [kmlStyle],\n }).writeFeatures(exportFeatures);\n\n // Remove no image hack\n featString = featString.replace(\n /<Icon>\\s*<href>noimage<\\/href>\\s*<\\/Icon>/g,\n \"\",\n );\n\n // Remove empty placemark added to have\n // <Document> tag\n featString = featString.replace(/<Placemark\\/>/g, \"\");\n\n // Add KML document name\n if (layer.name) {\n featString = featString.replace(\n /<Document>/,\n `<Document><name>${layer.name}</name>`,\n );\n }\n }\n\n return featString;\n};\n\n/**\n * Removes the <Camera> tag from a KML string. Returns the KML string with removed <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n */\nconst removeDocumentCamera = (kmlString) => {\n const kmlDoc = parse(kmlString);\n // Remove old Camera node\n const oldCameraNode = kmlDoc.getElementsByTagName(\"Camera\")[0];\n if (oldCameraNode) {\n oldCameraNode.remove();\n }\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\n/**\n * Write the <Camera> tag into a KML string. Returns the KML string with added <Camera> tag.\n * @param {String} kmlString A string representing a KML file.\n * @param {Object} cameraAttributes Object containing the camera tags (longitude, latitude, altitude, heading, tilt, altitudeMode, roll)\n * as keys with corresponding values. See https://developers.google.com/kml/documentation/kmlreference#camera\n */\nconst writeDocumentCamera = (kmlString, cameraAttributes) => {\n const kmlDoc = parse(removeDocumentCamera(kmlString));\n\n if (cameraAttributes) {\n // Create Camera node with child attributes if the cameraAttributes object is defined\n const cameraNode = kmlDoc.createElement(\"Camera\");\n Object.keys(cameraAttributes).forEach((key) => {\n const cameraAttribute = kmlDoc.createElement(\n `${key.charAt(0).toUpperCase() + key.slice(1)}`,\n );\n cameraAttribute.innerHTML = cameraAttributes[key];\n cameraNode.appendChild(cameraAttribute);\n });\n const documentNode = kmlDoc.getElementsByTagName(\"Document\")[0];\n documentNode.appendChild(cameraNode);\n }\n\n return new XMLSerializer().serializeToString(kmlDoc);\n};\n\nwindow.VectorLayer = VectorLayer;\nwindow.VectorSource = VectorSource;\n\nwindow.writeFeatures = writeFeatures;\nwindow.readFeatures = readFeatures;\n\nexport default {\n readFeatures,\n writeFeatures,\n writeDocumentCamera,\n removeDocumentCamera,\n};\n"],
5
+ "mappings": "AAAA,OAAO,SAAS;AAChB,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,gBAAgB;AACvB,OAAO,wBAAwB;AAC/B,SAAS,OAAO,MAAM,MAAM,QAAQ,MAAM,cAAc;AACxD,SAAS,gBAAgB;AACzB,SAAS,aAAa;AACtB,OAAO,kBAAkB;AACzB,OAAO,iBAAiB;AACxB,SAAS,gBAAgB;AACzB,OAAO,uBAAuB;AAI9B,MAAM,eAAe,CAAC,SAAS;AAC7B,SAAO,KAAK,KAAK,I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