From a7b7b5f1f85bd30b171e17056bf9ae9830fb36cb Mon Sep 17 00:00:00 2001 From: chenyabin <Chenab123!> Date: 星期四, 08 四月 2021 17:22:25 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop --- src/components/plugin/MeaSure.js | 340 ++-- .gitignore | 2 src/components/panel/BaseNavMenuItem.vue | 118 src/assets/css/map/map-panel-style.less | 6 src/components/plugin/MakeTation.js | 250 ++-- src/components/plugin/DownLoad.js | 1410 +++++++++++----------- src/components/plugin/leaflet-measure-path/leaflet-measure-path.css | 44 /dev/null | 0 src/components/LayerController/service/WfsLayerService.js | 6 src/conf/Constants.js | 2 src/components/plugin/leaflet-measure-path/leaflet-measure-path.js | 840 ++++++------ src/components/panel/bounced/TextBounced.vue | 262 ++-- src/components/plugin/FullScreen.js | 350 ++-- 13 files changed, 1,815 insertions(+), 1,815 deletions(-) diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 85bb87e..0000000 --- a/.DS_Store +++ /dev/null Binary files differ diff --git a/.gitignore b/.gitignore index cc27dc9..3ba1c88 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,4 @@ .DS_Store package-lock.json .idea -.dist +/dist diff --git a/public/assets/.DS_Store b/public/assets/.DS_Store deleted file mode 100644 index 66f4848..0000000 --- a/public/assets/.DS_Store +++ /dev/null Binary files differ diff --git a/public/assets/images/.DS_Store b/public/assets/images/.DS_Store deleted file mode 100644 index 7554b5e..0000000 --- a/public/assets/images/.DS_Store +++ /dev/null Binary files differ diff --git a/public/assets/images/map-pages/.DS_Store b/public/assets/images/map-pages/.DS_Store deleted file mode 100644 index a039990..0000000 --- a/public/assets/images/map-pages/.DS_Store +++ /dev/null Binary files differ diff --git a/public/assets/images/map-pages/icon/.DS_Store b/public/assets/images/map-pages/icon/.DS_Store deleted file mode 100644 index 4911e55..0000000 --- a/public/assets/images/map-pages/icon/.DS_Store +++ /dev/null Binary files differ diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index c521892..0000000 --- a/src/.DS_Store +++ /dev/null Binary files differ diff --git a/src/assets/.DS_Store b/src/assets/.DS_Store deleted file mode 100644 index 66f4848..0000000 --- a/src/assets/.DS_Store +++ /dev/null Binary files differ diff --git a/src/assets/css/map/map-panel-style.less b/src/assets/css/map/map-panel-style.less index 494c67d..48fc68b 100644 --- a/src/assets/css/map/map-panel-style.less +++ b/src/assets/css/map/map-panel-style.less @@ -321,15 +321,15 @@ list-style: none; margin: 0; padding: 0; - width: 260px; - display: flex; + //width: 260px; + //display: flex; flex-wrap: wrap; } .company-bindTooltip-hover ul li { margin: 0; padding: 3px 0; - width: 50%; + //width: 50%; } /*************** PublicTable 琛ㄦ牸鏍峰紡銆�*********************************/ diff --git a/src/assets/images/.DS_Store b/src/assets/images/.DS_Store deleted file mode 100644 index 7554b5e..0000000 --- a/src/assets/images/.DS_Store +++ /dev/null Binary files differ diff --git a/src/assets/images/map-pages/.DS_Store b/src/assets/images/map-pages/.DS_Store deleted file mode 100644 index a039990..0000000 --- a/src/assets/images/map-pages/.DS_Store +++ /dev/null Binary files differ diff --git a/src/assets/images/map-pages/icon/.DS_Store b/src/assets/images/map-pages/icon/.DS_Store deleted file mode 100644 index 4911e55..0000000 --- a/src/assets/images/map-pages/icon/.DS_Store +++ /dev/null Binary files differ diff --git a/src/components/LayerController/service/WfsLayerService.js b/src/components/LayerController/service/WfsLayerService.js index 3aae541..b263e46 100644 --- a/src/components/LayerController/service/WfsLayerService.js +++ b/src/components/LayerController/service/WfsLayerService.js @@ -45,9 +45,9 @@ fillColor: STYLES.FILL_COLOR, color: STYLES.COLOR, fillOpacity: STYLES.FILL_OPACITY, - opacity: STYLES.OPACITY, - dashArray: STYLES.DASH_ARRAY, - dashSpeed: STYLES.DASH_SPPED + opacity: STYLES.OPACITY + // dashArray: STYLES.DASH_ARRAY, + // dashSpeed: STYLES.DASH_SPPED } }, pointToLayer: (geoJsonPoint, latlng) => { diff --git a/src/components/panel/BaseNavMenuItem.vue b/src/components/panel/BaseNavMenuItem.vue index 9b497ae..a525ec4 100644 --- a/src/components/panel/BaseNavMenuItem.vue +++ b/src/components/panel/BaseNavMenuItem.vue @@ -1,59 +1,59 @@ -<template> - <div class="base-nav-menu"> - <template v-for="(item,index) in menuList"> - <template v-if="item.items && item.items.length"> - <el-submenu :index="item.index" :key="index"> - <template slot="title" v-if="item.icon"> - <img :src="item.icon" :title="item.label"/> - </template> - <template slot="title" v-else>{{ item.label }}</template> - <base-nav-menu-item v-for="child in item.items" :key="child.title" :menuList='[child]'></base-nav-menu-item> - </el-submenu> - </template> - <template v-else> - <el-menu-item :index="item.index" :key="index"> - <!-- <el-radio></el-radio>--> - {{ item.label }} - </el-menu-item> - </template> - </template> - </div> -</template> - -<script> - -export default { - name: 'BaseNavMenuItem', - data () { - return {} - }, - props: { - menuList: Array - } -} -</script> - -<style lang="less" scoped> -.el-menu--popup { - min-width: 100px; -} -.base-nav-menu { - height: 38px; - display: flex; - align-items: center; - justify-content: center; - outline: none; - border: none; - //margin-left: 20px; - padding: 0; - .el-menu--popup { - min-width: 100px; - } -} - -.el-menu--horizontal { - .el-menu--popup { - min-width: 100px; - } -} -</style> +<template> + <div class="base-nav-menu"> + <template v-for="(item,index) in menuList"> + <template v-if="item.items && item.items.length"> + <el-submenu :index="item.index" :key="index"> + <template slot="title" v-if="item.icon"> + <img :src="item.icon" :title="item.label"/> + </template> + <template slot="title" v-else>{{ item.label }}</template> + <base-nav-menu-item v-for="child in item.items" :key="child.title" :menuList='[child]'></base-nav-menu-item> + </el-submenu> + </template> + <template v-else> + <el-menu-item :index="item.index" :key="index"> + <!-- <el-radio></el-radio>--> + {{ item.label }} + </el-menu-item> + </template> + </template> + </div> +</template> + +<script> + +export default { + name: 'BaseNavMenuItem', + data () { + return {} + }, + props: { + menuList: Array + } +} +</script> + +<style lang="less" scoped> +.el-menu--popup { + min-width: 100px; +} +.base-nav-menu { + height: 38px; + display: flex; + align-items: center; + justify-content: center; + outline: none; + border: none; + //margin-left: 20px; + padding: 0; + .el-menu--popup { + min-width: 100px; + } +} + +.el-menu--horizontal { + .el-menu--popup { + min-width: 100px; + } +} +</style> diff --git a/src/components/panel/bounced/TextBounced.vue b/src/components/panel/bounced/TextBounced.vue index 6ccfe85..654f138 100644 --- a/src/components/panel/bounced/TextBounced.vue +++ b/src/components/panel/bounced/TextBounced.vue @@ -1,131 +1,131 @@ -<template> - <div class="bounced-box"> - <ul> - <li> - <form action="" class="bounced-box-title"> - <span>鏂囧瓧鏍囨敞璁剧疆</span> - <a @click="changeBounced()">X</a> - </form> - </li> - <li> - <form action="" class="bounced-box-content"> - <h6>鍐呭锛�</h6> - <div><textarea v-model='bouncedText' @blur="ChangeText"></textarea></div> - </form> - </li> - <li class="bounced-box-choose"> - <span>棰滆壊锛�</span> - <select v-model='bouncedSelect' @click="changeLabelTextSelect()"> - <option v-for="(item,index) in selectOptions" :key="index" :value="item.value">{{ item.text }}</option> - </select> - </li> - </ul> - </div> -</template> - -<script> - -import MakeTation from '@components/plugin/MakeTation' - -export default { - name: 'TextBounced', - data () { - return { - bouncedText: '', - bouncedSelect: 'red', - selectOptions: [ - { - value: 'red', - text: '绾㈣壊' - }, - { - value: 'blue', - text: '钃濊壊' - }, - { - value: 'yellow', - text: '榛勮壊' - } - ] - } - }, - methods: { - changeBounced () { - this.$emit('changeBounced', false) - }, - changeLabelTextSelect () { - // this.bouncedSelect = item - console.log('鑾峰彇棰滆壊') - MakeTation.setContentColor(this.bouncedSelect) - }, - ChangeText () { - MakeTation.setContentText(this.bouncedText) - console.log(this.bouncedText) - } - } -} -</script> - -<style lang="less" scoped> -.bounced-box { - position: absolute; - border: 1px solid grey; - width: 150px; - right: 5%; - top: 238px; - background-color: rgba(3, 28, 61, 0.8); - color: white; - cursor: default; - left: 814px; - - ul { - list-style: none; - padding: 0; - margin: 0; - - li { - margin: 1rem 0; - } - - .bounced-box-title { - background-color: rgba(34, 83, 130, 0.8); - cursor: move; - display: flex; - align-items: center; - justify-content: space-around; - - a { - color: white; - cursor: pointer; - } - } - - .bounced-box-content { - h6 { - padding: 0; - margin: 5px; - } - - div { - display: flex; - align-items: center; - justify-content: center; - - textarea { - width: 90%; - resize: none; - outline: 0; - border: 1px solid #a0b3d6; - border-radius: 5px; - } - } - } - - .bounced-box-choose { - display: flex; - align-items: center; - justify-content: space-around; - } - } -} -</style> +<template> + <div class="bounced-box"> + <ul> + <li> + <form action="" class="bounced-box-title"> + <span>鏂囧瓧鏍囨敞璁剧疆</span> + <a @click="changeBounced()">X</a> + </form> + </li> + <li> + <form action="" class="bounced-box-content"> + <h6>鍐呭锛�</h6> + <div><textarea v-model='bouncedText' @blur="ChangeText"></textarea></div> + </form> + </li> + <li class="bounced-box-choose"> + <span>棰滆壊锛�</span> + <select v-model='bouncedSelect' @click="changeLabelTextSelect()"> + <option v-for="(item,index) in selectOptions" :key="index" :value="item.value">{{ item.text }}</option> + </select> + </li> + </ul> + </div> +</template> + +<script> + +import MakeTation from '@components/plugin/MakeTation' + +export default { + name: 'TextBounced', + data () { + return { + bouncedText: '', + bouncedSelect: 'red', + selectOptions: [ + { + value: 'red', + text: '绾㈣壊' + }, + { + value: 'blue', + text: '钃濊壊' + }, + { + value: 'yellow', + text: '榛勮壊' + } + ] + } + }, + methods: { + changeBounced () { + this.$emit('changeBounced', false) + }, + changeLabelTextSelect () { + // this.bouncedSelect = item + console.log('鑾峰彇棰滆壊') + MakeTation.setContentColor(this.bouncedSelect) + }, + ChangeText () { + MakeTation.setContentText(this.bouncedText) + console.log(this.bouncedText) + } + } +} +</script> + +<style lang="less" scoped> +.bounced-box { + position: absolute; + border: 1px solid grey; + width: 150px; + right: 5%; + top: 238px; + background-color: rgba(3, 28, 61, 0.8); + color: white; + cursor: default; + left: 814px; + + ul { + list-style: none; + padding: 0; + margin: 0; + + li { + margin: 1rem 0; + } + + .bounced-box-title { + background-color: rgba(34, 83, 130, 0.8); + cursor: move; + display: flex; + align-items: center; + justify-content: space-around; + + a { + color: white; + cursor: pointer; + } + } + + .bounced-box-content { + h6 { + padding: 0; + margin: 5px; + } + + div { + display: flex; + align-items: center; + justify-content: center; + + textarea { + width: 90%; + resize: none; + outline: 0; + border: 1px solid #a0b3d6; + border-radius: 5px; + } + } + } + + .bounced-box-choose { + display: flex; + align-items: center; + justify-content: space-around; + } + } +} +</style> diff --git a/src/components/plugin/DownLoad.js b/src/components/plugin/DownLoad.js index b02ee30..ea0a919 100644 --- a/src/components/plugin/DownLoad.js +++ b/src/components/plugin/DownLoad.js @@ -1,705 +1,705 @@ -/* eslint-disable */ -const init = (L) => { - !function (t, e) { - 'object' == typeof exports && 'undefined' != typeof module ? e() : 'function' == typeof define && define.amd ? define(e) : e() - }(0, function () { - 'use strict' - - function t (t, e) { - return e = { exports: {} }, t(e, e.exports), e.exports - } - - var e = 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}, - n = t(function (t) { - !function (e) { - function n (t, e) { - function n (t) { - return e.bgcolor && (t.style.backgroundColor = e.bgcolor), e.width && (t.style.width = e.width + 'px'), e.height && (t.style.height = e.height + 'px'), e.style && Object.keys(e.style).forEach(function (n) { - t.style[n] = e.style[n] - }), t - } - - return e = e || {}, s(e), Promise.resolve(t).then(function (t) { - return u(t, e.filter, !0) - }).then(c).then(d).then(n).then(function (n) { - return g(n, e.width || h.width(t), e.height || h.height(t)) - }) - } - - function i (t, e) { - return l(t, e || {}).then(function (e) { - return e.getContext('2d').getImageData(0, 0, h.width(t), h.height(t)).data - }) - } - - function o (t, e) { - return l(t, e || {}).then(function (t) { - return t.toDataURL() - }) - } - - function r (t, e) { - return e = e || {}, l(t, e).then(function (t) { - return t.toDataURL('image/jpeg', e.quality || 1) - }) - } - - function a (t, e) { - return l(t, e || {}).then(h.canvasToBlob) - } - - function s (t) { - void 0 === t.imagePlaceholder ? w.impl.options.imagePlaceholder = M.imagePlaceholder : w.impl.options.imagePlaceholder = t.imagePlaceholder, void 0 === t.cacheBust ? w.impl.options.cacheBust = M.cacheBust : w.impl.options.cacheBust = t.cacheBust - } - - function l (t, e) { - function i (t) { - var n = document.createElement('canvas') - if (n.width = e.width || h.width(t), n.height = e.height || h.height(t), e.bgcolor) { - var i = n.getContext('2d') - i.fillStyle = e.bgcolor, i.fillRect(0, 0, n.width, n.height) - } - return n - } - - return n(t, e).then(h.makeImage).then(h.delay(100)).then(function (e) { - var n = i(t) - return n.getContext('2d').drawImage(e, 0, 0), n - }) - } - - function u (t, e, n) { - function i (t) { - return t instanceof HTMLCanvasElement ? h.makeImage(t.toDataURL()) : t.cloneNode(!1) - } - - function o (t, e, n) { - var i = t.childNodes - return 0 === i.length ? Promise.resolve(e) : function (t, e, n) { - var i = Promise.resolve() - return e.forEach(function (e) { - i = i.then(function () { - return u(e, n) - }).then(function (e) { - e && t.appendChild(e) - }) - }), i - }(e, h.asArray(i), n).then(function () { - return e - }) - } - - function r (t, e) { - function n () { - !function (t, e) { - t.cssText ? e.cssText = t.cssText : function (t, e) { - h.asArray(t).forEach(function (n) { - e.setProperty(n, t.getPropertyValue(n), t.getPropertyPriority(n)) - }) - }(t, e) - }(window.getComputedStyle(t), e.style) - } - - function i () { - function n (n) { - var i = window.getComputedStyle(t, n), o = i.getPropertyValue('content') - if ('' !== o && 'none' !== o) { - var r = h.uid() - e.className = e.className + ' ' + r - var a = document.createElement('style') - a.appendChild(function (t, e, n) { - var i = '.' + t + ':' + e, o = n.cssText ? function (t) { - var e = t.getPropertyValue('content') - return t.cssText + ' content: ' + e + ';' - }(n) : function (t) { - function e (e) { - return e + ': ' + t.getPropertyValue(e) + (t.getPropertyPriority(e) ? ' !important' : '') - } - - return h.asArray(t).map(e).join('; ') + ';' - }(n) - return document.createTextNode(i + '{' + o + '}') - }(r, n, i)), e.appendChild(a) - } - } - - [':before', ':after'].forEach(function (t) { - n(t) - }) - } - - function o () { - t instanceof HTMLTextAreaElement && (e.innerHTML = t.value), t instanceof HTMLInputElement && e.setAttribute('value', t.value) - } - - function r () { - e instanceof SVGElement && (e.setAttribute('xmlns', 'http://www.w3.org/2000/svg'), e instanceof SVGRectElement && ['width', 'height'].forEach(function (t) { - var n = e.getAttribute(t) - n && e.style.setProperty(t, n) - })) - } - - return e instanceof Element ? Promise.resolve().then(n).then(i).then(o).then(r).then(function () { - return e - }) : e - } - - return n || !e || e(t) ? Promise.resolve(t).then(i).then(function (n) { - return o(t, n, e) - }).then(function (e) { - return r(t, e) - }) : Promise.resolve() - } - - function c (t) { - return p.resolveAll().then(function (e) { - var n = document.createElement('style') - return t.appendChild(n), n.appendChild(document.createTextNode(e)), t - }) - } - - function d (t) { - return f.inlineAll(t).then(function () { - return t - }) - } - - function g (t, e, n) { - return Promise.resolve(t).then(function (t) { - return t.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'), (new XMLSerializer).serializeToString(t) - }).then(h.escapeXhtml).then(function (t) { - return '<foreignObject x="0" y="0" width="100%" height="100%">' + t + '</foreignObject>' - }).then(function (t) { - return '<svg xmlns="http://www.w3.org/2000/svg" width="' + e + '" height="' + n + '">' + t + '</svg>' - }).then(function (t) { - return 'data:image/svg+xml;charset=utf-8,' + t - }) - } - - var h = function () { - function t () { - var t = 'application/font-woff', e = 'image/jpeg' - return { - woff: t, - woff2: t, - ttf: 'application/font-truetype', - eot: 'application/vnd.ms-fontobject', - png: 'image/png', - jpg: e, - jpeg: e, - gif: 'image/gif', - tiff: 'image/tiff', - svg: 'image/svg+xml' - } - } - - function e (t) { - var e = /\.([^\.\/]*?)$/g.exec(t) - return e ? e[1] : '' - } - - function n (n) { - var i = e(n).toLowerCase() - return t()[i] || '' - } - - function i (t) { - return -1 !== t.search(/^(data:)/) - } - - function o (t) { - return new Promise(function (e) { - for (var n = window.atob(t.toDataURL().split(',')[1]), i = n.length, o = new Uint8Array(i), r = 0; r < i; r++) o[r] = n.charCodeAt(r) - e(new Blob([o], { type: 'image/png' })) - }) - } - - function r (t) { - return t.toBlob ? new Promise(function (e) { - t.toBlob(e) - }) : o(t) - } - - function a (t, e) { - var n = document.implementation.createHTMLDocument(), i = n.createElement('base') - n.head.appendChild(i) - var o = n.createElement('a') - return n.body.appendChild(o), i.href = e, o.href = t, o.href - } - - function s (t) { - return new Promise(function (e, n) { - var i = new Image - i.onload = function () { - e(i) - }, i.onerror = n, i.src = t - }) - } - - function l (t) { - var e = 3e4 - return w.impl.options.cacheBust && (t += (/\?/.test(t) ? '&' : '?') + (new Date).getTime()), new Promise(function (n) { - function i () { - if (4 === a.readyState) { - if (200 !== a.status) return void (s ? n(s) : r('cannot fetch resource: ' + t + ', status: ' + a.status)) - var e = new FileReader - e.onloadend = function () { - var t = e.result.split(/,/)[1] - n(t) - }, e.readAsDataURL(a.response) - } - } - - function o () { - s ? n(s) : r('timeout of ' + e + 'ms occured while fetching resource: ' + t) - } - - function r (t) { - console.error(t), n('') - } - - var a = new XMLHttpRequest - a.onreadystatechange = i, a.ontimeout = o, a.responseType = 'blob', a.timeout = e, a.open('GET', t, !0), a.send() - var s - if (w.impl.options.imagePlaceholder) { - var l = w.impl.options.imagePlaceholder.split(/,/) - l && l[1] && (s = l[1]) - } - }) - } - - function u (t, e) { - return 'data:' + e + ';base64,' + t - } - - function c (t) { - return t.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1') - } - - function d (t) { - return function (e) { - return new Promise(function (n) { - setTimeout(function () { - n(e) - }, t) - }) - } - } - - function g (t) { - for (var e = [], n = t.length, i = 0; i < n; i++) e.push(t[i]) - return e - } - - function h (t) { - return t.replace(/#/g, '%23').replace(/\n/g, '%0A') - } - - function m (t) { - var e = f(t, 'border-left-width'), n = f(t, 'border-right-width') - return t.scrollWidth + e + n - } - - function p (t) { - var e = f(t, 'border-top-width'), n = f(t, 'border-bottom-width') - return t.scrollHeight + e + n - } - - function f (t, e) { - var n = window.getComputedStyle(t).getPropertyValue(e) - return parseFloat(n.replace('px', '')) - } - - return { - escape: c, - parseExtension: e, - mimeType: n, - dataAsUrl: u, - isDataUrl: i, - canvasToBlob: r, - resolveUrl: a, - getAndEncode: l, - uid: function () { - var t = 0 - return function () { - return 'u' + function () { - return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4) - }() + t++ - } - }(), - delay: d, - asArray: g, - escapeXhtml: h, - makeImage: s, - width: m, - height: p - } - }(), m = function () { - function t (t) { - return -1 !== t.search(o) - } - - function e (t) { - for (var e, n = []; null !== (e = o.exec(t));) n.push(e[1]) - return n.filter(function (t) { - return !h.isDataUrl(t) - }) - } - - function n (t, e, n, i) { - function o (t) { - return new RegExp('(url\\([\'"]?)(' + h.escape(t) + ')([\'"]?\\))', 'g') - } - - return Promise.resolve(e).then(function (t) { - return n ? h.resolveUrl(t, n) : t - }).then(i || h.getAndEncode).then(function (t) { - return h.dataAsUrl(t, h.mimeType(e)) - }).then(function (n) { - return t.replace(o(e), '$1' + n + '$3') - }) - } - - function i (i, o, r) { - return function () { - return !t(i) - }() ? Promise.resolve(i) : Promise.resolve(i).then(e).then(function (t) { - var e = Promise.resolve(i) - return t.forEach(function (t) { - e = e.then(function (e) { - return n(e, t, o, r) - }) - }), e - }) - } - - var o = /url\(['"]?([^'"]+?)['"]?\)/g - return { - inlineAll: i, - shouldProcess: t, - impl: { - readUrls: e, - inline: n - } - } - }(), p = function () { - function t () { - return e(document).then(function (t) { - return Promise.all(t.map(function (t) { - return t.resolve() - })) - }).then(function (t) { - return t.join('\n') - }) - } - - function e () { - function t (t) { - return t.filter(function (t) { - return t.type === CSSRule.FONT_FACE_RULE - }).filter(function (t) { - return m.shouldProcess(t.style.getPropertyValue('src')) - }) - } - - function e (t) { - var e = [] - return t.forEach(function (t) { - try { - h.asArray(t.cssRules || []).forEach(e.push.bind(e)) - } catch (e) { - console.log('Error while reading CSS rules from ' + t.href, e.toString()) - } - }), e - } - - function n (t) { - return { - resolve: function () { - var e = (t.parentStyleSheet || {}).href - return m.inlineAll(t.cssText, e) - }, - src: function () { - return t.style.getPropertyValue('src') - } - } - } - - return Promise.resolve(h.asArray(document.styleSheets)).then(e).then(t).then(function (t) { - return t.map(n) - }) - } - - return { - resolveAll: t, - impl: { readAll: e } - } - }(), f = function () { - function t (t) { - function e (e) { - return h.isDataUrl(t.src) ? Promise.resolve() : Promise.resolve(t.src).then(e || h.getAndEncode).then(function (e) { - return h.dataAsUrl(e, h.mimeType(t.src)) - }).then(function (e) { - return new Promise(function (n, i) { - t.onload = n, t.onerror = i, t.src = e - }) - }) - } - - return { inline: e } - } - - function e (n) { - return n instanceof Element ? function (t) { - var e = t.style.getPropertyValue('background') - return e ? m.inlineAll(e).then(function (e) { - t.style.setProperty('background', e, t.style.getPropertyPriority('background')) - }).then(function () { - return t - }) : Promise.resolve(t) - }(n).then(function () { - return n instanceof HTMLImageElement ? t(n).inline() : Promise.all(h.asArray(n.childNodes).map(function (t) { - return e(t) - })) - }) : Promise.resolve(n) - } - - return { - inlineAll: e, - impl: { newImage: t } - } - }(), M = { - imagePlaceholder: void 0, - cacheBust: !1 - }, w = { - toSvg: n, - toPng: o, - toJpeg: r, - toBlob: a, - toPixelData: i, - impl: { - fontFaces: p, - images: f, - util: h, - inliner: m, - options: {} - } - } - t.exports = w - }() - }), i = t(function (t) { - var n = n || function (t) { - if (!(void 0 === t || 'undefined' != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) { - var e = t.document, n = function () { - return t.URL || t.webkitURL || t - }, i = e.createElementNS('http://www.w3.org/1999/xhtml', 'a'), o = 'download' in i, r = function (t) { - var e = new MouseEvent('click') - t.dispatchEvent(e) - }, a = /constructor/i.test(t.HTMLElement) || t.safari, s = /CriOS\/[\d]+/.test(navigator.userAgent), - l = function (e) { - (t.setImmediate || t.setTimeout)(function () { - throw e - }, 0) - }, u = function (t) { - var e = function () { - 'string' == typeof t ? n().revokeObjectURL(t) : t.remove() - } - setTimeout(e, 4e4) - }, c = function (t, e, n) { - e = [].concat(e) - for (var i = e.length; i--;) { - var o = t['on' + e[i]] - if ('function' == typeof o) { - try { - o.call(t, n || t) - } catch (t) { - l(t) - } - } - } - }, d = function (t) { - return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type) ? new Blob([String.fromCharCode(65279), t], { type: t.type }) : t - }, g = function (e, l, g) { - g || (e = d(e)) - var h, m = this, p = e.type, f = 'application/octet-stream' === p, M = function () { - c(m, 'writestart progress write writeend'.split(' ')) - } - if (m.readyState = m.INIT, o) { - return h = n().createObjectURL(e), void setTimeout(function () { - i.href = h, i.download = l, r(i), M(), u(h), m.readyState = m.DONE - }) - } - !function () { - if ((s || f && a) && t.FileReader) { - var i = new FileReader - return i.onloadend = function () { - var e = s ? i.result : i.result.replace(/^data:[^;]*;/, 'data:attachment/file;') - t.open(e, '_blank') || (t.location.href = e), e = void 0, m.readyState = m.DONE, M() - }, i.readAsDataURL(e), void (m.readyState = m.INIT) - } - if (h || (h = n().createObjectURL(e)), f) { - t.location.href = h - } else { - t.open(h, '_blank') || (t.location.href = h) - } - m.readyState = m.DONE, M(), u(h) - }() - }, h = g.prototype, m = function (t, e, n) { - return new g(t, e || t.name || 'download', n) - } - return 'undefined' != typeof navigator && navigator.msSaveOrOpenBlob ? function (t, e, n) { - return e = e || t.name || 'download', n || (t = d(t)), navigator.msSaveOrOpenBlob(t, e) - } : (h.abort = function () { - }, h.readyState = h.INIT = 0, h.WRITING = 1, h.DONE = 2, h.error = h.onwritestart = h.onprogress = h.onwrite = h.onabort = h.onerror = h.onwriteend = null, m) - } - }('undefined' != typeof self && self || 'undefined' != typeof window && window || e.content) - t.exports && (t.exports.saveAs = n) - }) - L.Control.EasyPrint = L.Control.extend({ - options: { - title: 'Print map', - position: 'topleft', - sizeModes: ['Current'], - filename: 'map', - exportOnly: !1, - hidden: !1, - tileWait: 500, - hideControlContainer: !0, - customWindowTitle: window.document.title, - spinnerBgCOlor: '#0DC5C1', - customSpinnerClass: 'epLoader', - defaultSizeTitles: { - Current: 'Current Size', - A4Landscape: 'A4 Landscape', - A4Portrait: 'A4 Portrait' - } - }, - onAdd: function () { - this.mapContainer = this._map.getContainer(), this.options.sizeModes = this.options.sizeModes.map(function (t) { - return 'Current' === t ? { - name: this.options.defaultSizeTitles.Current, - className: 'CurrentSize' - } : 'A4Landscape' === t ? { - height: this._a4PageSize.height, - width: this._a4PageSize.width, - name: this.options.defaultSizeTitles.A4Landscape, - className: 'A4Landscape page' - } : 'A4Portrait' === t ? { - height: this._a4PageSize.width, - width: this._a4PageSize.height, - name: this.options.defaultSizeTitles.A4Portrait, - className: 'A4Portrait page' - } : t - }, this) - var t = L.DomUtil.create('div', 'leaflet-control-easyPrint leaflet-bar leaflet-control') - if (!this.options.hidden) { - this._addCss(), L.DomEvent.addListener(t, 'mouseover', this._togglePageSizeButtons, this), L.DomEvent.addListener(t, 'mouseout', this._togglePageSizeButtons, this) - var e = 'leaflet-control-easyPrint-button' - this.options.exportOnly && (e += '-export'), this.link = L.DomUtil.create('a', e, t), this.link.id = 'leafletEasyPrint', this.link.title = this.options.title, this.holder = L.DomUtil.create('ul', 'easyPrintHolder', t), this.options.sizeModes.forEach(function (t) { - var e = L.DomUtil.create('li', 'easyPrintSizeMode', this.holder) - e.title = t.name - L.DomUtil.create('a', t.className, e) - L.DomEvent.addListener(e, 'click', this.printMap, this) - }, this), L.DomEvent.disableClickPropagation(t) - } - return t - }, - printMap: function (t, e) { - e && (this.options.filename = e), this.options.exportOnly || (this._page = window.open('', '_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width=200, height=250, visible=none'), this._page.document.write(this._createSpinner(this.options.customWindowTitle, this.options.customSpinnerClass, this.options.spinnerBgCOlor))), this.originalState = { - mapWidth: this.mapContainer.style.width, - widthWasAuto: !1, - widthWasPercentage: !1, - mapHeight: this.mapContainer.style.height, - zoom: this._map.getZoom(), - center: this._map.getCenter() - }, 'auto' === this.originalState.mapWidth ? (this.originalState.mapWidth = this._map.getSize().x + 'px', this.originalState.widthWasAuto = !0) : this.originalState.mapWidth.includes('%') && (this.originalState.percentageWidth = this.originalState.mapWidth, this.originalState.widthWasPercentage = !0, this.originalState.mapWidth = this._map.getSize().x + 'px'), this._map.fire('easyPrint-start', { event: t }), this.options.hidden || this._togglePageSizeButtons({ type: null }), this.options.hideControlContainer && this._toggleControls() - var n = 'string' != typeof t ? t.target.className : t - if ('CurrentSize' === n) return this._printOpertion(n) - this.outerContainer = this._createOuterContainer(this.mapContainer), this.originalState.widthWasAuto && (this.outerContainer.style.width = this.originalState.mapWidth), this._createImagePlaceholder(n) - }, - _createImagePlaceholder: function (t) { - var e = this - n.toPng(this.mapContainer, { - width: parseInt(this.originalState.mapWidth.replace('px')), - height: parseInt(this.originalState.mapHeight.replace('px')) - }).then(function (n) { - e.blankDiv = document.createElement('div') - var i = e.blankDiv - e.outerContainer.parentElement.insertBefore(i, e.outerContainer), i.className = 'epHolder', i.style.backgroundImage = 'url("' + n + '")', i.style.position = 'absolute', i.style.zIndex = 1011, i.style.display = 'initial', i.style.width = e.originalState.mapWidth, i.style.height = e.originalState.mapHeight, e._resizeAndPrintMap(t) - }).catch(function (t) { - console.error('oops, something went wrong!', t) - }) - }, - _resizeAndPrintMap: function (t) { - this.outerContainer.style.opacity = 0 - var e = this.options.sizeModes.filter(function (e) { - return e.className === t - }) - e = e[0], this.mapContainer.style.width = e.width + 'px', this.mapContainer.style.height = e.height + 'px', this.mapContainer.style.width > this.mapContainer.style.height ? this.orientation = 'portrait' : this.orientation = 'landscape', this._map.setView(this.originalState.center), this._map.setZoom(this.originalState.zoom), this._map.invalidateSize(), this.options.tileLayer ? this._pausePrint(t) : this._printOpertion(t) - }, - _pausePrint: function (t) { - var e = this, n = setInterval(function () { - e.options.tileLayer.isLoading() || (clearInterval(n), e._printOpertion(t)) - }, e.options.tileWait) - }, - _printOpertion: function (t) { - var e = this, o = this.mapContainer.style.width; - (this.originalState.widthWasAuto && 'CurrentSize' === t || this.originalState.widthWasPercentage && 'CurrentSize' === t) && (o = this.originalState.mapWidth), n.toPng(e.mapContainer, { - width: parseInt(o), - height: parseInt(e.mapContainer.style.height.replace('px')) - }).then(function (t) { - var n = e._dataURItoBlob(t) - e.options.exportOnly ? i.saveAs(n, e.options.filename + '.png') : e._sendToBrowserPrint(t, e.orientation), e._toggleControls(!0), e.outerContainer && (e.originalState.widthWasAuto ? e.mapContainer.style.width = 'auto' : e.originalState.widthWasPercentage ? e.mapContainer.style.width = e.originalState.percentageWidth : e.mapContainer.style.width = e.originalState.mapWidth, e.mapContainer.style.height = e.originalState.mapHeight, e._removeOuterContainer(e.mapContainer, e.outerContainer, e.blankDiv), e._map.invalidateSize(), e._map.setView(e.originalState.center), e._map.setZoom(e.originalState.zoom)), e._map.fire('easyPrint-finished') - }).catch(function (t) { - console.error('Print operation failed', t) - }) - }, - _sendToBrowserPrint: function (t, e) { - this._page.resizeTo(600, 800) - var n = this._createNewWindow(t, e, this) - this._page.document.body.innerHTML = '', this._page.document.write(n), this._page.document.close() - }, - _createSpinner: function (t, e, n) { - return '<html><head><title>' + t + '</title></head><body><style>\n body{\n background: ' + n + ';\n }\n .epLoader,\n .epLoader:before,\n .epLoader:after {\n border-radius: 50%;\n }\n .epLoader {\n color: #ffffff;\n font-size: 11px;\n text-indent: -99999em;\n margin: 55px auto;\n position: relative;\n width: 10em;\n height: 10em;\n box-shadow: inset 0 0 0 1em;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n }\n .epLoader:before,\n .epLoader:after {\n position: absolute;\n content: \'\';\n }\n .epLoader:before {\n width: 5.2em;\n height: 10.2em;\n background: #0dc5c1;\n border-radius: 10.2em 0 0 10.2em;\n top: -0.1em;\n left: -0.1em;\n -webkit-transform-origin: 5.2em 5.1em;\n transform-origin: 5.2em 5.1em;\n -webkit-animation: load2 2s infinite ease 1.5s;\n animation: load2 2s infinite ease 1.5s;\n }\n .epLoader:after {\n width: 5.2em;\n height: 10.2em;\n background: #0dc5c1;\n border-radius: 0 10.2em 10.2em 0;\n top: -0.1em;\n left: 5.1em;\n -webkit-transform-origin: 0px 5.1em;\n transform-origin: 0px 5.1em;\n -webkit-animation: load2 2s infinite ease;\n animation: load2 2s infinite ease;\n }\n @-webkit-keyframes load2 {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n @keyframes load2 {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n </style>\n <div class="' + e + '">Loading...</div></body></html>' - }, - _createNewWindow: function (t, e, n) { - return '<html><head>\n <style>@media print {\n img { max-width: 98%!important; max-height: 98%!important; }\n @page { size: ' + e + ';}}\n </style>\n <script>function step1(){\n setTimeout(\'step2()\', 10);}\n function step2(){window.print();window.close()}\n <\/script></head><body onload=\'step1()\'>\n <img src="' + t + '" style="display:block; margin:auto;"></body></html>' - }, - _createOuterContainer: function (t) { - var e = document.createElement('div') - return t.parentNode.insertBefore(e, t), t.parentNode.removeChild(t), e.appendChild(t), e.style.width = t.style.width, e.style.height = t.style.height, e.style.display = 'inline-block', e.style.overflow = 'hidden', e - }, - _removeOuterContainer: function (t, e, n) { - e.parentNode && (e.parentNode.insertBefore(t, e), e.parentNode.removeChild(n), e.parentNode.removeChild(e)) - }, - _addCss: function () { - var t = document.createElement('style') - t.type = 'text/css', t.innerHTML = '.leaflet-control-easyPrint-button { \n background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3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9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);\n background-size: 16px 16px; \n cursor: pointer; \n }\n .easyPrintHolder a {\n background-size: 16px 16px;\n cursor: pointer;\n }\n .easyPrintHolder .CurrentSize{\n background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTZweCIgdmVyc2lvbj0iMS4xIiBoZWlnaHQ9IjE2cHgiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjQgNjQiPgogIDxnPgogICAgPGcgZmlsbD0iIzFEMUQxQiI+CiAgICAgIDxwYXRoIGQ9Ik0yNS4yNTUsMzUuOTA1TDQuMDE2LDU3LjE0NVY0Ni41OWMwLTEuMTA4LTAuODk3LTIuMDA4LTIuMDA4LTIuMDA4QzAuODk4LDQ0LjU4MiwwLDQ1LjQ4MSwwLDQ2LjU5djE1LjQwMiAgICBjMCwwLjI2MSwwLjA1MywwLjUyMSwwLjE1NSwwLjc2N2MwLjIwMywwLjQ5MiwwLjU5NCwwLjg4MiwxLjA4NiwxLjA4N0MxLjQ4Niw2My45NDcsMS43NDcsNjQsMi4wMDgsNjRoMTUuNDAzICAgIGMxLjEwOSwwLDIuMDA4LTAuODk4LDIuMDA4LTIuMDA4cy0wLjg5OC0yLjAwOC0yLjAwOC0yLjAwOEg2Ljg1NWwyMS4yMzgtMj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margin-top:-31px;\n margin-bottom: -5px;\n margin-left: 30px;\n padding-left: 0px;\n display: none;\n }\n\n .easyPrintSizeMode {\n display: inline-block;\n }\n .easyPrintHolder .easyPrintSizeMode a {\n border-radius: 0px;\n }\n\n .easyPrintHolder .easyPrintSizeMode:last-child a{\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px;\n margin-left: -1px;\n }\n\n .easyPrintPortrait:hover, .easyPrintLandscape:hover{\n background-color: #757570;\n cursor: pointer;\n }', document.body.appendChild(t) - }, - _dataURItoBlob: function (t) { - for (var e = atob(t.split(',')[1]), n = t.split(',')[0].split(':')[1].split(';')[0], i = new ArrayBuffer(e.length), o = new DataView(i), r = 0; r < e.length; r++) o.setUint8(r, e.charCodeAt(r)) - return new Blob([i], { type: n }) - }, - _togglePageSizeButtons: function (t) { - var e = this.holder.style, n = this.link.style - 'mouseover' === t.type ? (e.display = 'block', n.borderTopRightRadius = '0', n.borderBottomRightRadius = '0') : (e.display = 'none', n.borderTopRightRadius = '2px', n.borderBottomRightRadius = '2px') - }, - _toggleControls: function (t) { - var e = document.getElementsByClassName('leaflet-control-container')[0] - if (t) return e.style.display = 'block' - e.style.display = 'none' - }, - _a4PageSize: { - height: 715, - width: 1045 - } - }), L.easyPrint = function (t) { - return new L.Control.EasyPrint(t) - } - }) -//# sourceMappingURL=bundle.js.map -} - -export default { - init -} +/* eslint-disable */ +const init = (L) => { + !function (t, e) { + 'object' == typeof exports && 'undefined' != typeof module ? e() : 'function' == typeof define && define.amd ? define(e) : e() + }(0, function () { + 'use strict' + + function t (t, e) { + return e = { exports: {} }, t(e, e.exports), e.exports + } + + var e = 'undefined' != typeof window ? window : 'undefined' != typeof global ? global : 'undefined' != typeof self ? self : {}, + n = t(function (t) { + !function (e) { + function n (t, e) { + function n (t) { + return e.bgcolor && (t.style.backgroundColor = e.bgcolor), e.width && (t.style.width = e.width + 'px'), e.height && (t.style.height = e.height + 'px'), e.style && Object.keys(e.style).forEach(function (n) { + t.style[n] = e.style[n] + }), t + } + + return e = e || {}, s(e), Promise.resolve(t).then(function (t) { + return u(t, e.filter, !0) + }).then(c).then(d).then(n).then(function (n) { + return g(n, e.width || h.width(t), e.height || h.height(t)) + }) + } + + function i (t, e) { + return l(t, e || {}).then(function (e) { + return e.getContext('2d').getImageData(0, 0, h.width(t), h.height(t)).data + }) + } + + function o (t, e) { + return l(t, e || {}).then(function (t) { + return t.toDataURL() + }) + } + + function r (t, e) { + return e = e || {}, l(t, e).then(function (t) { + return t.toDataURL('image/jpeg', e.quality || 1) + }) + } + + function a (t, e) { + return l(t, e || {}).then(h.canvasToBlob) + } + + function s (t) { + void 0 === t.imagePlaceholder ? w.impl.options.imagePlaceholder = M.imagePlaceholder : w.impl.options.imagePlaceholder = t.imagePlaceholder, void 0 === t.cacheBust ? w.impl.options.cacheBust = M.cacheBust : w.impl.options.cacheBust = t.cacheBust + } + + function l (t, e) { + function i (t) { + var n = document.createElement('canvas') + if (n.width = e.width || h.width(t), n.height = e.height || h.height(t), e.bgcolor) { + var i = n.getContext('2d') + i.fillStyle = e.bgcolor, i.fillRect(0, 0, n.width, n.height) + } + return n + } + + return n(t, e).then(h.makeImage).then(h.delay(100)).then(function (e) { + var n = i(t) + return n.getContext('2d').drawImage(e, 0, 0), n + }) + } + + function u (t, e, n) { + function i (t) { + return t instanceof HTMLCanvasElement ? h.makeImage(t.toDataURL()) : t.cloneNode(!1) + } + + function o (t, e, n) { + var i = t.childNodes + return 0 === i.length ? Promise.resolve(e) : function (t, e, n) { + var i = Promise.resolve() + return e.forEach(function (e) { + i = i.then(function () { + return u(e, n) + }).then(function (e) { + e && t.appendChild(e) + }) + }), i + }(e, h.asArray(i), n).then(function () { + return e + }) + } + + function r (t, e) { + function n () { + !function (t, e) { + t.cssText ? e.cssText = t.cssText : function (t, e) { + h.asArray(t).forEach(function (n) { + e.setProperty(n, t.getPropertyValue(n), t.getPropertyPriority(n)) + }) + }(t, e) + }(window.getComputedStyle(t), e.style) + } + + function i () { + function n (n) { + var i = window.getComputedStyle(t, n), o = i.getPropertyValue('content') + if ('' !== o && 'none' !== o) { + var r = h.uid() + e.className = e.className + ' ' + r + var a = document.createElement('style') + a.appendChild(function (t, e, n) { + var i = '.' + t + ':' + e, o = n.cssText ? function (t) { + var e = t.getPropertyValue('content') + return t.cssText + ' content: ' + e + ';' + }(n) : function (t) { + function e (e) { + return e + ': ' + t.getPropertyValue(e) + (t.getPropertyPriority(e) ? ' !important' : '') + } + + return h.asArray(t).map(e).join('; ') + ';' + }(n) + return document.createTextNode(i + '{' + o + '}') + }(r, n, i)), e.appendChild(a) + } + } + + [':before', ':after'].forEach(function (t) { + n(t) + }) + } + + function o () { + t instanceof HTMLTextAreaElement && (e.innerHTML = t.value), t instanceof HTMLInputElement && e.setAttribute('value', t.value) + } + + function r () { + e instanceof SVGElement && (e.setAttribute('xmlns', 'http://www.w3.org/2000/svg'), e instanceof SVGRectElement && ['width', 'height'].forEach(function (t) { + var n = e.getAttribute(t) + n && e.style.setProperty(t, n) + })) + } + + return e instanceof Element ? Promise.resolve().then(n).then(i).then(o).then(r).then(function () { + return e + }) : e + } + + return n || !e || e(t) ? Promise.resolve(t).then(i).then(function (n) { + return o(t, n, e) + }).then(function (e) { + return r(t, e) + }) : Promise.resolve() + } + + function c (t) { + return p.resolveAll().then(function (e) { + var n = document.createElement('style') + return t.appendChild(n), n.appendChild(document.createTextNode(e)), t + }) + } + + function d (t) { + return f.inlineAll(t).then(function () { + return t + }) + } + + function g (t, e, n) { + return Promise.resolve(t).then(function (t) { + return t.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml'), (new XMLSerializer).serializeToString(t) + }).then(h.escapeXhtml).then(function (t) { + return '<foreignObject x="0" y="0" width="100%" height="100%">' + t + '</foreignObject>' + }).then(function (t) { + return '<svg xmlns="http://www.w3.org/2000/svg" width="' + e + '" height="' + n + '">' + t + '</svg>' + }).then(function (t) { + return 'data:image/svg+xml;charset=utf-8,' + t + }) + } + + var h = function () { + function t () { + var t = 'application/font-woff', e = 'image/jpeg' + return { + woff: t, + woff2: t, + ttf: 'application/font-truetype', + eot: 'application/vnd.ms-fontobject', + png: 'image/png', + jpg: e, + jpeg: e, + gif: 'image/gif', + tiff: 'image/tiff', + svg: 'image/svg+xml' + } + } + + function e (t) { + var e = /\.([^\.\/]*?)$/g.exec(t) + return e ? e[1] : '' + } + + function n (n) { + var i = e(n).toLowerCase() + return t()[i] || '' + } + + function i (t) { + return -1 !== t.search(/^(data:)/) + } + + function o (t) { + return new Promise(function (e) { + for (var n = window.atob(t.toDataURL().split(',')[1]), i = n.length, o = new Uint8Array(i), r = 0; r < i; r++) o[r] = n.charCodeAt(r) + e(new Blob([o], { type: 'image/png' })) + }) + } + + function r (t) { + return t.toBlob ? new Promise(function (e) { + t.toBlob(e) + }) : o(t) + } + + function a (t, e) { + var n = document.implementation.createHTMLDocument(), i = n.createElement('base') + n.head.appendChild(i) + var o = n.createElement('a') + return n.body.appendChild(o), i.href = e, o.href = t, o.href + } + + function s (t) { + return new Promise(function (e, n) { + var i = new Image + i.onload = function () { + e(i) + }, i.onerror = n, i.src = t + }) + } + + function l (t) { + var e = 3e4 + return w.impl.options.cacheBust && (t += (/\?/.test(t) ? '&' : '?') + (new Date).getTime()), new Promise(function (n) { + function i () { + if (4 === a.readyState) { + if (200 !== a.status) return void (s ? n(s) : r('cannot fetch resource: ' + t + ', status: ' + a.status)) + var e = new FileReader + e.onloadend = function () { + var t = e.result.split(/,/)[1] + n(t) + }, e.readAsDataURL(a.response) + } + } + + function o () { + s ? n(s) : r('timeout of ' + e + 'ms occured while fetching resource: ' + t) + } + + function r (t) { + console.error(t), n('') + } + + var a = new XMLHttpRequest + a.onreadystatechange = i, a.ontimeout = o, a.responseType = 'blob', a.timeout = e, a.open('GET', t, !0), a.send() + var s + if (w.impl.options.imagePlaceholder) { + var l = w.impl.options.imagePlaceholder.split(/,/) + l && l[1] && (s = l[1]) + } + }) + } + + function u (t, e) { + return 'data:' + e + ';base64,' + t + } + + function c (t) { + return t.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1') + } + + function d (t) { + return function (e) { + return new Promise(function (n) { + setTimeout(function () { + n(e) + }, t) + }) + } + } + + function g (t) { + for (var e = [], n = t.length, i = 0; i < n; i++) e.push(t[i]) + return e + } + + function h (t) { + return t.replace(/#/g, '%23').replace(/\n/g, '%0A') + } + + function m (t) { + var e = f(t, 'border-left-width'), n = f(t, 'border-right-width') + return t.scrollWidth + e + n + } + + function p (t) { + var e = f(t, 'border-top-width'), n = f(t, 'border-bottom-width') + return t.scrollHeight + e + n + } + + function f (t, e) { + var n = window.getComputedStyle(t).getPropertyValue(e) + return parseFloat(n.replace('px', '')) + } + + return { + escape: c, + parseExtension: e, + mimeType: n, + dataAsUrl: u, + isDataUrl: i, + canvasToBlob: r, + resolveUrl: a, + getAndEncode: l, + uid: function () { + var t = 0 + return function () { + return 'u' + function () { + return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4) + }() + t++ + } + }(), + delay: d, + asArray: g, + escapeXhtml: h, + makeImage: s, + width: m, + height: p + } + }(), m = function () { + function t (t) { + return -1 !== t.search(o) + } + + function e (t) { + for (var e, n = []; null !== (e = o.exec(t));) n.push(e[1]) + return n.filter(function (t) { + return !h.isDataUrl(t) + }) + } + + function n (t, e, n, i) { + function o (t) { + return new RegExp('(url\\([\'"]?)(' + h.escape(t) + ')([\'"]?\\))', 'g') + } + + return Promise.resolve(e).then(function (t) { + return n ? h.resolveUrl(t, n) : t + }).then(i || h.getAndEncode).then(function (t) { + return h.dataAsUrl(t, h.mimeType(e)) + }).then(function (n) { + return t.replace(o(e), '$1' + n + '$3') + }) + } + + function i (i, o, r) { + return function () { + return !t(i) + }() ? Promise.resolve(i) : Promise.resolve(i).then(e).then(function (t) { + var e = Promise.resolve(i) + return t.forEach(function (t) { + e = e.then(function (e) { + return n(e, t, o, r) + }) + }), e + }) + } + + var o = /url\(['"]?([^'"]+?)['"]?\)/g + return { + inlineAll: i, + shouldProcess: t, + impl: { + readUrls: e, + inline: n + } + } + }(), p = function () { + function t () { + return e(document).then(function (t) { + return Promise.all(t.map(function (t) { + return t.resolve() + })) + }).then(function (t) { + return t.join('\n') + }) + } + + function e () { + function t (t) { + return t.filter(function (t) { + return t.type === CSSRule.FONT_FACE_RULE + }).filter(function (t) { + return m.shouldProcess(t.style.getPropertyValue('src')) + }) + } + + function e (t) { + var e = [] + return t.forEach(function (t) { + try { + h.asArray(t.cssRules || []).forEach(e.push.bind(e)) + } catch (e) { + console.log('Error while reading CSS rules from ' + t.href, e.toString()) + } + }), e + } + + function n (t) { + return { + resolve: function () { + var e = (t.parentStyleSheet || {}).href + return m.inlineAll(t.cssText, e) + }, + src: function () { + return t.style.getPropertyValue('src') + } + } + } + + return Promise.resolve(h.asArray(document.styleSheets)).then(e).then(t).then(function (t) { + return t.map(n) + }) + } + + return { + resolveAll: t, + impl: { readAll: e } + } + }(), f = function () { + function t (t) { + function e (e) { + return h.isDataUrl(t.src) ? Promise.resolve() : Promise.resolve(t.src).then(e || h.getAndEncode).then(function (e) { + return h.dataAsUrl(e, h.mimeType(t.src)) + }).then(function (e) { + return new Promise(function (n, i) { + t.onload = n, t.onerror = i, t.src = e + }) + }) + } + + return { inline: e } + } + + function e (n) { + return n instanceof Element ? function (t) { + var e = t.style.getPropertyValue('background') + return e ? m.inlineAll(e).then(function (e) { + t.style.setProperty('background', e, t.style.getPropertyPriority('background')) + }).then(function () { + return t + }) : Promise.resolve(t) + }(n).then(function () { + return n instanceof HTMLImageElement ? t(n).inline() : Promise.all(h.asArray(n.childNodes).map(function (t) { + return e(t) + })) + }) : Promise.resolve(n) + } + + return { + inlineAll: e, + impl: { newImage: t } + } + }(), M = { + imagePlaceholder: void 0, + cacheBust: !1 + }, w = { + toSvg: n, + toPng: o, + toJpeg: r, + toBlob: a, + toPixelData: i, + impl: { + fontFaces: p, + images: f, + util: h, + inliner: m, + options: {} + } + } + t.exports = w + }() + }), i = t(function (t) { + var n = n || function (t) { + if (!(void 0 === t || 'undefined' != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) { + var e = t.document, n = function () { + return t.URL || t.webkitURL || t + }, i = e.createElementNS('http://www.w3.org/1999/xhtml', 'a'), o = 'download' in i, r = function (t) { + var e = new MouseEvent('click') + t.dispatchEvent(e) + }, a = /constructor/i.test(t.HTMLElement) || t.safari, s = /CriOS\/[\d]+/.test(navigator.userAgent), + l = function (e) { + (t.setImmediate || t.setTimeout)(function () { + throw e + }, 0) + }, u = function (t) { + var e = function () { + 'string' == typeof t ? n().revokeObjectURL(t) : t.remove() + } + setTimeout(e, 4e4) + }, c = function (t, e, n) { + e = [].concat(e) + for (var i = e.length; i--;) { + var o = t['on' + e[i]] + if ('function' == typeof o) { + try { + o.call(t, n || t) + } catch (t) { + l(t) + } + } + } + }, d = function (t) { + return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type) ? new Blob([String.fromCharCode(65279), t], { type: t.type }) : t + }, g = function (e, l, g) { + g || (e = d(e)) + var h, m = this, p = e.type, f = 'application/octet-stream' === p, M = function () { + c(m, 'writestart progress write writeend'.split(' ')) + } + if (m.readyState = m.INIT, o) { + return h = n().createObjectURL(e), void setTimeout(function () { + i.href = h, i.download = l, r(i), M(), u(h), m.readyState = m.DONE + }) + } + !function () { + if ((s || f && a) && t.FileReader) { + var i = new FileReader + return i.onloadend = function () { + var e = s ? i.result : i.result.replace(/^data:[^;]*;/, 'data:attachment/file;') + t.open(e, '_blank') || (t.location.href = e), e = void 0, m.readyState = m.DONE, M() + }, i.readAsDataURL(e), void (m.readyState = m.INIT) + } + if (h || (h = n().createObjectURL(e)), f) { + t.location.href = h + } else { + t.open(h, '_blank') || (t.location.href = h) + } + m.readyState = m.DONE, M(), u(h) + }() + }, h = g.prototype, m = function (t, e, n) { + return new g(t, e || t.name || 'download', n) + } + return 'undefined' != typeof navigator && navigator.msSaveOrOpenBlob ? function (t, e, n) { + return e = e || t.name || 'download', n || (t = d(t)), navigator.msSaveOrOpenBlob(t, e) + } : (h.abort = function () { + }, h.readyState = h.INIT = 0, h.WRITING = 1, h.DONE = 2, h.error = h.onwritestart = h.onprogress = h.onwrite = h.onabort = h.onerror = h.onwriteend = null, m) + } + }('undefined' != typeof self && self || 'undefined' != typeof window && window || e.content) + t.exports && (t.exports.saveAs = n) + }) + L.Control.EasyPrint = L.Control.extend({ + options: { + title: 'Print map', + position: 'topleft', + sizeModes: ['Current'], + filename: 'map', + exportOnly: !1, + hidden: !1, + tileWait: 500, + hideControlContainer: !0, + customWindowTitle: window.document.title, + spinnerBgCOlor: '#0DC5C1', + customSpinnerClass: 'epLoader', + defaultSizeTitles: { + Current: 'Current Size', + A4Landscape: 'A4 Landscape', + A4Portrait: 'A4 Portrait' + } + }, + onAdd: function () { + this.mapContainer = this._map.getContainer(), this.options.sizeModes = this.options.sizeModes.map(function (t) { + return 'Current' === t ? { + name: this.options.defaultSizeTitles.Current, + className: 'CurrentSize' + } : 'A4Landscape' === t ? { + height: this._a4PageSize.height, + width: this._a4PageSize.width, + name: this.options.defaultSizeTitles.A4Landscape, + className: 'A4Landscape page' + } : 'A4Portrait' === t ? { + height: this._a4PageSize.width, + width: this._a4PageSize.height, + name: this.options.defaultSizeTitles.A4Portrait, + className: 'A4Portrait page' + } : t + }, this) + var t = L.DomUtil.create('div', 'leaflet-control-easyPrint leaflet-bar leaflet-control') + if (!this.options.hidden) { + this._addCss(), L.DomEvent.addListener(t, 'mouseover', this._togglePageSizeButtons, this), L.DomEvent.addListener(t, 'mouseout', this._togglePageSizeButtons, this) + var e = 'leaflet-control-easyPrint-button' + this.options.exportOnly && (e += '-export'), this.link = L.DomUtil.create('a', e, t), this.link.id = 'leafletEasyPrint', this.link.title = this.options.title, this.holder = L.DomUtil.create('ul', 'easyPrintHolder', t), this.options.sizeModes.forEach(function (t) { + var e = L.DomUtil.create('li', 'easyPrintSizeMode', this.holder) + e.title = t.name + L.DomUtil.create('a', t.className, e) + L.DomEvent.addListener(e, 'click', this.printMap, this) + }, this), L.DomEvent.disableClickPropagation(t) + } + return t + }, + printMap: function (t, e) { + e && (this.options.filename = e), this.options.exportOnly || (this._page = window.open('', '_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10, top=10, width=200, height=250, visible=none'), this._page.document.write(this._createSpinner(this.options.customWindowTitle, this.options.customSpinnerClass, this.options.spinnerBgCOlor))), this.originalState = { + mapWidth: this.mapContainer.style.width, + widthWasAuto: !1, + widthWasPercentage: !1, + mapHeight: this.mapContainer.style.height, + zoom: this._map.getZoom(), + center: this._map.getCenter() + }, 'auto' === this.originalState.mapWidth ? (this.originalState.mapWidth = this._map.getSize().x + 'px', this.originalState.widthWasAuto = !0) : this.originalState.mapWidth.includes('%') && (this.originalState.percentageWidth = this.originalState.mapWidth, this.originalState.widthWasPercentage = !0, this.originalState.mapWidth = this._map.getSize().x + 'px'), this._map.fire('easyPrint-start', { event: t }), this.options.hidden || this._togglePageSizeButtons({ type: null }), this.options.hideControlContainer && this._toggleControls() + var n = 'string' != typeof t ? t.target.className : t + if ('CurrentSize' === n) return this._printOpertion(n) + this.outerContainer = this._createOuterContainer(this.mapContainer), this.originalState.widthWasAuto && (this.outerContainer.style.width = this.originalState.mapWidth), this._createImagePlaceholder(n) + }, + _createImagePlaceholder: function (t) { + var e = this + n.toPng(this.mapContainer, { + width: parseInt(this.originalState.mapWidth.replace('px')), + height: parseInt(this.originalState.mapHeight.replace('px')) + }).then(function (n) { + e.blankDiv = document.createElement('div') + var i = e.blankDiv + e.outerContainer.parentElement.insertBefore(i, e.outerContainer), i.className = 'epHolder', i.style.backgroundImage = 'url("' + n + '")', i.style.position = 'absolute', i.style.zIndex = 1011, i.style.display = 'initial', i.style.width = e.originalState.mapWidth, i.style.height = e.originalState.mapHeight, e._resizeAndPrintMap(t) + }).catch(function (t) { + console.error('oops, something went wrong!', t) + }) + }, + _resizeAndPrintMap: function (t) { + this.outerContainer.style.opacity = 0 + var e = this.options.sizeModes.filter(function (e) { + return e.className === t + }) + e = e[0], this.mapContainer.style.width = e.width + 'px', this.mapContainer.style.height = e.height + 'px', this.mapContainer.style.width > this.mapContainer.style.height ? this.orientation = 'portrait' : this.orientation = 'landscape', this._map.setView(this.originalState.center), this._map.setZoom(this.originalState.zoom), this._map.invalidateSize(), this.options.tileLayer ? this._pausePrint(t) : this._printOpertion(t) + }, + _pausePrint: function (t) { + var e = this, n = setInterval(function () { + e.options.tileLayer.isLoading() || (clearInterval(n), e._printOpertion(t)) + }, e.options.tileWait) + }, + _printOpertion: function (t) { + var e = this, o = this.mapContainer.style.width; + (this.originalState.widthWasAuto && 'CurrentSize' === t || this.originalState.widthWasPercentage && 'CurrentSize' === t) && (o = this.originalState.mapWidth), n.toPng(e.mapContainer, { + width: parseInt(o), + height: parseInt(e.mapContainer.style.height.replace('px')) + }).then(function (t) { + var n = e._dataURItoBlob(t) + e.options.exportOnly ? i.saveAs(n, e.options.filename + '.png') : e._sendToBrowserPrint(t, e.orientation), e._toggleControls(!0), e.outerContainer && (e.originalState.widthWasAuto ? e.mapContainer.style.width = 'auto' : e.originalState.widthWasPercentage ? e.mapContainer.style.width = e.originalState.percentageWidth : e.mapContainer.style.width = e.originalState.mapWidth, e.mapContainer.style.height = e.originalState.mapHeight, e._removeOuterContainer(e.mapContainer, e.outerContainer, e.blankDiv), e._map.invalidateSize(), e._map.setView(e.originalState.center), e._map.setZoom(e.originalState.zoom)), e._map.fire('easyPrint-finished') + }).catch(function (t) { + console.error('Print operation failed', t) + }) + }, + _sendToBrowserPrint: function (t, e) { + this._page.resizeTo(600, 800) + var n = this._createNewWindow(t, e, this) + this._page.document.body.innerHTML = '', this._page.document.write(n), this._page.document.close() + }, + _createSpinner: function (t, e, n) { + return '<html><head><title>' + t + '</title></head><body><style>\n body{\n background: ' + n + ';\n }\n .epLoader,\n .epLoader:before,\n .epLoader:after {\n border-radius: 50%;\n }\n .epLoader {\n color: #ffffff;\n font-size: 11px;\n text-indent: -99999em;\n margin: 55px auto;\n position: relative;\n width: 10em;\n height: 10em;\n box-shadow: inset 0 0 0 1em;\n -webkit-transform: translateZ(0);\n -ms-transform: translateZ(0);\n transform: translateZ(0);\n }\n .epLoader:before,\n .epLoader:after {\n position: absolute;\n content: \'\';\n }\n .epLoader:before {\n width: 5.2em;\n height: 10.2em;\n background: #0dc5c1;\n border-radius: 10.2em 0 0 10.2em;\n top: -0.1em;\n left: -0.1em;\n -webkit-transform-origin: 5.2em 5.1em;\n transform-origin: 5.2em 5.1em;\n -webkit-animation: load2 2s infinite ease 1.5s;\n animation: load2 2s infinite ease 1.5s;\n }\n .epLoader:after {\n width: 5.2em;\n height: 10.2em;\n background: #0dc5c1;\n border-radius: 0 10.2em 10.2em 0;\n top: -0.1em;\n left: 5.1em;\n -webkit-transform-origin: 0px 5.1em;\n transform-origin: 0px 5.1em;\n -webkit-animation: load2 2s infinite ease;\n animation: load2 2s infinite ease;\n }\n @-webkit-keyframes load2 {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n @keyframes load2 {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n }\n </style>\n <div class="' + e + '">Loading...</div></body></html>' + }, + _createNewWindow: function (t, e, n) { + return '<html><head>\n <style>@media print {\n img { max-width: 98%!important; max-height: 98%!important; }\n @page { size: ' + e + ';}}\n </style>\n <script>function step1(){\n setTimeout(\'step2()\', 10);}\n function step2(){window.print();window.close()}\n <\/script></head><body onload=\'step1()\'>\n <img src="' + t + '" style="display:block; margin:auto;"></body></html>' + }, + _createOuterContainer: function (t) { + var e = document.createElement('div') + return t.parentNode.insertBefore(e, t), t.parentNode.removeChild(t), e.appendChild(t), e.style.width = t.style.width, e.style.height = t.style.height, e.style.display = 'inline-block', e.style.overflow = 'hidden', e + }, + _removeOuterContainer: function (t, e, n) { + e.parentNode && (e.parentNode.insertBefore(t, e), e.parentNode.removeChild(n), e.parentNode.removeChild(e)) + }, + _addCss: function () { + var t = document.createElement('style') + t.type = 'text/css', t.innerHTML = '.leaflet-control-easyPrint-button { \n background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDUxMiA1MTIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDUxMiA1MTI7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGc+Cgk8cGF0aCBkPSJNMTI4LDMyaDI1NnY2NEgxMjhWMzJ6IE00ODAsMTI4SDMyYy0xNy42LDAtMzIsMTQuNC0zMiwzMnYxNjBjMCwxNy42LDE0LjM5OCwzMiwzMiwzMmg5NnYxMjhoMjU2VjM1Mmg5NiAgIGMxNy42LDAsMzItMTQuNCwzMi0zMlYxNjBDNTEyLDE0Mi40LDQ5Ny42LDEyOCw0ODAsMTI4eiBNMzUyLDQ0OEgxNjBWMjg4aDE5MlY0NDh6IE00ODc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My41IiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA0MzMuNSA0MzMuNTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8Zz4KCTxnIGlkPSJmaWxlLWRvd25sb2FkIj4KCQk8cGF0aCBkPSJNMzk1LjI1LDE1M2gtMTAyVjBoLTE1M3YxNTNoLTEwMmwxNzguNSwxNzguNUwzOTUuMjUsMTUzeiBNMzguMjUsMzgyLjV2NTFoMzU3di01MUgzOC4yNXoiIGZpbGw9IiMwMDAwMDAiLz4KCTwvZz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8Zz4KPC9nPgo8L3N2Zz4K);\n background-size: 16px 16px; \n cursor: pointer; \n }\n .easyPrintHolder a {\n background-size: 16px 16px;\n cursor: pointer;\n }\n .easyPrintHolder .CurrentSize{\n background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iMTZweCIgdmVyc2lvbj0iMS4xIiBoZWlnaHQ9IjE2cHgiIHZpZXdCb3g9IjAgMCA2NCA2NCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgNjQgNjQiPgogI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zcyLjU4MywxNDYuNDgzeiBNNzIuMjUsMzRoMTUwLjE2N3YxMzAuMzMzYzAsOS4zNSw3LjY1LDE3LDE3LDE3aDEzMy4xNjd2MjI5LjVINzIuMjVWMzR6ICAgICIgZmlsbD0iIzAwMDAwMCIvPgoJPC9nPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=);\n }\n .easyPrintHolder .A4Landscape { \n transform: rotate(-90deg);\n }\n\n .leaflet-control-easyPrint-button{\n display: inline-block;\n }\n .easyPrintHolder{\n margin-top:-31px;\n margin-bottom: -5px;\n margin-left: 30px;\n padding-left: 0px;\n display: none;\n }\n\n .easyPrintSizeMode {\n display: inline-block;\n }\n .easyPrintHolder .easyPrintSizeMode a {\n border-radius: 0px;\n }\n\n .easyPrintHolder .easyPrintSizeMode:last-child a{\n border-top-right-radius: 2px;\n border-bottom-right-radius: 2px;\n margin-left: -1px;\n }\n\n .easyPrintPortrait:hover, .easyPrintLandscape:hover{\n background-color: #757570;\n cursor: pointer;\n }', document.body.appendChild(t) + }, + _dataURItoBlob: function (t) { + for (var e = atob(t.split(',')[1]), n = t.split(',')[0].split(':')[1].split(';')[0], i = new ArrayBuffer(e.length), o = new DataView(i), r = 0; r < e.length; r++) o.setUint8(r, e.charCodeAt(r)) + return new Blob([i], { type: n }) + }, + _togglePageSizeButtons: function (t) { + var e = this.holder.style, n = this.link.style + 'mouseover' === t.type ? (e.display = 'block', n.borderTopRightRadius = '0', n.borderBottomRightRadius = '0') : (e.display = 'none', n.borderTopRightRadius = '2px', n.borderBottomRightRadius = '2px') + }, + _toggleControls: function (t) { + var e = document.getElementsByClassName('leaflet-control-container')[0] + if (t) return e.style.display = 'block' + e.style.display = 'none' + }, + _a4PageSize: { + height: 715, + width: 1045 + } + }), L.easyPrint = function (t) { + return new L.Control.EasyPrint(t) + } + }) +//# sourceMappingURL=bundle.js.map +} + +export default { + init +} diff --git a/src/components/plugin/FullScreen.js b/src/components/plugin/FullScreen.js index f96831e..9ef7d5a 100644 --- a/src/components/plugin/FullScreen.js +++ b/src/components/plugin/FullScreen.js @@ -1,175 +1,175 @@ -/* eslint-disable */ -// 鍏ㄥ睆灞曠ず鎻掍欢 -const init = (L) => { - (function (factory) { - if (typeof define === 'function' && define.amd) { - // AMD - define(['leaflet'], factory) - } else if (typeof module !== 'undefined') { - // Node/CommonJS - // module.exports = factory(require('leaflet')) - factory(L) - } else { - // Browser globals - if (typeof window.L === 'undefined') { - throw new Error('Leaflet must be loaded first') - } - factory(window.L) - } - }(function (L) { - L.Control.Fullscreen = L.Control.extend({ - options: { - position: 'topleft', - title: { - false: 'View Fullscreen', - true: 'Exit Fullscreen' - } - }, - - onAdd: function (map) { - var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control') - - this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container) - this.link.href = '#' - - this._map = map - this._map.on('fullscreenchange', this._toggleTitle, this) - this._toggleTitle() - - L.DomEvent.on(this.link, 'click', this._click, this) - - return container - }, - - _click: function (e) { - L.DomEvent.stopPropagation(e) - L.DomEvent.preventDefault(e) - this._map.toggleFullscreen(this.options) - }, - - _toggleTitle: function () { - this.link.title = this.optionsthis._map.isFullscreen()] - } - }) - - L.Map.include({ - isFullscreen: function () { - return this._isFullscreen || false - }, - - toggleFullscreen: function (options) { - var container = this.getContainer() - if (this.isFullscreen()) { - if (options && options.pseudoFullscreen) { - this._disablePseudoFullscreen(container) - } else if (document.exitFullscreen) { - document.exitFullscreen() - } else if (document.mozCancelFullScreen) { - document.mozCancelFullScreen() - } else if (document.webkitCancelFullScreen) { - document.webkitCancelFullScreen() - } else if (document.msExitFullscreen) { - document.msExitFullscreen() - } else { - this._disablePseudoFullscreen(container) - } - } else { - if (options && options.pseudoFullscreen) { - this._enablePseudoFullscreen(container) - } else if (container.requestFullscreen) { - container.requestFullscreen() - } else if (container.mozRequestFullScreen) { - container.mozRequestFullScreen() - } else if (container.webkitRequestFullscreen) { - container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) - } else if (container.msRequestFullscreen) { - container.msRequestFullscreen() - } else { - this._enablePseudoFullscreen(container) - } - } - }, - - _enablePseudoFullscreen: function (container) { - L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') - this._setFullscreen(true) - this.fire('fullscreenchange') - }, - - _disablePseudoFullscreen: function (container) { - L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') - this._setFullscreen(false) - this.fire('fullscreenchange') - }, - - _setFullscreen: function (fullscreen) { - this._isFullscreen = fullscreen - var container = this.getContainer() - if (fullscreen) { - L.DomUtil.addClass(container, 'leaflet-fullscreen-on') - } else { - L.DomUtil.removeClass(container, 'leaflet-fullscreen-on') - } - this.invalidateSize() - }, - - _onFullscreenChange: function (e) { - var fullscreenElement = - document.fullscreenElement || - document.mozFullScreenElement || - document.webkitFullscreenElement || - document.msFullscreenElement - - if (fullscreenElement === this.getContainer() && !this._isFullscreen) { - this._setFullscreen(true) - this.fire('fullscreenchange') - } else if (fullscreenElement !== this.getContainer() && this._isFullscreen) { - this._setFullscreen(false) - this.fire('fullscreenchange') - } - } - }) - - L.Map.mergeOptions({ - fullscreenControl: false - }) - - L.Map.addInitHook(function () { - if (this.options.fullscreenControl) { - this.fullscreenControl = new L.Control.Fullscreen(this.options.fullscreenControl) - this.addControl(this.fullscreenControl) - } - - var fullscreenchange - - if ('onfullscreenchange' in document) { - fullscreenchange = 'fullscreenchange' - } else if ('onmozfullscreenchange' in document) { - fullscreenchange = 'mozfullscreenchange' - } else if ('onwebkitfullscreenchange' in document) { - fullscreenchange = 'webkitfullscreenchange' - } else if ('onmsfullscreenchange' in document) { - fullscreenchange = 'MSFullscreenChange' - } - - if (fullscreenchange) { - var onFullscreenChange = L.bind(this._onFullscreenChange, this) - - this.whenReady(function () { - L.DomEvent.on(document, fullscreenchange, onFullscreenChange) - }) - - this.on('unload', function () { - L.DomEvent.off(document, fullscreenchange, onFullscreenChange) - }) - } - }) - - L.control.fullscreen = function (options) { - return new L.Control.Fullscreen(options) - } - })) -} -export default { - init -} +/* eslint-disable */ +// 鍏ㄥ睆灞曠ず鎻掍欢 +const init = (L) => { + (function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD + define(['leaflet'], factory) + } else if (typeof module !== 'undefined') { + // Node/CommonJS + // module.exports = factory(require('leaflet')) + factory(L) + } else { + // Browser globals + if (typeof window.L === 'undefined') { + throw new Error('Leaflet must be loaded first') + } + factory(window.L) + } + }(function (L) { + L.Control.Fullscreen = L.Control.extend({ + options: { + position: 'topleft', + title: { + false: 'View Fullscreen', + true: 'Exit Fullscreen' + } + }, + + onAdd: function (map) { + var container = L.DomUtil.create('div', 'leaflet-control-fullscreen leaflet-bar leaflet-control') + + this.link = L.DomUtil.create('a', 'leaflet-control-fullscreen-button leaflet-bar-part', container) + this.link.href = '#' + + this._map = map + this._map.on('fullscreenchange', this._toggleTitle, this) + this._toggleTitle() + + L.DomEvent.on(this.link, 'click', this._click, this) + + return container + }, + + _click: function (e) { + L.DomEvent.stopPropagation(e) + L.DomEvent.preventDefault(e) + this._map.toggleFullscreen(this.options) + }, + + _toggleTitle: function () { + this.link.title = this.optionsthis._map.isFullscreen()] + } + }) + + L.Map.include({ + isFullscreen: function () { + return this._isFullscreen || false + }, + + toggleFullscreen: function (options) { + var container = this.getContainer() + if (this.isFullscreen()) { + if (options && options.pseudoFullscreen) { + this._disablePseudoFullscreen(container) + } else if (document.exitFullscreen) { + document.exitFullscreen() + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen() + } else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen() + } else if (document.msExitFullscreen) { + document.msExitFullscreen() + } else { + this._disablePseudoFullscreen(container) + } + } else { + if (options && options.pseudoFullscreen) { + this._enablePseudoFullscreen(container) + } else if (container.requestFullscreen) { + container.requestFullscreen() + } else if (container.mozRequestFullScreen) { + container.mozRequestFullScreen() + } else if (container.webkitRequestFullscreen) { + container.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT) + } else if (container.msRequestFullscreen) { + container.msRequestFullscreen() + } else { + this._enablePseudoFullscreen(container) + } + } + }, + + _enablePseudoFullscreen: function (container) { + L.DomUtil.addClass(container, 'leaflet-pseudo-fullscreen') + this._setFullscreen(true) + this.fire('fullscreenchange') + }, + + _disablePseudoFullscreen: function (container) { + L.DomUtil.removeClass(container, 'leaflet-pseudo-fullscreen') + this._setFullscreen(false) + this.fire('fullscreenchange') + }, + + _setFullscreen: function (fullscreen) { + this._isFullscreen = fullscreen + var container = this.getContainer() + if (fullscreen) { + L.DomUtil.addClass(container, 'leaflet-fullscreen-on') + } else { + L.DomUtil.removeClass(container, 'leaflet-fullscreen-on') + } + this.invalidateSize() + }, + + _onFullscreenChange: function (e) { + var fullscreenElement = + document.fullscreenElement || + document.mozFullScreenElement || + document.webkitFullscreenElement || + document.msFullscreenElement + + if (fullscreenElement === this.getContainer() && !this._isFullscreen) { + this._setFullscreen(true) + this.fire('fullscreenchange') + } else if (fullscreenElement !== this.getContainer() && this._isFullscreen) { + this._setFullscreen(false) + this.fire('fullscreenchange') + } + } + }) + + L.Map.mergeOptions({ + fullscreenControl: false + }) + + L.Map.addInitHook(function () { + if (this.options.fullscreenControl) { + this.fullscreenControl = new L.Control.Fullscreen(this.options.fullscreenControl) + this.addControl(this.fullscreenControl) + } + + var fullscreenchange + + if ('onfullscreenchange' in document) { + fullscreenchange = 'fullscreenchange' + } else if ('onmozfullscreenchange' in document) { + fullscreenchange = 'mozfullscreenchange' + } else if ('onwebkitfullscreenchange' in document) { + fullscreenchange = 'webkitfullscreenchange' + } else if ('onmsfullscreenchange' in document) { + fullscreenchange = 'MSFullscreenChange' + } + + if (fullscreenchange) { + var onFullscreenChange = L.bind(this._onFullscreenChange, this) + + this.whenReady(function () { + L.DomEvent.on(document, fullscreenchange, onFullscreenChange) + }) + + this.on('unload', function () { + L.DomEvent.off(document, fullscreenchange, onFullscreenChange) + }) + } + }) + + L.control.fullscreen = function (options) { + return new L.Control.Fullscreen(options) + } + })) +} +export default { + init +} diff --git a/src/components/plugin/MakeTation.js b/src/components/plugin/MakeTation.js index 311f7c9..9ad3996 100644 --- a/src/components/plugin/MakeTation.js +++ b/src/components/plugin/MakeTation.js @@ -1,125 +1,125 @@ -/* eslint-disable */ -// 娣诲姞鏂囧瓧鏍囨敞 -var TextAnnotation = { - points: [], - color: '', - L: null, - map: null, - layers: null, - polyline: null, - marker: null, - changeColor: '', - changeContent: '', - init: function (map, L) { - // console.log(L) - TextAnnotation.L = L - TextAnnotation.map = map - TextAnnotation.points = [] - TextAnnotation.polyline = null - TextAnnotation.marker = null - TextAnnotation.layers = L.layerGroup() - map.on('click', TextAnnotation.click).on('dblclick', TextAnnotation.dblclick) - }, - // 璁剧疆鏀瑰彉鏂囧瓧鍐呭 - setContent: function (changeContent) { - // console.log(changeContent) - TextAnnotation.changeContent = changeContent - }, - // 璁剧疆鏀瑰彉鏂囧瓧棰滆壊 - setColor: function (changeColor) { - // console.log(changeColor) - TextAnnotation.changeColor = changeColor - }, - click: function (e) { - // console.log(TextAnnotation.changeContent) - let labIcon = L.divIcon({ - html: '<div style="color:' + TextAnnotation.changeColor + ';font-size: 18px;">' + TextAnnotation.changeContent + '</div>', - iconSize: [100, 40], - iconAnchor: [0, 0], - className: '' - }) - let marker = L.marker(e.latlng, { icon: labIcon }) - marker.addTo(TextAnnotation.map) - }, - dblclick: function (e) { - TextAnnotation.map.off('click', TextAnnotation.click).off('dblclick', TextAnnotation.dblclick) - }, - destory: function () { - if (TextAnnotation.polyline) { - TextAnnotation.map.removeLayer(TextAnnotation.polyline) - } - if (TextAnnotation.marker) { - TextAnnotation.marker.remove() - } - if (TextAnnotation.layers) { - TextAnnotation.layers.clearLayers() - } - } -} - -// 娣诲姞 鐐� 鐨勬爣娉� -let pointAnnotation = { - points: [], - color: '', - L: null, - map: null, - layers: null, - polyline: null, - marker: null, - init: function (map, L) { - pointAnnotation.L = L - pointAnnotation.map = map - pointAnnotation.points = [] - pointAnnotation.polyline = null - pointAnnotation.marker = null - pointAnnotation.layers = L.layerGroup() - map.on('click', pointAnnotation.click).on('dblclick', pointAnnotation.dblclick) - }, - click: function (e) { - let marker = L.marker(e.latlng) - marker.addTo(pointAnnotation.map) - }, - dblclick: function (e) { - pointAnnotation.map.off('click', pointAnnotation.click).off('dblclick', pointAnnotation.dblclick) - }, - destory: function () { - if (pointAnnotation.polyline) { - pointAnnotation.map.removeLayer(pointAnnotation.polyline) - } - if (pointAnnotation.marker) { - pointAnnotation.marker.remove() - } - if (pointAnnotation.layers) { - pointAnnotation.layers.clearLayers() - } - } -} - -// 娣诲姞鏂囧瓧鏍囨敞 -const startMakeText = function (map, L) { - TextAnnotation.init(map, L) -} -// 鏂囧瓧鏍囨敞鐨� 鍐呭绀捐缃� -const setContentText = function (text) { - TextAnnotation.setContent(text) -} -// 鏂囧瓧鏍囨敞鍐呭鐨� 棰滆壊 璁剧疆 -const setContentColor = function (color) { - TextAnnotation.setColor(color) -} - -// 鐐� 鏍囨敞 -const StartPointAnnotation = function (map, L) { - pointAnnotation.init(map, L) -} - -const clearText = function () { - startMakeText.destory() -} -export default { - clearText, - startMakeText, - setContentText, - setContentColor, - StartPointAnnotation -} +/* eslint-disable */ +// 娣诲姞鏂囧瓧鏍囨敞 +var TextAnnotation = { + points: [], + color: '', + L: null, + map: null, + layers: null, + polyline: null, + marker: null, + changeColor: '', + changeContent: '', + init: function (map, L) { + // console.log(L) + TextAnnotation.L = L + TextAnnotation.map = map + TextAnnotation.points = [] + TextAnnotation.polyline = null + TextAnnotation.marker = null + TextAnnotation.layers = L.layerGroup() + map.on('click', TextAnnotation.click).on('dblclick', TextAnnotation.dblclick) + }, + // 璁剧疆鏀瑰彉鏂囧瓧鍐呭 + setContent: function (changeContent) { + // console.log(changeContent) + TextAnnotation.changeContent = changeContent + }, + // 璁剧疆鏀瑰彉鏂囧瓧棰滆壊 + setColor: function (changeColor) { + // console.log(changeColor) + TextAnnotation.changeColor = changeColor + }, + click: function (e) { + // console.log(TextAnnotation.changeContent) + let labIcon = L.divIcon({ + html: '<div style="color:' + TextAnnotation.changeColor + ';font-size: 18px;">' + TextAnnotation.changeContent + '</div>', + iconSize: [100, 40], + iconAnchor: [0, 0], + className: '' + }) + let marker = L.marker(e.latlng, { icon: labIcon }) + marker.addTo(TextAnnotation.map) + }, + dblclick: function (e) { + TextAnnotation.map.off('click', TextAnnotation.click).off('dblclick', TextAnnotation.dblclick) + }, + destory: function () { + if (TextAnnotation.polyline) { + TextAnnotation.map.removeLayer(TextAnnotation.polyline) + } + if (TextAnnotation.marker) { + TextAnnotation.marker.remove() + } + if (TextAnnotation.layers) { + TextAnnotation.layers.clearLayers() + } + } +} + +// 娣诲姞 鐐� 鐨勬爣娉� +let pointAnnotation = { + points: [], + color: '', + L: null, + map: null, + layers: null, + polyline: null, + marker: null, + init: function (map, L) { + pointAnnotation.L = L + pointAnnotation.map = map + pointAnnotation.points = [] + pointAnnotation.polyline = null + pointAnnotation.marker = null + pointAnnotation.layers = L.layerGroup() + map.on('click', pointAnnotation.click).on('dblclick', pointAnnotation.dblclick) + }, + click: function (e) { + let marker = L.marker(e.latlng) + marker.addTo(pointAnnotation.map) + }, + dblclick: function (e) { + pointAnnotation.map.off('click', pointAnnotation.click).off('dblclick', pointAnnotation.dblclick) + }, + destory: function () { + if (pointAnnotation.polyline) { + pointAnnotation.map.removeLayer(pointAnnotation.polyline) + } + if (pointAnnotation.marker) { + pointAnnotation.marker.remove() + } + if (pointAnnotation.layers) { + pointAnnotation.layers.clearLayers() + } + } +} + +// 娣诲姞鏂囧瓧鏍囨敞 +const startMakeText = function (map, L) { + TextAnnotation.init(map, L) +} +// 鏂囧瓧鏍囨敞鐨� 鍐呭绀捐缃� +const setContentText = function (text) { + TextAnnotation.setContent(text) +} +// 鏂囧瓧鏍囨敞鍐呭鐨� 棰滆壊 璁剧疆 +const setContentColor = function (color) { + TextAnnotation.setColor(color) +} + +// 鐐� 鏍囨敞 +const StartPointAnnotation = function (map, L) { + pointAnnotation.init(map, L) +} + +const clearText = function () { + startMakeText.destory() +} +export default { + clearText, + startMakeText, + setContentText, + setContentColor, + StartPointAnnotation +} diff --git a/src/components/plugin/MeaSure.js b/src/components/plugin/MeaSure.js index ce67a00..a540743 100644 --- a/src/components/plugin/MeaSure.js +++ b/src/components/plugin/MeaSure.js @@ -1,170 +1,170 @@ -/* eslint-disable */ -// 闈㈢Н娴嬮噺鏂规硶 -var areaMeasure = { - points: [], -// markers:[], - color: 'red', - L: null, - layers: null, - polygon: null, - marker: null, - init: function (map, L) { - areaMeasure.L = L - areaMeasure.map = map - areaMeasure.points = [] - areaMeasure.polygon = null - areaMeasure.marker = null - areaMeasure.layers = L.layerGroup() - areaMeasure.map.on('click', areaMeasure.click).on('dblclick', areaMeasure.dblclick) - }, - close: function (latlng) { - /*areaMeasure.marker = L.marker(latlng, { icon: deleteIcon }).addTo(map).on("click", function (e) { - //console.log('marker',e); - if(areaMeasure.polygon) - map.removeLayer(areaMeasure.polygon); - - if(areaMeasure.marker) - areaMeasure.marker.remove(); - }); - //areaMeasure.markers.push(marker); - */ - - }, - click: function (e) { - areaMeasure.map.doubleClickZoom.disable() -// 娣诲姞鐐逛俊鎭� - areaMeasure.points.push(e.latlng) -// 娣诲姞闈� - areaMeasure.map.on('mousemove', areaMeasure.mousemove) - }, - mousemove: function (e) { - areaMeasure.points.push(e.latlng) - if (areaMeasure.polygon) { - areaMeasure.map.removeLayer(areaMeasure.polygon) - } - areaMeasure.polygon = areaMeasure.L.polygon(areaMeasure.points, { - showMeasurements: true, - color: 'red' - }) -//areaMeasure.polygon.addTo(map); - areaMeasure.polygon.addTo(areaMeasure.layers) - areaMeasure.layers.addTo(areaMeasure.map) - areaMeasure.points.pop() - }, - dblclick: function (e) { // 鍙屽嚮缁撴潫 - console.log('鍙屽嚮缁撴潫', e) - areaMeasure.polygon.enableEdit() - areaMeasure.polygon.dragging.disable() - areaMeasure.map.on('editable:vertex:drag editable:vertex:deleted', areaMeasure.polygon.updateMeasurements, areaMeasure.polygon) - areaMeasure.polygon.addTo(areaMeasure.layers) - areaMeasure.close(e.latlng) -//areaMeasure.polygon.enableEdit(); -//map.on('editable:vertex:drag editable:vertex:deleted', areaMeasure.polygon.updateMeasurements, areaMeasure.polygon); - areaMeasure.map.off('click', areaMeasure.click).off('mousemove', areaMeasure.mousemove).off('dblclick', areaMeasure.dblclick) - }, - destory: function () { - if (areaMeasure.polygon) { - areaMeasure.map.removeLayer(areaMeasure.polygon) - } - - if (areaMeasure.marker) { - areaMeasure.marker.remove() - } - if (areaMeasure.layers) { - areaMeasure.layers.clearLayers() - } - } -} - -// 璺濈娴嬮噺鏂规硶 -var distanceMeasure = { - points: [], -// markers:[], - color: 'blue', - L: null, - map: null, - layers: null, - polyline: null, - marker: null, - init: function (map, L) { - // console.log(L) - distanceMeasure.L = L - distanceMeasure.map = map - distanceMeasure.points = [] - distanceMeasure.polyline = null - distanceMeasure.marker = null - distanceMeasure.layers = L.layerGroup() - map.on('click', distanceMeasure.click).on('dblclick', distanceMeasure.dblclick) - }, - close: function (latlng) { - /*distanceMeasure.marker = L.marker(latlng, { icon: deleteIcon }).addTo(map).on("click", function (e) { - //console.log('marker',e); - if(distanceMeasure.polyline) - map.removeLayer(distanceMeasure.polyline); - - if(distanceMeasure.marker) - distanceMeasure.marker.remove(); - });*/ - }, - click: function (e) { - distanceMeasure.map.doubleClickZoom.disable() -// 娣诲姞鐐逛俊鎭� - distanceMeasure.points.push(e.latlng) -// 娣诲姞绾� - distanceMeasure.map.on('mousemove', distanceMeasure.mousemove) - }, - mousemove: function (e) { - distanceMeasure.points.push(e.latlng) - if (distanceMeasure.polyline) { - distanceMeasure.map.removeLayer(distanceMeasure.polyline) - } - distanceMeasure.polyline = distanceMeasure.L.polyline(distanceMeasure.points, { - showMeasurements: true, - color: 'red' - }) - distanceMeasure.polyline.addTo(distanceMeasure.layers) - // distanceMeasure.polyline.enableEdit() - distanceMeasure.layers.addTo(distanceMeasure.map) - distanceMeasure.points.pop() - }, - dblclick: function (e) { // 鍙屽嚮缁撴潫 - console.log('鍙屽嚮缁撴潫', e) - distanceMeasure.polyline.enableEdit() - distanceMeasure.polyline.dragging.disable() - distanceMeasure.polyline.addTo(distanceMeasure.layers) - distanceMeasure.map.on('editable:vertex:drag editable:vertex:deleted', distanceMeasure.polyline.updateMeasurements, distanceMeasure.polyline) - distanceMeasure.close(e.latlng) - distanceMeasure.map.off('click', distanceMeasure.click).off('mousemove', distanceMeasure.mousemove).off('dblclick', distanceMeasure.dblclick) - }, - destory: function () { - if (distanceMeasure.polyline) { - distanceMeasure.map.removeLayer(distanceMeasure.polyline) - } - if (distanceMeasure.marker) { - distanceMeasure.marker.remove() - } - if (distanceMeasure.layers) { - distanceMeasure.layers.clearLayers() - } - } -} - -const startMeasureArea = function (map, L) { - areaMeasure.destory() - areaMeasure.init(map, L) -} - -const startMeasureLen = function (map, L) { - distanceMeasure.destory() - distanceMeasure.init(map, L) -} - -const clearMeasure = function () { - areaMeasure.destory() - distanceMeasure.destory() -} -export default { - startMeasureArea, - startMeasureLen, - clearMeasure -} +/* eslint-disable */ +// 闈㈢Н娴嬮噺鏂规硶 +var areaMeasure = { + points: [], +// markers:[], + color: 'red', + L: null, + layers: null, + polygon: null, + marker: null, + init: function (map, L) { + areaMeasure.L = L + areaMeasure.map = map + areaMeasure.points = [] + areaMeasure.polygon = null + areaMeasure.marker = null + areaMeasure.layers = L.layerGroup() + areaMeasure.map.on('click', areaMeasure.click).on('dblclick', areaMeasure.dblclick) + }, + close: function (latlng) { + /*areaMeasure.marker = L.marker(latlng, { icon: deleteIcon }).addTo(map).on("click", function (e) { + //console.log('marker',e); + if(areaMeasure.polygon) + map.removeLayer(areaMeasure.polygon); + + if(areaMeasure.marker) + areaMeasure.marker.remove(); + }); + //areaMeasure.markers.push(marker); + */ + + }, + click: function (e) { + areaMeasure.map.doubleClickZoom.disable() +// 娣诲姞鐐逛俊鎭� + areaMeasure.points.push(e.latlng) +// 娣诲姞闈� + areaMeasure.map.on('mousemove', areaMeasure.mousemove) + }, + mousemove: function (e) { + areaMeasure.points.push(e.latlng) + if (areaMeasure.polygon) { + areaMeasure.map.removeLayer(areaMeasure.polygon) + } + areaMeasure.polygon = areaMeasure.L.polygon(areaMeasure.points, { + showMeasurements: true, + color: 'red' + }) +//areaMeasure.polygon.addTo(map); + areaMeasure.polygon.addTo(areaMeasure.layers) + areaMeasure.layers.addTo(areaMeasure.map) + areaMeasure.points.pop() + }, + dblclick: function (e) { // 鍙屽嚮缁撴潫 + console.log('鍙屽嚮缁撴潫', e) + areaMeasure.polygon.enableEdit() + areaMeasure.polygon.dragging.disable() + areaMeasure.map.on('editable:vertex:drag editable:vertex:deleted', areaMeasure.polygon.updateMeasurements, areaMeasure.polygon) + areaMeasure.polygon.addTo(areaMeasure.layers) + areaMeasure.close(e.latlng) +//areaMeasure.polygon.enableEdit(); +//map.on('editable:vertex:drag editable:vertex:deleted', areaMeasure.polygon.updateMeasurements, areaMeasure.polygon); + areaMeasure.map.off('click', areaMeasure.click).off('mousemove', areaMeasure.mousemove).off('dblclick', areaMeasure.dblclick) + }, + destory: function () { + if (areaMeasure.polygon) { + areaMeasure.map.removeLayer(areaMeasure.polygon) + } + + if (areaMeasure.marker) { + areaMeasure.marker.remove() + } + if (areaMeasure.layers) { + areaMeasure.layers.clearLayers() + } + } +} + +// 璺濈娴嬮噺鏂规硶 +var distanceMeasure = { + points: [], +// markers:[], + color: 'blue', + L: null, + map: null, + layers: null, + polyline: null, + marker: null, + init: function (map, L) { + // console.log(L) + distanceMeasure.L = L + distanceMeasure.map = map + distanceMeasure.points = [] + distanceMeasure.polyline = null + distanceMeasure.marker = null + distanceMeasure.layers = L.layerGroup() + map.on('click', distanceMeasure.click).on('dblclick', distanceMeasure.dblclick) + }, + close: function (latlng) { + /*distanceMeasure.marker = L.marker(latlng, { icon: deleteIcon }).addTo(map).on("click", function (e) { + //console.log('marker',e); + if(distanceMeasure.polyline) + map.removeLayer(distanceMeasure.polyline); + + if(distanceMeasure.marker) + distanceMeasure.marker.remove(); + });*/ + }, + click: function (e) { + distanceMeasure.map.doubleClickZoom.disable() +// 娣诲姞鐐逛俊鎭� + distanceMeasure.points.push(e.latlng) +// 娣诲姞绾� + distanceMeasure.map.on('mousemove', distanceMeasure.mousemove) + }, + mousemove: function (e) { + distanceMeasure.points.push(e.latlng) + if (distanceMeasure.polyline) { + distanceMeasure.map.removeLayer(distanceMeasure.polyline) + } + distanceMeasure.polyline = distanceMeasure.L.polyline(distanceMeasure.points, { + showMeasurements: true, + color: 'red' + }) + distanceMeasure.polyline.addTo(distanceMeasure.layers) + // distanceMeasure.polyline.enableEdit() + distanceMeasure.layers.addTo(distanceMeasure.map) + distanceMeasure.points.pop() + }, + dblclick: function (e) { // 鍙屽嚮缁撴潫 + console.log('鍙屽嚮缁撴潫', e) + distanceMeasure.polyline.enableEdit() + distanceMeasure.polyline.dragging.disable() + distanceMeasure.polyline.addTo(distanceMeasure.layers) + distanceMeasure.map.on('editable:vertex:drag editable:vertex:deleted', distanceMeasure.polyline.updateMeasurements, distanceMeasure.polyline) + distanceMeasure.close(e.latlng) + distanceMeasure.map.off('click', distanceMeasure.click).off('mousemove', distanceMeasure.mousemove).off('dblclick', distanceMeasure.dblclick) + }, + destory: function () { + if (distanceMeasure.polyline) { + distanceMeasure.map.removeLayer(distanceMeasure.polyline) + } + if (distanceMeasure.marker) { + distanceMeasure.marker.remove() + } + if (distanceMeasure.layers) { + distanceMeasure.layers.clearLayers() + } + } +} + +const startMeasureArea = function (map, L) { + areaMeasure.destory() + areaMeasure.init(map, L) +} + +const startMeasureLen = function (map, L) { + distanceMeasure.destory() + distanceMeasure.init(map, L) +} + +const clearMeasure = function () { + areaMeasure.destory() + distanceMeasure.destory() +} +export default { + startMeasureArea, + startMeasureLen, + clearMeasure +} diff --git a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.css b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.css index b583261..35e46d5 100644 --- a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.css +++ b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.css @@ -1,22 +1,22 @@ -.leaflet-measure-path-measurement { - position: absolute; - font-size: 10px; - color: black; - text-shadow: -1px 0 0 white, - -1px -1px 0 white, - 0 -1px 0 white, - 1px -1px 0 white, - 1px 0 0 white, - 1px 1px 0 white, - 0 1px 0 white, - -1px 1px 0 white; - white-space: nowrap; - transform-origin: 0; - pointer-events: none; -} - -.leaflet-measure-path-measurement > div { - position: relative; - margin-top: -25%; - left: -50%; -} +.leaflet-measure-path-measurement { + position: absolute; + font-size: 10px; + color: black; + text-shadow: -1px 0 0 white, + -1px -1px 0 white, + 0 -1px 0 white, + 1px -1px 0 white, + 1px 0 0 white, + 1px 1px 0 white, + 0 1px 0 white, + -1px 1px 0 white; + white-space: nowrap; + transform-origin: 0; + pointer-events: none; +} + +.leaflet-measure-path-measurement > div { + position: relative; + margin-top: -25%; + left: -50%; +} diff --git a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js index 2f8a696..88338eb 100644 --- a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js +++ b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js @@ -1,421 +1,421 @@ -/* eslint-disable */ - !(function() { - 'use strict' - - L.Marker.Measurement = L[L.Layer ? 'Layer' : 'Class'].extend({ - options: { - pane: 'markerPane' - }, - - initialize: function(latlng, measurement, title, rotation, options) { - L.setOptions(this, options) - - this._latlng = latlng - this._measurement = measurement - this._title = title - this._rotation = rotation - }, - - addTo: function(map) { - map.addLayer(this) - return this - }, - - onAdd: function(map) { - this._map = map - var pane = this.getPane ? this.getPane() : map.getPanes().markerPane - var el = this._element = L.DomUtil.create('div', 'leaflet-zoom-animated leaflet-measure-path-measurement', pane) - var inner = L.DomUtil.create('div', '', el) - inner.title = this._title - inner.innerHTML = this._measurement - - map.on('zoomanim', this._animateZoom, this) - - this._setPosition() - }, - - onRemove: function(map) { - map.off('zoomanim', this._animateZoom, this) - var pane = this.getPane ? this.getPane() : map.getPanes().markerPane - pane.removeChild(this._element) - this._map = null - }, - - _setPosition: function() { - L.DomUtil.setPosition(this._element, this._map.latLngToLayerPoint(this._latlng)) - this._element.style.transform += ' rotate(' + this._rotation + 'rad)' - }, - - _animateZoom: function(opt) { - var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round() - L.DomUtil.setPosition(this._element, pos) - this._element.style.transform += ' rotate(' + this._rotation + 'rad)' - } - }) - - L.marker.measurement = function(latLng, measurement, title, rotation, options) { - return new L.Marker.Measurement(latLng, measurement, title, rotation, options) - } - - var formatDistance = function(d) { - var unit, - feet - - if (this._measurementOptions.imperial) { - feet = d / 0.3048 - if (feet > 3000) { - d = d / 1609.344 - unit = 'mi' - } else { - d = feet - unit = 'ft' - } - } else { - if (d > 1000) { - d = d / 1000 - unit = 'km' - } else { - unit = 'm' - } - } - - if (d < 100) { - return d.toFixed(1) + ' ' + unit - } else { - return Math.round(d) + ' ' + unit - } - } - - var formatArea = function(a) { - var unit, - sqfeet - - if (this._measurementOptions.imperial) { - if (a > 404.685642) { - a = a / 4046.85642 - unit = 'ac' - } else { - a = a / 0.09290304 - unit = 'ft虏' - } - } else { - if (a > 1000000) { - a = a / 1000000 - unit = 'km虏' - } else { - unit = 'm虏' - } - } - - if (a < 100) { - return a.toFixed(1) + ' ' + unit - } else { - return Math.round(a) + ' ' + unit - } - } - - var RADIUS = 6378137 - // ringArea function copied from geojson-area - // (https://github.com/mapbox/geojson-area) - // This function is distributed under a separate license, - // see LICENSE.md. - var ringArea = function ringArea(coords) { - var rad = function rad(_) { - return _ * Math.PI / 180 - } - var p1, p2, p3, lowerIndex, middleIndex, upperIndex, - area = 0, - coordsLength = coords.length - - if (coordsLength > 2) { - for (var i = 0; i < coordsLength; i++) { - if (i === coordsLength - 2) {// i = N-2 - lowerIndex = coordsLength - 2 - middleIndex = coordsLength -1 - upperIndex = 0 - } else if (i === coordsLength - 1) {// i = N-1 - lowerIndex = coordsLength - 1 - middleIndex = 0 - upperIndex = 1 - } else { // i = 0 to N-3 - lowerIndex = i - middleIndex = i+1 - upperIndex = i+2 - } - p1 = coords[lowerIndex] - p2 = coords[middleIndex] - p3 = coords[upperIndex] - area += ( rad(p3.lng) - rad(p1.lng) ) * Math.sin( rad(p2.lat)) - } - - area = area * RADIUS * RADIUS / 2 - } - - return Math.abs(area) - } - /** - * Handles the init hook for polylines and circles. - * Implements the showOnHover functionality if called for. - */ - var addInitHook = function() { - var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover - if (this.options.showMeasurements && !showOnHover) { - this.showMeasurements() - } - if (this.options.showMeasurements && showOnHover) { - this.on('mouseover', function() { - this.showMeasurements() - }) - this.on('mouseout', function() { - this.hideMeasurements() - }) - } - } - - var circleArea = function circleArea(d) { - var rho = d / RADIUS - return 2 * Math.PI * RADIUS * RADIUS * (1 - Math.cos(rho)) - } - - var override = function(method, fn, hookAfter) { - if (!hookAfter) { - return function() { - var originalReturnValue = method.apply(this, arguments) - var args = Array.prototype.slice.call(arguments) - args.push(originalReturnValue) - return fn.apply(this, args) - } - } else { - return function() { - fn.apply(this, arguments) - return method.apply(this, arguments) - } - } - } - - L.Polyline.include({ - showMeasurements: function(options) { - if (!this._map || this._measurementLayer) return this - - this._measurementOptions = L.extend({ - showOnHover: (options && options.showOnHover) || false, - minPixelDistance: 30, - showDistances: true, - showArea: true, - showTotalDistance: true, - lang: { - totalLength: 'Total length', - totalArea: 'Total area', - segmentLength: 'Segment length' - } - }, options || {}) - - this._measurementLayer = L.layerGroup().addTo(this._map) - this.updateMeasurements() - - this._map.on('zoomend', this.updateMeasurements, this) - - return this - }, - - hideMeasurements: function() { - if (!this._map) return this - - this._map.off('zoomend', this.updateMeasurements, this) - - if (!this._measurementLayer) return this - this._map.removeLayer(this._measurementLayer) - this._measurementLayer = null - - return this - }, - - onAdd: override(L.Polyline.prototype.onAdd, function(originalReturnValue) { - var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover - if (this.options.showMeasurements && !showOnHover) { - this.showMeasurements(this.options.measurementOptions) - } - - return originalReturnValue - }), - - onRemove: override(L.Polyline.prototype.onRemove, function(originalReturnValue) { - this.hideMeasurements() - - return originalReturnValue - }, true), - - setLatLngs: override(L.Polyline.prototype.setLatLngs, function(originalReturnValue) { - this.updateMeasurements() - - return originalReturnValue - }), - - spliceLatLngs: override(L.Polyline.prototype.spliceLatLngs, function(originalReturnValue) { - this.updateMeasurements() - - return originalReturnValue - }), - - formatDistance: formatDistance, - formatArea: formatArea, - - updateMeasurements: function() { - if (!this._measurementLayer) return this - - var latLngs = this.getLatLngs(), - isPolygon = this instanceof L.Polygon, - options = this._measurementOptions, - totalDist = 0, - formatter, - ll1, - ll2, - p1, - p2, - pixelDist, - dist - - if (latLngs && latLngs.length && L.Util.isArray(latLngs[0])) { - // Outer ring is stored as an array in the first element, - // use that instead. - latLngs = latLngs[0] - } - - this._measurementLayer.clearLayers() - - if (this._measurementOptions.showDistances && latLngs.length > 1) { - formatter = this._measurementOptions.formatDistance || L.bind(this.formatDistance, this) - - for (var i = 1, len = latLngs.length; (isPolygon && i <= len) || i < len; i++) { - ll1 = latLngs[i - 1] - ll2 = latLngs[i % len] - dist = ll1.distanceTo(ll2) - totalDist += dist - - p1 = this._map.latLngToLayerPoint(ll1) - p2 = this._map.latLngToLayerPoint(ll2) - - pixelDist = p1.distanceTo(p2) - - if (pixelDist >= options.minPixelDistance) { - L.marker.measurement( - this._map.layerPointToLatLng([(p1.x + p2.x) / 2, (p1.y + p2.y) / 2]), - formatter(dist), options.lang.segmentLength, this._getRotation(ll1, ll2), options) - .addTo(this._measurementLayer) - } - } - - // Show total length for polylines - if (!isPolygon && this._measurementOptions.showTotalDistance) { - L.marker.measurement(ll2, formatter(totalDist), options.lang.totalLength, 0, options) - .addTo(this._measurementLayer) - } - } - - if (isPolygon && options.showArea && latLngs.length > 2) { - formatter = options.formatArea || L.bind(this.formatArea, this) - var area = ringArea(latLngs) - L.marker.measurement(this.getBounds().getCenter(), - formatter(area), options.lang.totalArea, 0, options) - .addTo(this._measurementLayer) - } - - return this - }, - - _getRotation: function(ll1, ll2) { - var p1 = this._map.project(ll1), - p2 = this._map.project(ll2) - - return Math.atan((p2.y - p1.y) / (p2.x - p1.x)) - } - }) - - L.Polyline.addInitHook(function() { - addInitHook.call(this) - }) - - L.Circle.include({ - showMeasurements: function(options) { - if (!this._map || this._measurementLayer) return this - - this._measurementOptions = L.extend({ - showOnHover: false, - showArea: true, - lang: { - totalArea: 'Total area', - } - }, options || {}) - - this._measurementLayer = L.layerGroup().addTo(this._map) - this.updateMeasurements() - - this._map.on('zoomend', this.updateMeasurements, this) - - return this - }, - - hideMeasurements: function() { - if (!this._map) return this - - this._map.on('zoomend', this.updateMeasurements, this) - - if (!this._measurementLayer) return this - this._map.removeLayer(this._measurementLayer) - this._measurementLayer = null - - return this - }, - - onAdd: override(L.Circle.prototype.onAdd, function(originalReturnValue) { - var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover - if (this.options.showMeasurements && !showOnHover) { - this.showMeasurements(this.options.measurementOptions) - } - - return originalReturnValue - }), - - onRemove: override(L.Circle.prototype.onRemove, function(originalReturnValue) { - this.hideMeasurements() - - return originalReturnValue - }, true), - - setLatLng: override(L.Circle.prototype.setLatLng, function(originalReturnValue) { - this.updateMeasurements() - - return originalReturnValue - }), - - setRadius: override(L.Circle.prototype.setRadius, function(originalReturnValue) { - this.updateMeasurements() - - return originalReturnValue - }), - - formatArea: formatArea, - - updateMeasurements: function() { - if (!this._measurementLayer) return - - var latLng = this.getLatLng(), - options = this._measurementOptions, - formatter = options.formatArea || L.bind(this.formatArea, this) - - this._measurementLayer.clearLayers() - - if (options.showArea) { - formatter = options.formatArea || L.bind(this.formatArea, this) - var area = circleArea(this.getRadius()) - L.marker.measurement(latLng, - formatter(area), options.lang.totalArea, 0, options) - .addTo(this._measurementLayer) - } - } - }) - - L.Circle.addInitHook(function() { - addInitHook.call(this) - }) +/* eslint-disable */ + !(function() { + 'use strict' + + L.Marker.Measurement = L[L.Layer ? 'Layer' : 'Class'].extend({ + options: { + pane: 'markerPane' + }, + + initialize: function(latlng, measurement, title, rotation, options) { + L.setOptions(this, options) + + this._latlng = latlng + this._measurement = measurement + this._title = title + this._rotation = rotation + }, + + addTo: function(map) { + map.addLayer(this) + return this + }, + + onAdd: function(map) { + this._map = map + var pane = this.getPane ? this.getPane() : map.getPanes().markerPane + var el = this._element = L.DomUtil.create('div', 'leaflet-zoom-animated leaflet-measure-path-measurement', pane) + var inner = L.DomUtil.create('div', '', el) + inner.title = this._title + inner.innerHTML = this._measurement + + map.on('zoomanim', this._animateZoom, this) + + this._setPosition() + }, + + onRemove: function(map) { + map.off('zoomanim', this._animateZoom, this) + var pane = this.getPane ? this.getPane() : map.getPanes().markerPane + pane.removeChild(this._element) + this._map = null + }, + + _setPosition: function() { + L.DomUtil.setPosition(this._element, this._map.latLngToLayerPoint(this._latlng)) + this._element.style.transform += ' rotate(' + this._rotation + 'rad)' + }, + + _animateZoom: function(opt) { + var pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round() + L.DomUtil.setPosition(this._element, pos) + this._element.style.transform += ' rotate(' + this._rotation + 'rad)' + } + }) + + L.marker.measurement = function(latLng, measurement, title, rotation, options) { + return new L.Marker.Measurement(latLng, measurement, title, rotation, options) + } + + var formatDistance = function(d) { + var unit, + feet + + if (this._measurementOptions.imperial) { + feet = d / 0.3048 + if (feet > 3000) { + d = d / 1609.344 + unit = 'mi' + } else { + d = feet + unit = 'ft' + } + } else { + if (d > 1000) { + d = d / 1000 + unit = 'km' + } else { + unit = 'm' + } + } + + if (d < 100) { + return d.toFixed(1) + ' ' + unit + } else { + return Math.round(d) + ' ' + unit + } + } + + var formatArea = function(a) { + var unit, + sqfeet + + if (this._measurementOptions.imperial) { + if (a > 404.685642) { + a = a / 4046.85642 + unit = 'ac' + } else { + a = a / 0.09290304 + unit = 'ft虏' + } + } else { + if (a > 1000000) { + a = a / 1000000 + unit = 'km虏' + } else { + unit = 'm虏' + } + } + + if (a < 100) { + return a.toFixed(1) + ' ' + unit + } else { + return Math.round(a) + ' ' + unit + } + } + + var RADIUS = 6378137 + // ringArea function copied from geojson-area + // (https://github.com/mapbox/geojson-area) + // This function is distributed under a separate license, + // see LICENSE.md. + var ringArea = function ringArea(coords) { + var rad = function rad(_) { + return _ * Math.PI / 180 + } + var p1, p2, p3, lowerIndex, middleIndex, upperIndex, + area = 0, + coordsLength = coords.length + + if (coordsLength > 2) { + for (var i = 0; i < coordsLength; i++) { + if (i === coordsLength - 2) {// i = N-2 + lowerIndex = coordsLength - 2 + middleIndex = coordsLength -1 + upperIndex = 0 + } else if (i === coordsLength - 1) {// i = N-1 + lowerIndex = coordsLength - 1 + middleIndex = 0 + upperIndex = 1 + } else { // i = 0 to N-3 + lowerIndex = i + middleIndex = i+1 + upperIndex = i+2 + } + p1 = coords[lowerIndex] + p2 = coords[middleIndex] + p3 = coords[upperIndex] + area += ( rad(p3.lng) - rad(p1.lng) ) * Math.sin( rad(p2.lat)) + } + + area = area * RADIUS * RADIUS / 2 + } + + return Math.abs(area) + } + /** + * Handles the init hook for polylines and circles. + * Implements the showOnHover functionality if called for. + */ + var addInitHook = function() { + var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover + if (this.options.showMeasurements && !showOnHover) { + this.showMeasurements() + } + if (this.options.showMeasurements && showOnHover) { + this.on('mouseover', function() { + this.showMeasurements() + }) + this.on('mouseout', function() { + this.hideMeasurements() + }) + } + } + + var circleArea = function circleArea(d) { + var rho = d / RADIUS + return 2 * Math.PI * RADIUS * RADIUS * (1 - Math.cos(rho)) + } + + var override = function(method, fn, hookAfter) { + if (!hookAfter) { + return function() { + var originalReturnValue = method.apply(this, arguments) + var args = Array.prototype.slice.call(arguments) + args.push(originalReturnValue) + return fn.apply(this, args) + } + } else { + return function() { + fn.apply(this, arguments) + return method.apply(this, arguments) + } + } + } + + L.Polyline.include({ + showMeasurements: function(options) { + if (!this._map || this._measurementLayer) return this + + this._measurementOptions = L.extend({ + showOnHover: (options && options.showOnHover) || false, + minPixelDistance: 30, + showDistances: true, + showArea: true, + showTotalDistance: true, + lang: { + totalLength: 'Total length', + totalArea: 'Total area', + segmentLength: 'Segment length' + } + }, options || {}) + + this._measurementLayer = L.layerGroup().addTo(this._map) + this.updateMeasurements() + + this._map.on('zoomend', this.updateMeasurements, this) + + return this + }, + + hideMeasurements: function() { + if (!this._map) return this + + this._map.off('zoomend', this.updateMeasurements, this) + + if (!this._measurementLayer) return this + this._map.removeLayer(this._measurementLayer) + this._measurementLayer = null + + return this + }, + + onAdd: override(L.Polyline.prototype.onAdd, function(originalReturnValue) { + var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover + if (this.options.showMeasurements && !showOnHover) { + this.showMeasurements(this.options.measurementOptions) + } + + return originalReturnValue + }), + + onRemove: override(L.Polyline.prototype.onRemove, function(originalReturnValue) { + this.hideMeasurements() + + return originalReturnValue + }, true), + + setLatLngs: override(L.Polyline.prototype.setLatLngs, function(originalReturnValue) { + this.updateMeasurements() + + return originalReturnValue + }), + + spliceLatLngs: override(L.Polyline.prototype.spliceLatLngs, function(originalReturnValue) { + this.updateMeasurements() + + return originalReturnValue + }), + + formatDistance: formatDistance, + formatArea: formatArea, + + updateMeasurements: function() { + if (!this._measurementLayer) return this + + var latLngs = this.getLatLngs(), + isPolygon = this instanceof L.Polygon, + options = this._measurementOptions, + totalDist = 0, + formatter, + ll1, + ll2, + p1, + p2, + pixelDist, + dist + + if (latLngs && latLngs.length && L.Util.isArray(latLngs[0])) { + // Outer ring is stored as an array in the first element, + // use that instead. + latLngs = latLngs[0] + } + + this._measurementLayer.clearLayers() + + if (this._measurementOptions.showDistances && latLngs.length > 1) { + formatter = this._measurementOptions.formatDistance || L.bind(this.formatDistance, this) + + for (var i = 1, len = latLngs.length; (isPolygon && i <= len) || i < len; i++) { + ll1 = latLngs[i - 1] + ll2 = latLngs[i % len] + dist = ll1.distanceTo(ll2) + totalDist += dist + + p1 = this._map.latLngToLayerPoint(ll1) + p2 = this._map.latLngToLayerPoint(ll2) + + pixelDist = p1.distanceTo(p2) + + if (pixelDist >= options.minPixelDistance) { + L.marker.measurement( + this._map.layerPointToLatLng([(p1.x + p2.x) / 2, (p1.y + p2.y) / 2]), + formatter(dist), options.lang.segmentLength, this._getRotation(ll1, ll2), options) + .addTo(this._measurementLayer) + } + } + + // Show total length for polylines + if (!isPolygon && this._measurementOptions.showTotalDistance) { + L.marker.measurement(ll2, formatter(totalDist), options.lang.totalLength, 0, options) + .addTo(this._measurementLayer) + } + } + + if (isPolygon && options.showArea && latLngs.length > 2) { + formatter = options.formatArea || L.bind(this.formatArea, this) + var area = ringArea(latLngs) + L.marker.measurement(this.getBounds().getCenter(), + formatter(area), options.lang.totalArea, 0, options) + .addTo(this._measurementLayer) + } + + return this + }, + + _getRotation: function(ll1, ll2) { + var p1 = this._map.project(ll1), + p2 = this._map.project(ll2) + + return Math.atan((p2.y - p1.y) / (p2.x - p1.x)) + } + }) + + L.Polyline.addInitHook(function() { + addInitHook.call(this) + }) + + L.Circle.include({ + showMeasurements: function(options) { + if (!this._map || this._measurementLayer) return this + + this._measurementOptions = L.extend({ + showOnHover: false, + showArea: true, + lang: { + totalArea: 'Total area', + } + }, options || {}) + + this._measurementLayer = L.layerGroup().addTo(this._map) + this.updateMeasurements() + + this._map.on('zoomend', this.updateMeasurements, this) + + return this + }, + + hideMeasurements: function() { + if (!this._map) return this + + this._map.on('zoomend', this.updateMeasurements, this) + + if (!this._measurementLayer) return this + this._map.removeLayer(this._measurementLayer) + this._measurementLayer = null + + return this + }, + + onAdd: override(L.Circle.prototype.onAdd, function(originalReturnValue) { + var showOnHover = this.options.measurementOptions && this.options.measurementOptions.showOnHover + if (this.options.showMeasurements && !showOnHover) { + this.showMeasurements(this.options.measurementOptions) + } + + return originalReturnValue + }), + + onRemove: override(L.Circle.prototype.onRemove, function(originalReturnValue) { + this.hideMeasurements() + + return originalReturnValue + }, true), + + setLatLng: override(L.Circle.prototype.setLatLng, function(originalReturnValue) { + this.updateMeasurements() + + return originalReturnValue + }), + + setRadius: override(L.Circle.prototype.setRadius, function(originalReturnValue) { + this.updateMeasurements() + + return originalReturnValue + }), + + formatArea: formatArea, + + updateMeasurements: function() { + if (!this._measurementLayer) return + + var latLng = this.getLatLng(), + options = this._measurementOptions, + formatter = options.formatArea || L.bind(this.formatArea, this) + + this._measurementLayer.clearLayers() + + if (options.showArea) { + formatter = options.formatArea || L.bind(this.formatArea, this) + var area = circleArea(this.getRadius()) + L.marker.measurement(latLng, + formatter(area), options.lang.totalArea, 0, options) + .addTo(this._measurementLayer) + } + } + }) + + L.Circle.addInitHook(function() { + addInitHook.call(this) + }) })() \ No newline at end of file diff --git a/src/conf/Constants.js b/src/conf/Constants.js index 6784be5..848d666 100644 --- a/src/conf/Constants.js +++ b/src/conf/Constants.js @@ -20,7 +20,7 @@ OPACITY: 1, DASH_ARRAY: '4,4', DASH_SPPED: -5, - ICON_SIZE: [20, 20] + ICON_SIZE: [10, 10] } export const props = { -- Gitblit v1.8.0