@dartcom/ui-kit 10.2.34 → 10.2.35
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.
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,21 @@ function _interopNamespaceDefault(e) {
|
|
|
41
41
|
return Object.freeze(n);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function _mergeNamespaces(n, m) {
|
|
45
|
+
m.forEach(function (e) {
|
|
46
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
47
|
+
if (k !== 'default' && !(k in n)) {
|
|
48
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
49
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () { return e[k]; }
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
return Object.freeze(n);
|
|
57
|
+
}
|
|
58
|
+
|
|
44
59
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
45
60
|
|
|
46
61
|
exports.Operations = void 0;
|
|
@@ -14633,10 +14648,11 @@ function requireLeafletSrc () {
|
|
|
14633
14648
|
}
|
|
14634
14649
|
|
|
14635
14650
|
var leafletSrcExports = requireLeafletSrc();
|
|
14651
|
+
var s$3 = /*@__PURE__*/getDefaultExportFromCjs(leafletSrcExports);
|
|
14636
14652
|
|
|
14637
|
-
function r$
|
|
14653
|
+
function r$2(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r$2(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx$1(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r$2(e))&&(n&&(n+=" "),n+=t);return n}
|
|
14638
14654
|
|
|
14639
|
-
let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
|
|
14655
|
+
let e$1={data:""},t=t=>{if("object"==typeof window){let e=(t?t.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return e.nonce=window.__nonce__,e.parentNode||(t||document.head).appendChild(e),e.firstChild}return t||e$1},l$1=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,a=/\/\*[^]*?\*\/| +/g,n$1=/\n+/g,o$2=(e,t)=>{let r="",l="",a="";for(let n in e){let c=e[n];"@"==n[0]?"i"==n[1]?r=n+" "+c+";":l+="f"==n[1]?o$2(c,n):n+"{"+o$2(c,"k"==n[1]?"":t)+"}":"object"==typeof c?l+=o$2(c,t?t.replace(/([^,])+/g,e=>n.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,"-$&").toLowerCase(),a+=o$2.p?o$2.p(n,c):n+":"+c+";");}return r+(t&&a?t+"{"+a+"}":a)+l},c$1={},s$2=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+s$2(e[r]);return t}return e},i$2=(e,t,r,i,p)=>{let u=s$2(e),d=c$1[u]||(c$1[u]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return "go"+r})(u));if(!c$1[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l$1.exec(e.replace(a,""));)t[4]?o.shift():t[3]?(r=t[3].replace(n$1," ").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n$1," ").trim();return o[0]})(e);c$1[d]=o$2(p?{["@keyframes "+d]:t}:t,r?"":"."+d);}let f=r&&c$1.g?c$1.g:null;return r&&(c$1.g=c$1[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e);})(c$1[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?"."+t:e&&"object"==typeof e?e.props?"":o$2(e,""):false===e?"":e;}return e+l+(null==n?"":n)},"");function u(e){let r=this||{},l=e.call?e(r.p):e;return i$2(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}u.bind({g:1});u.bind({k:1});
|
|
14640
14656
|
|
|
14641
14657
|
function _defineProperties$1(target, props) {
|
|
14642
14658
|
for (var i = 0; i < props.length; i++) {
|
|
@@ -26622,12 +26638,12 @@ const MapProvider = ({ children }) => {
|
|
|
26622
26638
|
const [isReady, setIsReady] = React__namespace.useState(false);
|
|
26623
26639
|
const init = async () => {
|
|
26624
26640
|
try {
|
|
26625
|
-
// await import('leaflet-rotatedmarker');
|
|
26626
|
-
// await import('leaflet-polylineoffset');
|
|
26627
|
-
// await import('leaflet-area-select');
|
|
26628
|
-
// await import('leaflet-path-drag');
|
|
26629
|
-
// await import('./library/leaflet-arrows');
|
|
26630
26641
|
await Promise.resolve().then(function () { return tangram_min; });
|
|
26642
|
+
await Promise.resolve().then(function () { return leaflet_rotatedMarker; });
|
|
26643
|
+
await Promise.resolve().then(function () { return leaflet_polylineoffset$1; });
|
|
26644
|
+
await Promise.resolve().then(function () { return index$1; });
|
|
26645
|
+
await Promise.resolve().then(function () { return index; });
|
|
26646
|
+
await Promise.resolve().then(function () { return leafletArrows$1; });
|
|
26631
26647
|
setIsReady(true);
|
|
26632
26648
|
}
|
|
26633
26649
|
catch {
|
|
@@ -44328,10 +44344,10 @@ function requirePapaparse_min () {
|
|
|
44328
44344
|
var papaparse_minExports = requirePapaparse_min();
|
|
44329
44345
|
var e = /*@__PURE__*/getDefaultExportFromCjs(papaparse_minExports);
|
|
44330
44346
|
|
|
44331
|
-
"function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
|
|
44347
|
+
"function"==typeof SuppressedError&&SuppressedError;function P(n,t){return e.parse(n,t)}function x$1(n,t){e.parse(n,Object.assign({},{download:true},t));}function O(n,t){return void 0===t&&(t={}),e.unparse(n,t)}function S$1(){return {readString:P,readRemoteFile:x$1,jsonToCSV:O}}e.BAD_DELIMITERS;e.RECORD_SEP;e.UNIT_SEP;e.WORKERS_SUPPORTED;e.LocalChunkSize;e.DefaultDelimiter;
|
|
44332
44348
|
|
|
44333
44349
|
const CSVUploader = ({ onDataParsed, onError, delimiter = ',', header = true, dynamicTyping = true, skipEmptyLines = true, worker = false, }) => {
|
|
44334
|
-
const { readString } = S();
|
|
44350
|
+
const { readString } = S$1();
|
|
44335
44351
|
const [loading, setLoading] = React__namespace.useState(false);
|
|
44336
44352
|
const [error, setError] = React__namespace.useState(null);
|
|
44337
44353
|
return (jsxRuntime.jsx(UploadButton, { accept: ".csv", loading: loading, error: error, onFilesLoad: ({ files }) => {
|
|
@@ -46783,7 +46799,7 @@ const schema = create$3().shape({
|
|
|
46783
46799
|
password: create$6().required(),
|
|
46784
46800
|
});
|
|
46785
46801
|
|
|
46786
|
-
const r=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
|
|
46802
|
+
const r$1=(t,r,o)=>{if(t&&"reportValidity"in t){const s=get(o,r);t.setCustomValidity(s&&s.message||""),t.reportValidity();}},o$1=(e,t)=>{for(const o in t.fields){const s=t.fields[o];s&&s.ref&&"reportValidity"in s.ref?r$1(s.ref,o,e):s&&s.refs&&s.refs.forEach(t=>r$1(t,o,e));}},s=(r,s)=>{s.shouldUseNativeValidation&&o$1(r,s);const n={};for(const o in r){const f=get(s.fields,o),c=Object.assign(r[o]||{},{ref:f&&f.ref});if(i(s.names||Object.keys(r),o)){const r=Object.assign({},get(n,o));set(r,"root",c),set(n,o,r);}else set(n,o,c);}return n},i=(e,t)=>{const r=n(t);return e.some(e=>n(e).match(`^${r}\\.\\d+`))};function n(e){return e.replace(/\]|\[/g,"")}
|
|
46787
46803
|
|
|
46788
46804
|
function o(o,n,s$1){return void 0===s$1&&(s$1={}),function(a,i,c){try{return Promise.resolve(function(t,r){try{var u=(null!=n&&n.context&&"development"===process.env.NODE_ENV&&console.warn("You should not used the yup options context. Please, use the 'useForm' context object instead"),Promise.resolve(o["sync"===s$1.mode?"validateSync":"validate"](a,Object.assign({abortEarly:!1},n,{context:i}))).then(function(t){return c.shouldUseNativeValidation&&o$1({},c),{values:s$1.raw?Object.assign({},a):t,errors:{}}}));}catch(e){return r(e)}return u&&u.then?u.then(void 0,r):u}(0,function(e){if(!e.inner)throw e;return {values:{},errors:s((o=e,n=!c.shouldUseNativeValidation&&"all"===c.criteriaMode,(o.inner||[]).reduce(function(e,t){if(e[t.path]||(e[t.path]={message:t.message,type:t.type}),n){var o=e[t.path].types,s=o&&o[t.type];e[t.path]=appendErrors(t.path,n,e,t.type,s?[].concat(s,t.message):t.message);}return e},{})),c)};var o,n;}))}catch(e){return Promise.reject(e)}}}
|
|
46789
46805
|
|
|
@@ -46889,6 +46905,1029 @@ var tangram_min = /*#__PURE__*/Object.freeze({
|
|
|
46889
46905
|
default: Tangram$1
|
|
46890
46906
|
});
|
|
46891
46907
|
|
|
46908
|
+
(function() {
|
|
46909
|
+
// save these original methods before they are overwritten
|
|
46910
|
+
var proto_initIcon = L.Marker.prototype._initIcon;
|
|
46911
|
+
var proto_setPos = L.Marker.prototype._setPos;
|
|
46912
|
+
|
|
46913
|
+
var oldIE = (L.DomUtil.TRANSFORM === 'msTransform');
|
|
46914
|
+
|
|
46915
|
+
L.Marker.addInitHook(function () {
|
|
46916
|
+
var iconOptions = this.options.icon && this.options.icon.options;
|
|
46917
|
+
var iconAnchor = iconOptions && this.options.icon.options.iconAnchor;
|
|
46918
|
+
if (iconAnchor) {
|
|
46919
|
+
iconAnchor = (iconAnchor[0] + 'px ' + iconAnchor[1] + 'px');
|
|
46920
|
+
}
|
|
46921
|
+
this.options.rotationOrigin = this.options.rotationOrigin || iconAnchor || 'center bottom' ;
|
|
46922
|
+
this.options.rotationAngle = this.options.rotationAngle || 0;
|
|
46923
|
+
|
|
46924
|
+
// Ensure marker keeps rotated during dragging
|
|
46925
|
+
this.on('drag', function(e) { e.target._applyRotation(); });
|
|
46926
|
+
});
|
|
46927
|
+
|
|
46928
|
+
L.Marker.include({
|
|
46929
|
+
_initIcon: function() {
|
|
46930
|
+
proto_initIcon.call(this);
|
|
46931
|
+
},
|
|
46932
|
+
|
|
46933
|
+
_setPos: function (pos) {
|
|
46934
|
+
proto_setPos.call(this, pos);
|
|
46935
|
+
this._applyRotation();
|
|
46936
|
+
},
|
|
46937
|
+
|
|
46938
|
+
_applyRotation: function () {
|
|
46939
|
+
if(this.options.rotationAngle) {
|
|
46940
|
+
this._icon.style[L.DomUtil.TRANSFORM+'Origin'] = this.options.rotationOrigin;
|
|
46941
|
+
|
|
46942
|
+
if(oldIE) {
|
|
46943
|
+
// for IE 9, use the 2D rotation
|
|
46944
|
+
this._icon.style[L.DomUtil.TRANSFORM] = 'rotate(' + this.options.rotationAngle + 'deg)';
|
|
46945
|
+
} else {
|
|
46946
|
+
// for modern browsers, prefer the 3D accelerated version
|
|
46947
|
+
this._icon.style[L.DomUtil.TRANSFORM] += ' rotateZ(' + this.options.rotationAngle + 'deg)';
|
|
46948
|
+
}
|
|
46949
|
+
}
|
|
46950
|
+
},
|
|
46951
|
+
|
|
46952
|
+
setRotationAngle: function(angle) {
|
|
46953
|
+
this.options.rotationAngle = angle;
|
|
46954
|
+
this.update();
|
|
46955
|
+
return this;
|
|
46956
|
+
},
|
|
46957
|
+
|
|
46958
|
+
setRotationOrigin: function(origin) {
|
|
46959
|
+
this.options.rotationOrigin = origin;
|
|
46960
|
+
this.update();
|
|
46961
|
+
return this;
|
|
46962
|
+
}
|
|
46963
|
+
});
|
|
46964
|
+
})();
|
|
46965
|
+
|
|
46966
|
+
var leaflet_rotatedMarker = /*#__PURE__*/Object.freeze({
|
|
46967
|
+
__proto__: null
|
|
46968
|
+
});
|
|
46969
|
+
|
|
46970
|
+
var leaflet_polylineoffset$2 = {exports: {}};
|
|
46971
|
+
|
|
46972
|
+
var hasRequiredLeaflet_polylineoffset;
|
|
46973
|
+
|
|
46974
|
+
function requireLeaflet_polylineoffset () {
|
|
46975
|
+
if (hasRequiredLeaflet_polylineoffset) return leaflet_polylineoffset$2.exports;
|
|
46976
|
+
hasRequiredLeaflet_polylineoffset = 1;
|
|
46977
|
+
(function (module, exports$1) {
|
|
46978
|
+
(function (factory, window) {
|
|
46979
|
+
{
|
|
46980
|
+
module.exports = factory(requireLeafletSrc());
|
|
46981
|
+
}
|
|
46982
|
+
if (typeof window !== 'undefined' && window.L) {
|
|
46983
|
+
window.L.PolylineOffset = factory(L);
|
|
46984
|
+
}
|
|
46985
|
+
}(function (L) {
|
|
46986
|
+
|
|
46987
|
+
function forEachPair(list, callback) {
|
|
46988
|
+
if (!list || list.length < 1) { return; }
|
|
46989
|
+
for (var i = 1, l = list.length; i < l; i++) {
|
|
46990
|
+
callback(list[i-1], list[i]);
|
|
46991
|
+
}
|
|
46992
|
+
}
|
|
46993
|
+
|
|
46994
|
+
/**
|
|
46995
|
+
Find the coefficients (a,b) of a line of equation y = a.x + b,
|
|
46996
|
+
or the constant x for vertical lines
|
|
46997
|
+
Return null if there's no equation possible
|
|
46998
|
+
*/
|
|
46999
|
+
function lineEquation(pt1, pt2) {
|
|
47000
|
+
if (pt1.x === pt2.x) {
|
|
47001
|
+
return pt1.y === pt2.y ? null : { x: pt1.x };
|
|
47002
|
+
}
|
|
47003
|
+
|
|
47004
|
+
var a = (pt2.y - pt1.y) / (pt2.x - pt1.x);
|
|
47005
|
+
return {
|
|
47006
|
+
a: a,
|
|
47007
|
+
b: pt1.y - a * pt1.x,
|
|
47008
|
+
};
|
|
47009
|
+
}
|
|
47010
|
+
|
|
47011
|
+
/**
|
|
47012
|
+
Return the intersection point of two lines defined by two points each
|
|
47013
|
+
Return null when there's no unique intersection
|
|
47014
|
+
*/
|
|
47015
|
+
function intersection(l1a, l1b, l2a, l2b) {
|
|
47016
|
+
var line1 = lineEquation(l1a, l1b);
|
|
47017
|
+
var line2 = lineEquation(l2a, l2b);
|
|
47018
|
+
|
|
47019
|
+
if (line1 === null || line2 === null) {
|
|
47020
|
+
return null;
|
|
47021
|
+
}
|
|
47022
|
+
|
|
47023
|
+
if (line1.hasOwnProperty('x')) {
|
|
47024
|
+
return line2.hasOwnProperty('x')
|
|
47025
|
+
? null
|
|
47026
|
+
: {
|
|
47027
|
+
x: line1.x,
|
|
47028
|
+
y: line2.a * line1.x + line2.b,
|
|
47029
|
+
};
|
|
47030
|
+
}
|
|
47031
|
+
if (line2.hasOwnProperty('x')) {
|
|
47032
|
+
return {
|
|
47033
|
+
x: line2.x,
|
|
47034
|
+
y: line1.a * line2.x + line1.b,
|
|
47035
|
+
};
|
|
47036
|
+
}
|
|
47037
|
+
|
|
47038
|
+
if (line1.a === line2.a) {
|
|
47039
|
+
return null;
|
|
47040
|
+
}
|
|
47041
|
+
|
|
47042
|
+
var x = (line2.b - line1.b) / (line1.a - line2.a);
|
|
47043
|
+
return {
|
|
47044
|
+
x: x,
|
|
47045
|
+
y: line1.a * x + line1.b,
|
|
47046
|
+
};
|
|
47047
|
+
}
|
|
47048
|
+
|
|
47049
|
+
function translatePoint(pt, dist, heading) {
|
|
47050
|
+
return {
|
|
47051
|
+
x: pt.x + dist * Math.cos(heading),
|
|
47052
|
+
y: pt.y + dist * Math.sin(heading),
|
|
47053
|
+
};
|
|
47054
|
+
}
|
|
47055
|
+
|
|
47056
|
+
var PolylineOffset = {
|
|
47057
|
+
offsetPointLine: function(points, distance) {
|
|
47058
|
+
var offsetSegments = [];
|
|
47059
|
+
|
|
47060
|
+
forEachPair(points, L.bind(function(a, b) {
|
|
47061
|
+
if (a.x === b.x && a.y === b.y) { return; }
|
|
47062
|
+
|
|
47063
|
+
// angles in (-PI, PI]
|
|
47064
|
+
var segmentAngle = Math.atan2(a.y - b.y, a.x - b.x);
|
|
47065
|
+
var offsetAngle = segmentAngle - Math.PI/2;
|
|
47066
|
+
|
|
47067
|
+
offsetSegments.push({
|
|
47068
|
+
offsetAngle: offsetAngle,
|
|
47069
|
+
original: [a, b],
|
|
47070
|
+
offset: [
|
|
47071
|
+
translatePoint(a, distance, offsetAngle),
|
|
47072
|
+
translatePoint(b, distance, offsetAngle)
|
|
47073
|
+
]
|
|
47074
|
+
});
|
|
47075
|
+
}, this));
|
|
47076
|
+
|
|
47077
|
+
return offsetSegments;
|
|
47078
|
+
},
|
|
47079
|
+
|
|
47080
|
+
offsetPoints: function(pts, offset) {
|
|
47081
|
+
var offsetSegments = this.offsetPointLine(pts, offset);
|
|
47082
|
+
return this.joinLineSegments(offsetSegments, offset);
|
|
47083
|
+
},
|
|
47084
|
+
|
|
47085
|
+
/**
|
|
47086
|
+
Join 2 line segments defined by 2 points each with a circular arc
|
|
47087
|
+
*/
|
|
47088
|
+
joinSegments: function(s1, s2, offset) {
|
|
47089
|
+
// TODO: different join styles
|
|
47090
|
+
return this.circularArc(s1, s2, offset)
|
|
47091
|
+
.filter(function(x) { return x; })
|
|
47092
|
+
},
|
|
47093
|
+
|
|
47094
|
+
joinLineSegments: function(segments, offset) {
|
|
47095
|
+
var joinedPoints = [];
|
|
47096
|
+
var first = segments[0];
|
|
47097
|
+
var last = segments[segments.length - 1];
|
|
47098
|
+
|
|
47099
|
+
if (first && last) {
|
|
47100
|
+
joinedPoints.push(first.offset[0]);
|
|
47101
|
+
forEachPair(segments, L.bind(function(s1, s2) {
|
|
47102
|
+
joinedPoints = joinedPoints.concat(this.joinSegments(s1, s2, offset));
|
|
47103
|
+
}, this));
|
|
47104
|
+
joinedPoints.push(last.offset[1]);
|
|
47105
|
+
}
|
|
47106
|
+
|
|
47107
|
+
return joinedPoints;
|
|
47108
|
+
},
|
|
47109
|
+
|
|
47110
|
+
segmentAsVector: function(s) {
|
|
47111
|
+
return {
|
|
47112
|
+
x: s[1].x - s[0].x,
|
|
47113
|
+
y: s[1].y - s[0].y,
|
|
47114
|
+
};
|
|
47115
|
+
},
|
|
47116
|
+
|
|
47117
|
+
getSignedAngle: function(s1, s2) {
|
|
47118
|
+
const a = this.segmentAsVector(s1);
|
|
47119
|
+
const b = this.segmentAsVector(s2);
|
|
47120
|
+
return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y);
|
|
47121
|
+
},
|
|
47122
|
+
|
|
47123
|
+
/**
|
|
47124
|
+
Interpolates points between two offset segments in a circular form
|
|
47125
|
+
*/
|
|
47126
|
+
circularArc: function(s1, s2, distance) {
|
|
47127
|
+
// if the segments are the same angle,
|
|
47128
|
+
// there should be a single join point
|
|
47129
|
+
if (s1.offsetAngle === s2.offsetAngle) {
|
|
47130
|
+
return [s1.offset[1]];
|
|
47131
|
+
}
|
|
47132
|
+
|
|
47133
|
+
const signedAngle = this.getSignedAngle(s1.offset, s2.offset);
|
|
47134
|
+
// for inner angles, just find the offset segments intersection
|
|
47135
|
+
if ((signedAngle * distance > 0) &&
|
|
47136
|
+
(signedAngle * this.getSignedAngle(s1.offset, [s1.offset[0], s2.offset[1]]) > 0)) {
|
|
47137
|
+
return [intersection(s1.offset[0], s1.offset[1], s2.offset[0], s2.offset[1])];
|
|
47138
|
+
}
|
|
47139
|
+
|
|
47140
|
+
// draws a circular arc with R = offset distance, C = original meeting point
|
|
47141
|
+
var points = [];
|
|
47142
|
+
var center = s1.original[1];
|
|
47143
|
+
// ensure angles go in the anti-clockwise direction
|
|
47144
|
+
var rightOffset = distance > 0;
|
|
47145
|
+
var startAngle = rightOffset ? s2.offsetAngle : s1.offsetAngle;
|
|
47146
|
+
var endAngle = rightOffset ? s1.offsetAngle : s2.offsetAngle;
|
|
47147
|
+
// and that the end angle is bigger than the start angle
|
|
47148
|
+
if (endAngle < startAngle) {
|
|
47149
|
+
endAngle += Math.PI * 2;
|
|
47150
|
+
}
|
|
47151
|
+
var step = Math.PI / 8;
|
|
47152
|
+
for (var alpha = startAngle; alpha < endAngle; alpha += step) {
|
|
47153
|
+
points.push(translatePoint(center, distance, alpha));
|
|
47154
|
+
}
|
|
47155
|
+
points.push(translatePoint(center, distance, endAngle));
|
|
47156
|
+
|
|
47157
|
+
return rightOffset ? points.reverse() : points;
|
|
47158
|
+
}
|
|
47159
|
+
};
|
|
47160
|
+
|
|
47161
|
+
// Modify the L.Polyline class by overwriting the projection function
|
|
47162
|
+
L.Polyline.include({
|
|
47163
|
+
_projectLatlngs: function (latlngs, result, projectedBounds) {
|
|
47164
|
+
var isFlat = latlngs.length > 0 && latlngs[0] instanceof L.LatLng;
|
|
47165
|
+
|
|
47166
|
+
if (isFlat) {
|
|
47167
|
+
var ring = latlngs.map(L.bind(function(ll) {
|
|
47168
|
+
var point = this._map.latLngToLayerPoint(ll);
|
|
47169
|
+
if (projectedBounds) {
|
|
47170
|
+
projectedBounds.extend(point);
|
|
47171
|
+
}
|
|
47172
|
+
return point;
|
|
47173
|
+
}, this));
|
|
47174
|
+
|
|
47175
|
+
// Offset management hack ---
|
|
47176
|
+
if (this.options.offset) {
|
|
47177
|
+
ring = L.PolylineOffset.offsetPoints(ring, this.options.offset);
|
|
47178
|
+
}
|
|
47179
|
+
// Offset management hack END ---
|
|
47180
|
+
|
|
47181
|
+
result.push(ring.map(function (xy) {
|
|
47182
|
+
return L.point(xy.x, xy.y);
|
|
47183
|
+
}));
|
|
47184
|
+
} else {
|
|
47185
|
+
latlngs.forEach(L.bind(function(ll) {
|
|
47186
|
+
this._projectLatlngs(ll, result, projectedBounds);
|
|
47187
|
+
}, this));
|
|
47188
|
+
}
|
|
47189
|
+
}
|
|
47190
|
+
});
|
|
47191
|
+
|
|
47192
|
+
L.Polyline.include({
|
|
47193
|
+
setOffset: function(offset) {
|
|
47194
|
+
this.options.offset = offset;
|
|
47195
|
+
this.redraw();
|
|
47196
|
+
return this;
|
|
47197
|
+
}
|
|
47198
|
+
});
|
|
47199
|
+
|
|
47200
|
+
return PolylineOffset;
|
|
47201
|
+
|
|
47202
|
+
}, window));
|
|
47203
|
+
} (leaflet_polylineoffset$2));
|
|
47204
|
+
return leaflet_polylineoffset$2.exports;
|
|
47205
|
+
}
|
|
47206
|
+
|
|
47207
|
+
var leaflet_polylineoffsetExports = requireLeaflet_polylineoffset();
|
|
47208
|
+
var leaflet_polylineoffset = /*@__PURE__*/getDefaultExportFromCjs(leaflet_polylineoffsetExports);
|
|
47209
|
+
|
|
47210
|
+
var leaflet_polylineoffset$1 = /*#__PURE__*/_mergeNamespaces({
|
|
47211
|
+
__proto__: null,
|
|
47212
|
+
default: leaflet_polylineoffset
|
|
47213
|
+
}, [leaflet_polylineoffsetExports]);
|
|
47214
|
+
|
|
47215
|
+
/**
|
|
47216
|
+
* L.Map.SelectArea - Area selection tool for leaflet
|
|
47217
|
+
*
|
|
47218
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
47219
|
+
* @see https://github.com/w8r/leaflet-area-select
|
|
47220
|
+
* @license MIT
|
|
47221
|
+
* @preserve
|
|
47222
|
+
*/
|
|
47223
|
+
var r = function() {
|
|
47224
|
+
return true;
|
|
47225
|
+
};
|
|
47226
|
+
s$3.Map.SelectArea = s$3.Map.BoxZoom.extend({
|
|
47227
|
+
statics: {
|
|
47228
|
+
/**
|
|
47229
|
+
* @static
|
|
47230
|
+
* @type {String}
|
|
47231
|
+
*/
|
|
47232
|
+
SELECT_AREA_SELECTED: "selectarea:selected",
|
|
47233
|
+
/**
|
|
47234
|
+
* @static
|
|
47235
|
+
* @type {String}
|
|
47236
|
+
*/
|
|
47237
|
+
SELECT_AREA_START: "selectarea:start",
|
|
47238
|
+
/**
|
|
47239
|
+
* @static
|
|
47240
|
+
* @type {String}
|
|
47241
|
+
*/
|
|
47242
|
+
SELECT_AREA_TOGGLED: "selectarea:toggled"
|
|
47243
|
+
},
|
|
47244
|
+
options: {
|
|
47245
|
+
shiftKey: false,
|
|
47246
|
+
ctrlKey: true,
|
|
47247
|
+
validate: r,
|
|
47248
|
+
autoDisable: false,
|
|
47249
|
+
cursor: "crosshair"
|
|
47250
|
+
},
|
|
47251
|
+
/**
|
|
47252
|
+
* @param {L.Map} map
|
|
47253
|
+
* @constructor
|
|
47254
|
+
*/
|
|
47255
|
+
initialize: function(t, e) {
|
|
47256
|
+
s$3.Util.setOptions(this, e || {}), s$3.Map.BoxZoom.prototype.initialize.call(this, t), this._validate = null, this._moved = false, this._autoDisable = !this.options.ctrlKey && this.options.autoDisable, this._lastLayerPoint = null, this._beforeCursor = null, this.setValidate(this.options.validate), this.setAutoDisable(this.options.autoDisable);
|
|
47257
|
+
},
|
|
47258
|
+
/**
|
|
47259
|
+
* @param {Function=} validate
|
|
47260
|
+
* @return {SelectArea}
|
|
47261
|
+
*/
|
|
47262
|
+
setValidate: function(t) {
|
|
47263
|
+
var e = this;
|
|
47264
|
+
return typeof t != "function" && (t = r), this._validate = function(i) {
|
|
47265
|
+
return t.call(e, i);
|
|
47266
|
+
}, this;
|
|
47267
|
+
},
|
|
47268
|
+
/**
|
|
47269
|
+
* @param {Boolean} autoDisable
|
|
47270
|
+
*/
|
|
47271
|
+
setAutoDisable: function(t) {
|
|
47272
|
+
this._autoDisable = !!t;
|
|
47273
|
+
},
|
|
47274
|
+
/**
|
|
47275
|
+
* @param {Boolean} on
|
|
47276
|
+
*/
|
|
47277
|
+
setControlKey: function(t) {
|
|
47278
|
+
var e = this._enabled;
|
|
47279
|
+
e && this.disable(), this.options.ctrlKey = !!t, t && (this.options.shiftKey = false), e && this.enable();
|
|
47280
|
+
},
|
|
47281
|
+
/**
|
|
47282
|
+
* @param {Boolean} on
|
|
47283
|
+
*/
|
|
47284
|
+
setShiftKey: function(t) {
|
|
47285
|
+
var e = this._enabled;
|
|
47286
|
+
e && this.disable(), this.options.shiftKey = !!t, t && (this.options.ctrlKey = false), e && this.enable();
|
|
47287
|
+
},
|
|
47288
|
+
/**
|
|
47289
|
+
* Disable dragging or zoombox
|
|
47290
|
+
* @param {Function=} validate
|
|
47291
|
+
* @param {Boolean=} autoDisable
|
|
47292
|
+
*/
|
|
47293
|
+
enable: function(t, e) {
|
|
47294
|
+
this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.disable() : this.options.ctrlKey || this._map.dragging.disable(), s$3.Map.BoxZoom.prototype.enable.call(this), this.options.ctrlKey || this._setCursor(), t && this.setValidate(t), this.setAutoDisable(e), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
|
|
47295
|
+
},
|
|
47296
|
+
/**
|
|
47297
|
+
* Re-enable box zoom or dragging
|
|
47298
|
+
*/
|
|
47299
|
+
disable: function() {
|
|
47300
|
+
s$3.Map.BoxZoom.prototype.disable.call(this), this.options.ctrlKey || this._restoreCursor(), this.options.shiftKey ? this._map.boxZoom && this._map.boxZoom.enable() : this._map.dragging.enable(), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_TOGGLED);
|
|
47301
|
+
},
|
|
47302
|
+
/**
|
|
47303
|
+
* Also listen to ESC to cancel interaction
|
|
47304
|
+
* @override
|
|
47305
|
+
*/
|
|
47306
|
+
addHooks: function() {
|
|
47307
|
+
s$3.Map.BoxZoom.prototype.addHooks.call(this), s$3.DomEvent.on(document, "keyup", this._onKeyUp, this).on(document, "keydown", this._onKeyPress, this).on(document, "contextmenu", this._onMouseDown, this).on(window, "blur", this._onBlur, this), this._map.on("dragstart", this._onMouseDown, this);
|
|
47308
|
+
},
|
|
47309
|
+
/**
|
|
47310
|
+
* @override
|
|
47311
|
+
*/
|
|
47312
|
+
removeHooks: function() {
|
|
47313
|
+
s$3.Map.BoxZoom.prototype.removeHooks.call(this), s$3.DomEvent.off(document, "keyup", this._onKeyUp, this).off(document, "keydown", this._onKeyPress, this).off(document, "contextmenu", this._onMouseDown, this).off(window, "blur", this._onBlur, this), this._map.off("dragstart", this._onMouseDown, this);
|
|
47314
|
+
},
|
|
47315
|
+
/**
|
|
47316
|
+
* @override
|
|
47317
|
+
*/
|
|
47318
|
+
_onMouseDown: function(t) {
|
|
47319
|
+
if (this._moved = false, this._lastLayerPoint = null, this.options.shiftKey && !t.shiftKey || this.options.ctrlKey && !t.ctrlKey || t.which !== 1 && t.button !== 1)
|
|
47320
|
+
return false;
|
|
47321
|
+
s$3.DomEvent.stop(t);
|
|
47322
|
+
var e = this._map.mouseEventToLayerPoint(t);
|
|
47323
|
+
if (!this._validate(e)) return false;
|
|
47324
|
+
s$3.DomUtil.disableTextSelection(), s$3.DomUtil.disableImageDrag(), this._startLayerPoint = e, s$3.DomEvent.on(document, "mousemove", this._onMouseMove, this).on(document, "mouseup", this._onMouseUp, this).on(document, "keydown", this._onKeyDown, this);
|
|
47325
|
+
},
|
|
47326
|
+
/**
|
|
47327
|
+
* @override
|
|
47328
|
+
*/
|
|
47329
|
+
_onMouseMove: function(t) {
|
|
47330
|
+
this._moved || (this._box = s$3.DomUtil.create("div", "leaflet-zoom-box", this._pane), s$3.DomUtil.setPosition(this._box, this._startLayerPoint), this._map.fire(s$3.Map.SelectArea.SELECT_AREA_START));
|
|
47331
|
+
var e = this._startLayerPoint, i = this._box, o = this._map.mouseEventToLayerPoint(t), a = o.subtract(e);
|
|
47332
|
+
if (this._validate(o)) {
|
|
47333
|
+
this._lastLayerPoint = o;
|
|
47334
|
+
var n = new s$3.Point(
|
|
47335
|
+
Math.min(o.x, e.x),
|
|
47336
|
+
Math.min(o.y, e.y)
|
|
47337
|
+
);
|
|
47338
|
+
s$3.DomUtil.setPosition(i, n), this._moved = true, i.style.width = Math.max(0, Math.abs(a.x) - 4) + "px", i.style.height = Math.max(0, Math.abs(a.y) - 4) + "px";
|
|
47339
|
+
}
|
|
47340
|
+
},
|
|
47341
|
+
/**
|
|
47342
|
+
* General on/off toggle
|
|
47343
|
+
* @param {KeyboardEvent} e
|
|
47344
|
+
*/
|
|
47345
|
+
_onKeyUp: function(t) {
|
|
47346
|
+
t.keyCode === 27 ? this._moved && this._box && this._finish() : this.options.ctrlKey && (this._restoreCursor(), this._map.dragging.enable());
|
|
47347
|
+
},
|
|
47348
|
+
/**
|
|
47349
|
+
* Key down listener to enable on ctrl-press
|
|
47350
|
+
* @param {KeyboardEvent} e
|
|
47351
|
+
*/
|
|
47352
|
+
_onKeyPress: function(t) {
|
|
47353
|
+
this.options.ctrlKey && (t.ctrlKey || t.type === "dragstart") && this._beforeCursor === null && (this._setCursor(), this._map.dragging._draggable._onUp(t), this._map.dragging.disable());
|
|
47354
|
+
},
|
|
47355
|
+
/**
|
|
47356
|
+
* Window blur listener to restore state
|
|
47357
|
+
* @param {Event} e
|
|
47358
|
+
*/
|
|
47359
|
+
_onBlur: function(t) {
|
|
47360
|
+
this._restoreCursor(), this._map.dragging.enable();
|
|
47361
|
+
},
|
|
47362
|
+
/**
|
|
47363
|
+
* Set crosshair cursor
|
|
47364
|
+
*/
|
|
47365
|
+
_setCursor: function() {
|
|
47366
|
+
this._beforeCursor = this._container.style.cursor, this._container.style.cursor = this.options.cursor;
|
|
47367
|
+
},
|
|
47368
|
+
/**
|
|
47369
|
+
* Restore status quo cursor
|
|
47370
|
+
*/
|
|
47371
|
+
_restoreCursor: function() {
|
|
47372
|
+
this._container.style.cursor = this._beforeCursor, this._beforeCursor = null;
|
|
47373
|
+
},
|
|
47374
|
+
/**
|
|
47375
|
+
* @override
|
|
47376
|
+
*/
|
|
47377
|
+
_onMouseUp: function(t) {
|
|
47378
|
+
this._finish();
|
|
47379
|
+
var e = this._map, i = this._lastLayerPoint;
|
|
47380
|
+
if (!(!i || this._startLayerPoint.equals(i))) {
|
|
47381
|
+
s$3.DomEvent.stop(t);
|
|
47382
|
+
var o = e.layerPointToLatLng(this._startLayerPoint), a = e.layerPointToLatLng(i), n = new s$3.LatLngBounds(o, a);
|
|
47383
|
+
this._autoDisable ? this.disable() : this._restoreCursor(), this._moved = false, s$3.Util.requestAnimFrame(function() {
|
|
47384
|
+
e.fire(s$3.Map.SelectArea.SELECT_AREA_SELECTED, {
|
|
47385
|
+
bounds: n,
|
|
47386
|
+
start: o,
|
|
47387
|
+
end: a
|
|
47388
|
+
});
|
|
47389
|
+
});
|
|
47390
|
+
}
|
|
47391
|
+
}
|
|
47392
|
+
});
|
|
47393
|
+
s$3.Map.mergeOptions({
|
|
47394
|
+
selectArea: false
|
|
47395
|
+
});
|
|
47396
|
+
s$3.Map.addInitHook("addHandler", "selectArea", s$3.Map.SelectArea);
|
|
47397
|
+
const l = s$3.Map.SelectArea;
|
|
47398
|
+
|
|
47399
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
47400
|
+
__proto__: null,
|
|
47401
|
+
default: l
|
|
47402
|
+
});
|
|
47403
|
+
|
|
47404
|
+
leafletSrcExports.SVG.include({
|
|
47405
|
+
/**
|
|
47406
|
+
* Reset transform matrix
|
|
47407
|
+
*/
|
|
47408
|
+
_resetTransformPath: function(t) {
|
|
47409
|
+
t._path.setAttributeNS(null, "transform", "");
|
|
47410
|
+
},
|
|
47411
|
+
/**
|
|
47412
|
+
* Applies matrix transformation to SVG
|
|
47413
|
+
* @param {L.Path} layer
|
|
47414
|
+
* @param {Array.<Number>} matrix
|
|
47415
|
+
*/
|
|
47416
|
+
transformPath: function(t, i) {
|
|
47417
|
+
t._path.setAttributeNS(
|
|
47418
|
+
null,
|
|
47419
|
+
"transform",
|
|
47420
|
+
"matrix(" + i.join(" ") + ")"
|
|
47421
|
+
);
|
|
47422
|
+
}
|
|
47423
|
+
});
|
|
47424
|
+
leafletSrcExports.SVG.include(
|
|
47425
|
+
leafletSrcExports.Browser.vml ? {
|
|
47426
|
+
/**
|
|
47427
|
+
* Reset transform matrix
|
|
47428
|
+
*/
|
|
47429
|
+
_resetTransformPath: function(t) {
|
|
47430
|
+
t._skew && (t._skew.on = false, t._path.removeChild(t._skew), t._skew = null);
|
|
47431
|
+
},
|
|
47432
|
+
/**
|
|
47433
|
+
* Applies matrix transformation to VML
|
|
47434
|
+
* @param {L.Path} layer
|
|
47435
|
+
* @param {Array.<Number>} matrix
|
|
47436
|
+
*/
|
|
47437
|
+
transformPath: function(t, i) {
|
|
47438
|
+
let n = t._skew;
|
|
47439
|
+
n || (n = leafletSrcExports.SVG.create("skew"), t._path.appendChild(n), n.style.behavior = "url(#default#VML)", t._skew = n);
|
|
47440
|
+
const a = i[0].toFixed(8) + " " + i[1].toFixed(8) + " " + i[2].toFixed(8) + " " + i[3].toFixed(8) + " 0 0", r = Math.floor(i[4]).toFixed() + ", " + Math.floor(i[5]).toFixed(), s = this._path.style;
|
|
47441
|
+
let e = parseFloat(s.left), o = parseFloat(s.top), _ = parseFloat(s.width), p = parseFloat(s.height);
|
|
47442
|
+
isNaN(e) && (e = 0), isNaN(o) && (o = 0), (isNaN(_) || !_) && (_ = 1), (isNaN(p) || !p) && (p = 1);
|
|
47443
|
+
const u = (-e / _ - 0.5).toFixed(8) + " " + (-o / p - 0.5).toFixed(8);
|
|
47444
|
+
n.on = "f", n.matrix = a, n.origin = u, n.offset = r, n.on = true;
|
|
47445
|
+
}
|
|
47446
|
+
} : {}
|
|
47447
|
+
);
|
|
47448
|
+
function E() {
|
|
47449
|
+
return true;
|
|
47450
|
+
}
|
|
47451
|
+
leafletSrcExports.Canvas.include({
|
|
47452
|
+
/**
|
|
47453
|
+
* Do nothing
|
|
47454
|
+
* @param {L.Path} layer
|
|
47455
|
+
*/
|
|
47456
|
+
_resetTransformPath: function(t) {
|
|
47457
|
+
this._containerCopy && (delete this._containerCopy, t._containsPoint_ && (t._containsPoint = t._containsPoint_, delete t._containsPoint_, this._requestRedraw(t)));
|
|
47458
|
+
},
|
|
47459
|
+
/**
|
|
47460
|
+
* Algorithm outline:
|
|
47461
|
+
*
|
|
47462
|
+
* 1. pre-transform - clear the path out of the canvas, copy canvas state
|
|
47463
|
+
* 2. at every frame:
|
|
47464
|
+
* 2.1. save
|
|
47465
|
+
* 2.2. redraw the canvas from saved one
|
|
47466
|
+
* 2.3. transform
|
|
47467
|
+
* 2.4. draw path
|
|
47468
|
+
* 2.5. restore
|
|
47469
|
+
* 3. Repeat
|
|
47470
|
+
*
|
|
47471
|
+
* @param {L.Path} layer
|
|
47472
|
+
* @param {Array.<Number>} matrix
|
|
47473
|
+
*/
|
|
47474
|
+
transformPath: function(t, i) {
|
|
47475
|
+
let n = this._containerCopy;
|
|
47476
|
+
const a = this._ctx;
|
|
47477
|
+
let r;
|
|
47478
|
+
const s = leafletSrcExports.Browser.retina ? 2 : 1, e = this._bounds, o = e.getSize(), _ = e.min;
|
|
47479
|
+
n || (n = this._containerCopy = document.createElement("canvas"), r = n.getContext("2d"), n.width = s * o.x, n.height = s * o.y, this._removePath(t), this._redraw(), r.translate(s * e.min.x, s * e.min.y), r.drawImage(this._container, 0, 0), this._initPath(t), t._containsPoint_ = t._containsPoint, t._containsPoint = E), a.save(), a.clearRect(_.x, _.y, o.x * s, o.y * s), a.setTransform(1, 0, 0, 1, 0, 0), a.restore(), a.save(), a.drawImage(this._containerCopy, 0, 0, o.x, o.y), a.transform.apply(a, i), this._drawing = true, t._updatePath(), this._drawing = false, a.restore();
|
|
47480
|
+
}
|
|
47481
|
+
});
|
|
47482
|
+
/**
|
|
47483
|
+
* Leaflet vector features drag functionality
|
|
47484
|
+
* @author Alexander Milevski <info@w8r.name>
|
|
47485
|
+
* @preserve
|
|
47486
|
+
*/
|
|
47487
|
+
leafletSrcExports.Path.include({
|
|
47488
|
+
/**
|
|
47489
|
+
* Applies matrix transformation to SVG
|
|
47490
|
+
* @param {Array.<Number>?} matrix
|
|
47491
|
+
*/
|
|
47492
|
+
_transform: function(t) {
|
|
47493
|
+
return this._renderer && (t ? this._renderer.transformPath(this, t) : (this._renderer._resetTransformPath(this), this._update())), this;
|
|
47494
|
+
},
|
|
47495
|
+
/**
|
|
47496
|
+
* Check if the feature was dragged, that'll supress the click event
|
|
47497
|
+
* on mouseup. That fixes popups for example
|
|
47498
|
+
*
|
|
47499
|
+
* @param {MouseEvent} e
|
|
47500
|
+
*/
|
|
47501
|
+
_onMouseClick: function(t) {
|
|
47502
|
+
this.dragging && this.dragging.moved() || this._map.dragging && this._map.dragging.moved() || this._fireMouseEvent(t);
|
|
47503
|
+
}
|
|
47504
|
+
});
|
|
47505
|
+
const S = {
|
|
47506
|
+
mousedown: "mouseup",
|
|
47507
|
+
touchstart: "touchend",
|
|
47508
|
+
pointerdown: "touchend",
|
|
47509
|
+
MSPointerDown: "touchend"
|
|
47510
|
+
}, M = {
|
|
47511
|
+
mousedown: "mousemove",
|
|
47512
|
+
touchstart: "touchmove",
|
|
47513
|
+
pointerdown: "touchmove",
|
|
47514
|
+
MSPointerDown: "touchmove"
|
|
47515
|
+
};
|
|
47516
|
+
function k(t, i) {
|
|
47517
|
+
const n = t.x - i.x, a = t.y - i.y;
|
|
47518
|
+
return Math.sqrt(n * n + a * a);
|
|
47519
|
+
}
|
|
47520
|
+
leafletSrcExports.Handler.PathDrag = leafletSrcExports.Handler.extend(
|
|
47521
|
+
/** @lends L.Path.Drag.prototype */
|
|
47522
|
+
{
|
|
47523
|
+
statics: {
|
|
47524
|
+
DRAGGING_CLS: "leaflet-path-draggable"
|
|
47525
|
+
},
|
|
47526
|
+
/**
|
|
47527
|
+
* @param {L.Path} path
|
|
47528
|
+
* @constructor
|
|
47529
|
+
*/
|
|
47530
|
+
initialize: function(t) {
|
|
47531
|
+
this._path = t, this._matrix = null, this._startPoint = null, this._dragStartPoint = null, this._mapDraggingWasEnabled = false, this._path._dragMoved = false;
|
|
47532
|
+
},
|
|
47533
|
+
/**
|
|
47534
|
+
* Enable dragging
|
|
47535
|
+
*/
|
|
47536
|
+
addHooks: function() {
|
|
47537
|
+
this._path.on("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className ? this._path.options.className + " " + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS : leafletSrcExports.Handler.PathDrag.DRAGGING_CLS, this._path._path && leafletSrcExports.DomUtil.addClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
|
|
47538
|
+
},
|
|
47539
|
+
/**
|
|
47540
|
+
* Disable dragging
|
|
47541
|
+
*/
|
|
47542
|
+
removeHooks: function() {
|
|
47543
|
+
this._path.off("mousedown", this._onDragStart, this), this._path.options.className = this._path.options.className.replace(
|
|
47544
|
+
new RegExp("\\s+" + leafletSrcExports.Handler.PathDrag.DRAGGING_CLS),
|
|
47545
|
+
""
|
|
47546
|
+
), this._path._path && leafletSrcExports.DomUtil.removeClass(this._path._path, leafletSrcExports.Handler.PathDrag.DRAGGING_CLS);
|
|
47547
|
+
},
|
|
47548
|
+
/**
|
|
47549
|
+
* @return {Boolean}
|
|
47550
|
+
*/
|
|
47551
|
+
moved: function() {
|
|
47552
|
+
return this._path._dragMoved;
|
|
47553
|
+
},
|
|
47554
|
+
/**
|
|
47555
|
+
* Start drag
|
|
47556
|
+
* @param {L.MouseEvent} evt
|
|
47557
|
+
*/
|
|
47558
|
+
_onDragStart: function(t) {
|
|
47559
|
+
const i = t.originalEvent._simulated ? "touchstart" : t.originalEvent.type;
|
|
47560
|
+
this._mapDraggingWasEnabled = false, this._startPoint = t.containerPoint.clone(), this._dragStartPoint = t.containerPoint.clone(), this._matrix = [1, 0, 0, 1, 0, 0], leafletSrcExports.DomEvent.stop(t.originalEvent), leafletSrcExports.DomUtil.addClass(this._path._renderer._container, "leaflet-interactive"), leafletSrcExports.DomEvent.on(document, M[i], this._onDrag, this).on(
|
|
47561
|
+
document,
|
|
47562
|
+
S[i],
|
|
47563
|
+
this._onDragEnd,
|
|
47564
|
+
this
|
|
47565
|
+
), this._path._map.dragging.enabled() && (this._path._map.dragging.disable(), this._mapDraggingWasEnabled = true), this._path._dragMoved = false, this._path._popup && this._path._popup.close(), this._replaceCoordGetters(t);
|
|
47566
|
+
},
|
|
47567
|
+
/**
|
|
47568
|
+
* Dragging
|
|
47569
|
+
* @param {L.MouseEvent} evt
|
|
47570
|
+
*/
|
|
47571
|
+
_onDrag: function(t) {
|
|
47572
|
+
leafletSrcExports.DomEvent.stop(t);
|
|
47573
|
+
const i = t.touches && t.touches.length >= 1 ? t.touches[0] : t, n = this._path._map.mouseEventToContainerPoint(i);
|
|
47574
|
+
if (t.type === "touchmove" && !this._path._dragMoved && this._dragStartPoint.distanceTo(n) <= this._path._map.options.tapTolerance)
|
|
47575
|
+
return;
|
|
47576
|
+
const a = n.x, r = n.y, s = a - this._startPoint.x, e = r - this._startPoint.y;
|
|
47577
|
+
(s || e) && (this._path._dragMoved || (this._path._dragMoved = true, this._path.options.interactive = false, this._path._map.dragging._draggable._moved = true, this._path.fire("dragstart", t), this._path.bringToFront()), this._matrix[4] += s, this._matrix[5] += e, this._startPoint.x = a, this._startPoint.y = r, this._path.fire("predrag", t), this._path._transform(this._matrix), this._path.fire("drag", t));
|
|
47578
|
+
},
|
|
47579
|
+
/**
|
|
47580
|
+
* Dragging stopped, apply
|
|
47581
|
+
* @param {L.MouseEvent} evt
|
|
47582
|
+
*/
|
|
47583
|
+
_onDragEnd: function(t) {
|
|
47584
|
+
const i = this._path._map.mouseEventToContainerPoint(t), n = this.moved();
|
|
47585
|
+
if (n && (this._transformPoints(this._matrix), this._path._updatePath(), this._path._project(), this._path._transform(null), leafletSrcExports.DomEvent.stop(t)), leafletSrcExports.DomEvent.off(document, "mousemove touchmove", this._onDrag, this), leafletSrcExports.DomEvent.off(document, "mouseup touchend", this._onDragEnd, this), this._restoreCoordGetters(), n) {
|
|
47586
|
+
this._path.fire("dragend", {
|
|
47587
|
+
distance: k(this._dragStartPoint, i)
|
|
47588
|
+
});
|
|
47589
|
+
const a = this._path._containsPoint;
|
|
47590
|
+
this._path._containsPoint = leafletSrcExports.Util.falseFn, leafletSrcExports.Util.requestAnimFrame(function() {
|
|
47591
|
+
this._path._dragMoved = false, this._path.options.interactive = true, this._path._containsPoint = a;
|
|
47592
|
+
}, this);
|
|
47593
|
+
}
|
|
47594
|
+
this._mapDraggingWasEnabled && this._path._map.dragging.enable();
|
|
47595
|
+
},
|
|
47596
|
+
/**
|
|
47597
|
+
* Applies transformation, does it in one sweep for performance,
|
|
47598
|
+
* so don't be surprised about the code repetition.
|
|
47599
|
+
*
|
|
47600
|
+
* [ x ] [ a b tx ] [ x ] [ a * x + b * y + tx ]
|
|
47601
|
+
* [ y ] = [ c d ty ] [ y ] = [ c * x + d * y + ty ]
|
|
47602
|
+
*
|
|
47603
|
+
* @param {Array.<Number>} matrix
|
|
47604
|
+
*/
|
|
47605
|
+
_transformPoints: function(t, i) {
|
|
47606
|
+
const n = this._path, a = L.point(t[4], t[5]), r = n._map.options.crs, s = r.transformation, e = r.scale(n._map.getZoom()), o = r.projection, _ = s.untransform(a, e).subtract(s.untransform(leafletSrcExports.point(0, 0), e)), p = !i;
|
|
47607
|
+
if (n._bounds = new leafletSrcExports.LatLngBounds(), n._point)
|
|
47608
|
+
i = o.unproject(
|
|
47609
|
+
o.project(n._latlng)._add(_)
|
|
47610
|
+
), p && (n._latlng = i, n._point._add(a));
|
|
47611
|
+
else if (n._rings || n._parts) {
|
|
47612
|
+
const u = n._rings || n._parts;
|
|
47613
|
+
let c = n._latlngs;
|
|
47614
|
+
i = i || c, leafletSrcExports.Util.isArray(c[0]) || (c = [c], i = [i]);
|
|
47615
|
+
for (let g = 0, w = u.length; g < w; g++) {
|
|
47616
|
+
i[g] = i[g] || [];
|
|
47617
|
+
for (let d = 0, v = u[g].length; d < v; d++) {
|
|
47618
|
+
const b = c[g][d];
|
|
47619
|
+
i[g][d] = o.unproject(
|
|
47620
|
+
o.project(b)._add(_)
|
|
47621
|
+
), p && (n._bounds.extend(c[g][d]), u[g][d]._add(a));
|
|
47622
|
+
}
|
|
47623
|
+
}
|
|
47624
|
+
}
|
|
47625
|
+
return i;
|
|
47626
|
+
},
|
|
47627
|
+
/**
|
|
47628
|
+
* If you want to read the latlngs during the drag - your right,
|
|
47629
|
+
* but they have to be transformed
|
|
47630
|
+
*/
|
|
47631
|
+
_replaceCoordGetters: function() {
|
|
47632
|
+
this._path.getLatLng ? (this._path.getLatLng_ = this._path.getLatLng, this._path.getLatLng = leafletSrcExports.Util.bind(function() {
|
|
47633
|
+
return this.dragging._transformPoints(this.dragging._matrix, {});
|
|
47634
|
+
}, this._path)) : this._path.getLatLngs && (this._path.getLatLngs_ = this._path.getLatLngs, this._path.getLatLngs = leafletSrcExports.Util.bind(function() {
|
|
47635
|
+
return this.dragging._transformPoints(this.dragging._matrix, []);
|
|
47636
|
+
}, this._path));
|
|
47637
|
+
},
|
|
47638
|
+
/**
|
|
47639
|
+
* Put back the getters
|
|
47640
|
+
*/
|
|
47641
|
+
_restoreCoordGetters: function() {
|
|
47642
|
+
this._path.getLatLng_ ? (this._path.getLatLng = this._path.getLatLng_, delete this._path.getLatLng_) : this._path.getLatLngs_ && (this._path.getLatLngs = this._path.getLatLngs_, delete this._path.getLatLngs_);
|
|
47643
|
+
}
|
|
47644
|
+
}
|
|
47645
|
+
);
|
|
47646
|
+
leafletSrcExports.Handler.PathDrag.makeDraggable = function(t) {
|
|
47647
|
+
return t.dragging = new leafletSrcExports.Handler.PathDrag(t), t;
|
|
47648
|
+
};
|
|
47649
|
+
leafletSrcExports.Path.prototype.makeDraggable = function() {
|
|
47650
|
+
return leafletSrcExports.Handler.PathDrag.makeDraggable(this);
|
|
47651
|
+
};
|
|
47652
|
+
leafletSrcExports.Path.addInitHook(function() {
|
|
47653
|
+
this.options.draggable ? (this.options.interactive = true, this.dragging ? this.dragging.enable() : (leafletSrcExports.Handler.PathDrag.makeDraggable(this), this.dragging.enable())) : this.dragging && this.dragging.disable();
|
|
47654
|
+
});
|
|
47655
|
+
const T = leafletSrcExports.Handler.PathDrag;
|
|
47656
|
+
|
|
47657
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
47658
|
+
__proto__: null,
|
|
47659
|
+
default: T
|
|
47660
|
+
});
|
|
47661
|
+
|
|
47662
|
+
var leafletArrows$2 = {exports: {}};
|
|
47663
|
+
|
|
47664
|
+
var hasRequiredLeafletArrows;
|
|
47665
|
+
|
|
47666
|
+
function requireLeafletArrows () {
|
|
47667
|
+
if (hasRequiredLeafletArrows) return leafletArrows$2.exports;
|
|
47668
|
+
hasRequiredLeafletArrows = 1;
|
|
47669
|
+
(function (module, exports$1) {
|
|
47670
|
+
// Leaflet Arrows by Meteotest
|
|
47671
|
+
// https://github.com/meteotest/leaflet-arrows
|
|
47672
|
+
// Module Loader Boilerplate
|
|
47673
|
+
(function (factory, window) {
|
|
47674
|
+
// define an AMD module that relies on 'leaflet'
|
|
47675
|
+
{
|
|
47676
|
+
module.exports = factory(requireLeafletSrc());
|
|
47677
|
+
}
|
|
47678
|
+
// attach your plugin to the global 'L' variable
|
|
47679
|
+
if (typeof window !== 'undefined' && window.L) {
|
|
47680
|
+
window.L.Arrow = factory(L);
|
|
47681
|
+
}
|
|
47682
|
+
})(function (L) {
|
|
47683
|
+
// beware! the arrow factory
|
|
47684
|
+
const Arrow = L.FeatureGroup.extend({
|
|
47685
|
+
options: {
|
|
47686
|
+
distanceUnit: 'km', // can be [px,km]
|
|
47687
|
+
stretchFactor: 1, // should the distance be stretched?
|
|
47688
|
+
arrowheadLength: 4, // in distance unit
|
|
47689
|
+
arrowheadClosingLine: false, // should a closing third line be drawn?
|
|
47690
|
+
arrowheadDegree: 155, // degree of arrowhead
|
|
47691
|
+
clickableWidth: 10, // defines the width in pixels of the "phantom" path to capture click events on a line
|
|
47692
|
+
//optional: popupContent: function(data) {},
|
|
47693
|
+
// add your own custom validator, probably not needed...
|
|
47694
|
+
// the validator gets the bound data object as argument
|
|
47695
|
+
validator: function (data) {
|
|
47696
|
+
return (typeof data.latlng !== 'undefined' &&
|
|
47697
|
+
typeof data.distance !== 'undefined' &&
|
|
47698
|
+
!isNaN(data.distance));
|
|
47699
|
+
}, // validator is a callback function that takes the data object of the current point and returns whether it is 'valid'. Invalid arrows will be drawn gray
|
|
47700
|
+
colorScheme: function () {
|
|
47701
|
+
return this.color;
|
|
47702
|
+
}, // add own colorscheme callback
|
|
47703
|
+
circleRadiusInvalidPoint: 1000, // Radius of the circle to display missing or '0'-value
|
|
47704
|
+
// path options
|
|
47705
|
+
color: '#333',
|
|
47706
|
+
opacity: 0.9, // stroke opacity
|
|
47707
|
+
fillOpacity: 0.9,
|
|
47708
|
+
weight: 4, // the width of the arrow
|
|
47709
|
+
smoothFactor: 0,
|
|
47710
|
+
radius: 5, // default radius, when distance is 0
|
|
47711
|
+
defaultPointOptions: {
|
|
47712
|
+
stroke: false,
|
|
47713
|
+
fillOpacity: 0.8,
|
|
47714
|
+
fillColor: '#111',
|
|
47715
|
+
radius: 7,
|
|
47716
|
+
},
|
|
47717
|
+
invalidPointOptions: {
|
|
47718
|
+
stroke: false,
|
|
47719
|
+
fillOpacity: 0.8,
|
|
47720
|
+
fillColor: 'red',
|
|
47721
|
+
radius: 7,
|
|
47722
|
+
},
|
|
47723
|
+
drawSourceMarker: false,
|
|
47724
|
+
sourceMarkerOptions: {
|
|
47725
|
+
stroke: false,
|
|
47726
|
+
fillOpacity: 1,
|
|
47727
|
+
fillColor: '#333',
|
|
47728
|
+
radius: 5,
|
|
47729
|
+
},
|
|
47730
|
+
},
|
|
47731
|
+
/**
|
|
47732
|
+
* The data opject needs at least following properties:
|
|
47733
|
+
* - latlng : L.LatLng
|
|
47734
|
+
* - degree : float
|
|
47735
|
+
* - distance: float
|
|
47736
|
+
*/
|
|
47737
|
+
initialize: function (data, options) {
|
|
47738
|
+
L.Util.setOptions(this, options);
|
|
47739
|
+
this.setData(data);
|
|
47740
|
+
},
|
|
47741
|
+
onAdd: function (map) {
|
|
47742
|
+
this._map = map;
|
|
47743
|
+
this.redraw();
|
|
47744
|
+
// add a viewreset event listener for updating layer's position
|
|
47745
|
+
map.on('viewreset', this._reset, this);
|
|
47746
|
+
},
|
|
47747
|
+
onRemove: function () {
|
|
47748
|
+
// remove layer's DOM elements and listeners
|
|
47749
|
+
for (const i in this._layers) {
|
|
47750
|
+
if (this._layers.hasOwnProperty(i)) {
|
|
47751
|
+
this._map.removeLayer(this._layers[i]);
|
|
47752
|
+
}
|
|
47753
|
+
}
|
|
47754
|
+
if (typeof this._sourceMarker !== 'undefined') {
|
|
47755
|
+
this._map.removeLayer(this._sourceMarker);
|
|
47756
|
+
}
|
|
47757
|
+
this._map.off('viewreset', this._reset, this);
|
|
47758
|
+
},
|
|
47759
|
+
// draw
|
|
47760
|
+
redraw: function () {
|
|
47761
|
+
// only draw when on map
|
|
47762
|
+
if (!this._map) {
|
|
47763
|
+
return;
|
|
47764
|
+
}
|
|
47765
|
+
this._layers = {};
|
|
47766
|
+
// bind popup to the whole feature group
|
|
47767
|
+
if (typeof this.options.popupContent === 'function') {
|
|
47768
|
+
this.bindPopup(this.options.popupContent(this._data));
|
|
47769
|
+
}
|
|
47770
|
+
if (this._data.valid && typeof this.options.colorScheme === 'function') {
|
|
47771
|
+
this.options.color = this.options.colorScheme(this._data);
|
|
47772
|
+
}
|
|
47773
|
+
this._data.distance = parseFloat(this._data.distance);
|
|
47774
|
+
// if distance or degree is falsy/Zero then draw a point instead of an arrow
|
|
47775
|
+
if (!this._data.valid || !this._data.distance || !this._data.angle) {
|
|
47776
|
+
let circle;
|
|
47777
|
+
const pathOptions = this._data.valid
|
|
47778
|
+
? this.options.defaultPointOptions
|
|
47779
|
+
: this.options.invalidPointOptions;
|
|
47780
|
+
if (this.options.distanceUnit.toLowerCase() === 'km') {
|
|
47781
|
+
// use a tenth of the supplied radius (usally used in the circlemarker)
|
|
47782
|
+
circle = L.circle(this._data.latlng, this.options.radius / 10, pathOptions);
|
|
47783
|
+
}
|
|
47784
|
+
else {
|
|
47785
|
+
circle = L.circleMarker(this._data.latlng, pathOptions);
|
|
47786
|
+
}
|
|
47787
|
+
this.addLayer(circle);
|
|
47788
|
+
}
|
|
47789
|
+
else {
|
|
47790
|
+
const theLine = [
|
|
47791
|
+
this._data.latlng,
|
|
47792
|
+
this._calculateEndPoint(this._data.latlng, this._data.distance, this._data.angle),
|
|
47793
|
+
];
|
|
47794
|
+
const theArrow = this._calculateArrowArray(theLine[1]);
|
|
47795
|
+
const backgroundPathOption = L.Util.setOptions({}, this.pathOptions);
|
|
47796
|
+
backgroundPathOption.opacity = 0;
|
|
47797
|
+
backgroundPathOption.weight = this.options.clickableWidth;
|
|
47798
|
+
const invisibleBackgroundPolyline = new L.Polyline([theLine, theArrow], backgroundPathOption);
|
|
47799
|
+
const polyline = new L.Polyline([theLine, theArrow], this.options);
|
|
47800
|
+
this.addLayer(invisibleBackgroundPolyline);
|
|
47801
|
+
this.addLayer(polyline);
|
|
47802
|
+
// that special case, where a circle has to be drawn on the source of the arrow
|
|
47803
|
+
if (this.options.drawSourceMarker) {
|
|
47804
|
+
if (typeof this._sourceMarker === 'undefined') {
|
|
47805
|
+
// use the same coloar as the arrow does
|
|
47806
|
+
this.options.sourceMarkerOptions.fillColor = this.color;
|
|
47807
|
+
this._sourceMarker = L.circleMarker(this._data.latlng, this.options.sourceMarkerOptions);
|
|
47808
|
+
}
|
|
47809
|
+
else {
|
|
47810
|
+
// there is a chance, that the latlng values have been changed by the setData-function
|
|
47811
|
+
this._sourceMarker.setLatLng(this._data.latlng);
|
|
47812
|
+
}
|
|
47813
|
+
}
|
|
47814
|
+
}
|
|
47815
|
+
},
|
|
47816
|
+
// custom methods
|
|
47817
|
+
// just change the angle of the arrow
|
|
47818
|
+
setAngle: function (angle) {
|
|
47819
|
+
if (isNaN(angle)) {
|
|
47820
|
+
this._data.angle = 0; // undefined direction.
|
|
47821
|
+
}
|
|
47822
|
+
else {
|
|
47823
|
+
if (this.options.isWindDegree) {
|
|
47824
|
+
this._data.angle = angle - 180;
|
|
47825
|
+
if (this.options.distanceUnit.toLowerCase() === 'px') {
|
|
47826
|
+
this._data.angle -= 90;
|
|
47827
|
+
}
|
|
47828
|
+
}
|
|
47829
|
+
else {
|
|
47830
|
+
this._data.angle = angle;
|
|
47831
|
+
}
|
|
47832
|
+
}
|
|
47833
|
+
this.redraw();
|
|
47834
|
+
},
|
|
47835
|
+
// just change the length of the arrow
|
|
47836
|
+
setDistance: function (distance) {
|
|
47837
|
+
if (isNaN(distance)) {
|
|
47838
|
+
this._data.distance = 0;
|
|
47839
|
+
}
|
|
47840
|
+
else {
|
|
47841
|
+
this._data.distance = parseFloat(distance);
|
|
47842
|
+
}
|
|
47843
|
+
this.redraw();
|
|
47844
|
+
},
|
|
47845
|
+
// use this method to update the whole dataset that corresponds to the arrow
|
|
47846
|
+
setData: function (data) {
|
|
47847
|
+
this._data = data;
|
|
47848
|
+
if (this.options.validator(this._data)) {
|
|
47849
|
+
this._data.valid = true;
|
|
47850
|
+
this.setAngle(data.degree);
|
|
47851
|
+
}
|
|
47852
|
+
else {
|
|
47853
|
+
this._data.valid = false;
|
|
47854
|
+
this._data.distance = NaN;
|
|
47855
|
+
this._data.degree = NaN;
|
|
47856
|
+
}
|
|
47857
|
+
},
|
|
47858
|
+
// private methods
|
|
47859
|
+
// When using Screen Pixels as unit, the arrows have to be
|
|
47860
|
+
// recalculated after the zoom level has changed
|
|
47861
|
+
_reset: function () {
|
|
47862
|
+
if (this.options.distanceUnit.toLowerCase() === 'px') {
|
|
47863
|
+
this.redraw();
|
|
47864
|
+
}
|
|
47865
|
+
},
|
|
47866
|
+
_calculateEndPoint: function (latlng, dist, degree) {
|
|
47867
|
+
/*
|
|
47868
|
+
* http://www.codeguru.com/cpp/cpp/algorithms/article.php/c5115/Geographic-Distance-and-Azimuth-Calculations.htm
|
|
47869
|
+
*/
|
|
47870
|
+
// don't use this._data here.
|
|
47871
|
+
// this function is also used to find the points of the arrow
|
|
47872
|
+
let distance = dist * this.options.stretchFactor, d2r = Math.PI / 180, // degree 2 radius
|
|
47873
|
+
r2d = 180 / Math.PI;
|
|
47874
|
+
if (this.options.distanceUnit.toLowerCase() === 'km') {
|
|
47875
|
+
const R = 6378.137, // earth radius in kmeters
|
|
47876
|
+
bearing = degree * d2r;
|
|
47877
|
+
distance = distance / R;
|
|
47878
|
+
const a = Math.acos(Math.cos(distance) * Math.cos((90 - latlng.lat) * d2r) +
|
|
47879
|
+
Math.sin((90 - latlng.lat) * d2r) *
|
|
47880
|
+
Math.sin(distance) *
|
|
47881
|
+
Math.cos(bearing));
|
|
47882
|
+
const B = Math.asin((Math.sin(distance) * Math.sin(bearing)) / Math.sin(a));
|
|
47883
|
+
return new L.LatLng(90 - a * r2d, B * r2d + latlng.lng);
|
|
47884
|
+
}
|
|
47885
|
+
else if (this.options.distanceUnit.toLowerCase() === 'px') {
|
|
47886
|
+
const sourcePoint = this._map.latLngToLayerPoint(latlng);
|
|
47887
|
+
const rad = degree * d2r;
|
|
47888
|
+
const vector = L.point(Math.cos(rad) * distance, Math.sin(rad) * distance);
|
|
47889
|
+
const targetPoint = sourcePoint.add(vector);
|
|
47890
|
+
return this._map.layerPointToLatLng(targetPoint);
|
|
47891
|
+
}
|
|
47892
|
+
else {
|
|
47893
|
+
throw Error('calculate end point undefined for distanceUnit: ' +
|
|
47894
|
+
this.options.distanceUnit);
|
|
47895
|
+
}
|
|
47896
|
+
},
|
|
47897
|
+
_calculateArrowArray: function (latlng) {
|
|
47898
|
+
// calculates the Array for the arrow
|
|
47899
|
+
// latlng is the position, where the arrow is added
|
|
47900
|
+
const degree = this._data.angle;
|
|
47901
|
+
if (latlng.length !== undefined) {
|
|
47902
|
+
latlng = new L.LatLng(latlng);
|
|
47903
|
+
}
|
|
47904
|
+
const firstEdge = this._calculateEndPoint(latlng, this.options.arrowheadLength, degree - this.options.arrowheadDegree);
|
|
47905
|
+
const arr = [
|
|
47906
|
+
firstEdge,
|
|
47907
|
+
latlng,
|
|
47908
|
+
this._calculateEndPoint(latlng, this.options.arrowheadLength, degree + this.options.arrowheadDegree),
|
|
47909
|
+
];
|
|
47910
|
+
if (this.options.arrowheadClosingLine) {
|
|
47911
|
+
arr.push(firstEdge);
|
|
47912
|
+
}
|
|
47913
|
+
return arr;
|
|
47914
|
+
},
|
|
47915
|
+
});
|
|
47916
|
+
return Arrow;
|
|
47917
|
+
}, window);
|
|
47918
|
+
|
|
47919
|
+
} (leafletArrows$2));
|
|
47920
|
+
return leafletArrows$2.exports;
|
|
47921
|
+
}
|
|
47922
|
+
|
|
47923
|
+
var leafletArrowsExports = requireLeafletArrows();
|
|
47924
|
+
var leafletArrows = /*@__PURE__*/getDefaultExportFromCjs(leafletArrowsExports);
|
|
47925
|
+
|
|
47926
|
+
var leafletArrows$1 = /*#__PURE__*/_mergeNamespaces({
|
|
47927
|
+
__proto__: null,
|
|
47928
|
+
default: leafletArrows
|
|
47929
|
+
}, [leafletArrowsExports]);
|
|
47930
|
+
|
|
46892
47931
|
exports.Accordion = Accordion;
|
|
46893
47932
|
exports.AlertDialog = alertDialog;
|
|
46894
47933
|
exports.AlertStore = AlertStore;
|