up
This commit is contained in:
261
public/libs/openlayers/4.6.5/ol-debug.css
Normal file
261
public/libs/openlayers/4.6.5/ol-debug.css
Normal file
@ -0,0 +1,261 @@
|
||||
.ol-box {
|
||||
box-sizing: border-box;
|
||||
border-radius: 2px;
|
||||
border: 2px solid blue;
|
||||
}
|
||||
|
||||
.ol-mouse-position {
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ol-scale-line {
|
||||
background: rgba(0,60,136,0.3);
|
||||
border-radius: 4px;
|
||||
bottom: 8px;
|
||||
left: 8px;
|
||||
padding: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.ol-scale-line-inner {
|
||||
border: 1px solid #eee;
|
||||
border-top: none;
|
||||
color: #eee;
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
margin: 1px;
|
||||
will-change: contents, width;
|
||||
}
|
||||
.ol-overlay-container {
|
||||
will-change: left,right,top,bottom;
|
||||
}
|
||||
|
||||
.ol-unsupported {
|
||||
display: none;
|
||||
}
|
||||
.ol-viewport, .ol-unselectable {
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
}
|
||||
.ol-selectable {
|
||||
-webkit-touch-callout: default;
|
||||
-webkit-user-select: auto;
|
||||
-moz-user-select: auto;
|
||||
-ms-user-select: auto;
|
||||
user-select: auto;
|
||||
}
|
||||
.ol-grabbing {
|
||||
cursor: -webkit-grabbing;
|
||||
cursor: -moz-grabbing;
|
||||
cursor: grabbing;
|
||||
}
|
||||
.ol-grab {
|
||||
cursor: move;
|
||||
cursor: -webkit-grab;
|
||||
cursor: -moz-grab;
|
||||
cursor: grab;
|
||||
}
|
||||
.ol-control {
|
||||
position: absolute;
|
||||
background-color: rgba(255,255,255,0.4);
|
||||
border-radius: 4px;
|
||||
padding: 2px;
|
||||
}
|
||||
.ol-control:hover {
|
||||
background-color: rgba(255,255,255,0.6);
|
||||
}
|
||||
.ol-zoom {
|
||||
top: .5em;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-rotate {
|
||||
top: .5em;
|
||||
right: .5em;
|
||||
transition: opacity .25s linear, visibility 0s linear;
|
||||
}
|
||||
.ol-rotate.ol-hidden {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transition: opacity .25s linear, visibility 0s linear .25s;
|
||||
}
|
||||
.ol-zoom-extent {
|
||||
top: 4.643em;
|
||||
left: .5em;
|
||||
}
|
||||
.ol-full-screen {
|
||||
right: .5em;
|
||||
top: .5em;
|
||||
}
|
||||
@media print {
|
||||
.ol-control {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.ol-control button {
|
||||
display: block;
|
||||
margin: 1px;
|
||||
padding: 0;
|
||||
color: white;
|
||||
font-size: 1.14em;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
text-align: center;
|
||||
height: 1.375em;
|
||||
width: 1.375em;
|
||||
line-height: .4em;
|
||||
background-color: rgba(0,60,136,0.5);
|
||||
border: none;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.ol-control button::-moz-focus-inner {
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
.ol-zoom-extent button {
|
||||
line-height: 1.4em;
|
||||
}
|
||||
.ol-compass {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
font-size: 1.2em;
|
||||
will-change: transform;
|
||||
}
|
||||
.ol-touch .ol-control button {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
.ol-touch .ol-zoom-extent {
|
||||
top: 5.5em;
|
||||
}
|
||||
.ol-control button:hover,
|
||||
.ol-control button:focus {
|
||||
text-decoration: none;
|
||||
background-color: rgba(0,60,136,0.7);
|
||||
}
|
||||
.ol-zoom .ol-zoom-in {
|
||||
border-radius: 2px 2px 0 0;
|
||||
}
|
||||
.ol-zoom .ol-zoom-out {
|
||||
border-radius: 0 0 2px 2px;
|
||||
}
|
||||
|
||||
|
||||
.ol-attribution {
|
||||
text-align: right;
|
||||
bottom: .5em;
|
||||
right: .5em;
|
||||
max-width: calc(100% - 1.3em);
|
||||
}
|
||||
|
||||
.ol-attribution ul {
|
||||
margin: 0;
|
||||
padding: 0 .5em;
|
||||
font-size: .7rem;
|
||||
line-height: 1.375em;
|
||||
color: #000;
|
||||
text-shadow: 0 0 2px #fff;
|
||||
}
|
||||
.ol-attribution li {
|
||||
display: inline;
|
||||
list-style: none;
|
||||
line-height: inherit;
|
||||
}
|
||||
.ol-attribution li:not(:last-child):after {
|
||||
content: " ";
|
||||
}
|
||||
.ol-attribution img {
|
||||
max-height: 2em;
|
||||
max-width: inherit;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.ol-attribution ul, .ol-attribution button {
|
||||
display: inline-block;
|
||||
}
|
||||
.ol-attribution.ol-collapsed ul {
|
||||
display: none;
|
||||
}
|
||||
.ol-attribution.ol-logo-only ul {
|
||||
display: block;
|
||||
}
|
||||
.ol-attribution:not(.ol-collapsed) {
|
||||
background: rgba(255,255,255,0.8);
|
||||
}
|
||||
.ol-attribution.ol-uncollapsible {
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
border-radius: 4px 0 0;
|
||||
height: 1.1em;
|
||||
line-height: 1em;
|
||||
}
|
||||
.ol-attribution.ol-logo-only {
|
||||
background: transparent;
|
||||
bottom: .4em;
|
||||
height: 1.1em;
|
||||
line-height: 1em;
|
||||
}
|
||||
.ol-attribution.ol-uncollapsible img {
|
||||
margin-top: -.2em;
|
||||
max-height: 1.6em;
|
||||
}
|
||||
.ol-attribution.ol-logo-only button,
|
||||
.ol-attribution.ol-uncollapsible button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ol-zoomslider {
|
||||
top: 4.5em;
|
||||
left: .5em;
|
||||
height: 200px;
|
||||
}
|
||||
.ol-zoomslider button {
|
||||
position: relative;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.ol-touch .ol-zoomslider {
|
||||
top: 5.5em;
|
||||
}
|
||||
|
||||
.ol-overviewmap {
|
||||
left: 0.5em;
|
||||
bottom: 0.5em;
|
||||
}
|
||||
.ol-overviewmap.ol-uncollapsible {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
border-radius: 0 4px 0 0;
|
||||
}
|
||||
.ol-overviewmap .ol-overviewmap-map,
|
||||
.ol-overviewmap button {
|
||||
display: inline-block;
|
||||
}
|
||||
.ol-overviewmap .ol-overviewmap-map {
|
||||
border: 1px solid #7b98bc;
|
||||
height: 150px;
|
||||
margin: 2px;
|
||||
width: 150px;
|
||||
}
|
||||
.ol-overviewmap:not(.ol-collapsed) button{
|
||||
bottom: 1px;
|
||||
left: 2px;
|
||||
position: absolute;
|
||||
}
|
||||
.ol-overviewmap.ol-collapsed .ol-overviewmap-map,
|
||||
.ol-overviewmap.ol-uncollapsible button {
|
||||
display: none;
|
||||
}
|
||||
.ol-overviewmap:not(.ol-collapsed) {
|
||||
background: rgba(255,255,255,0.8);
|
||||
}
|
||||
.ol-overviewmap-box {
|
||||
border: 2px dotted rgba(0,60,136,0.7);
|
||||
}
|
||||
|
||||
.ol-overviewmap .ol-overviewmap-box:hover {
|
||||
cursor: move;
|
||||
}
|
96044
public/libs/openlayers/4.6.5/ol-debug.js
Normal file
96044
public/libs/openlayers/4.6.5/ol-debug.js
Normal file
File diff suppressed because one or more lines are too long
1
public/libs/openlayers/4.6.5/ol.css
Normal file
1
public/libs/openlayers/4.6.5/ol.css
Normal file
@ -0,0 +1 @@
|
||||
.ol-box{box-sizing:border-box;border-radius:2px;border:2px solid #00f}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width}.ol-overlay-container{will-change:left,right,top,bottom}.ol-unsupported{display:none}.ol-unselectable,.ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px}.ol-control:hover{background-color:rgba(255,255,255,.6)}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}@media print{.ol-control{display:none}}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-size:1.14em;font-weight:700;text-decoration:none;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:focus,.ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em)}.ol-attribution ul{margin:0;padding:0 .5em;font-size:.7rem;line-height:1.375em;color:#000;text-shadow:0 0 2px #fff}.ol-attribution li{display:inline;list-style:none;line-height:inherit}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button,.ol-attribution ul{display:inline-block}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution.ol-logo-only ul{display:block}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0;height:1.1em;line-height:1em}.ol-attribution.ol-logo-only{background:0 0;bottom:.4em;height:1.1em;line-height:1em}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-logo-only button,.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:inline-block}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:1px;left:2px;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}
|
1077
public/libs/openlayers/4.6.5/ol.js
Normal file
1077
public/libs/openlayers/4.6.5/ol.js
Normal file
File diff suppressed because one or more lines are too long
2
public/libs/openlayers/6.14.1/ol.css
Normal file
2
public/libs/openlayers/6.14.1/ol.css
Normal file
@ -0,0 +1,2 @@
|
||||
.ol-box{box-sizing:border-box;border-radius:2px;border:1.5px solid #b3c5db;background-color:rgba(255,255,255,.4)}.ol-mouse-position{top:8px;right:8px;position:absolute}.ol-scale-line{background:rgba(0,60,136,.3);border-radius:4px;bottom:8px;left:8px;padding:2px;position:absolute}.ol-scale-line-inner{border:1px solid #eee;border-top:none;color:#eee;font-size:10px;text-align:center;margin:1px;will-change:contents,width;transition:all .25s}.ol-scale-bar{position:absolute;bottom:8px;left:8px}.ol-scale-step-marker{width:1px;height:15px;background-color:#000;float:right;z-index:10}.ol-scale-step-text{position:absolute;bottom:-5px;font-size:12px;z-index:11;color:#000;text-shadow:-2px 0 #fff,0 2px #fff,2px 0 #fff,0 -2px #fff}.ol-scale-text{position:absolute;font-size:14px;text-align:center;bottom:25px;color:#000;text-shadow:-2px 0 #fff,0 2px #fff,2px 0 #fff,0 -2px #fff}.ol-scale-singlebar{position:relative;height:10px;z-index:9;box-sizing:border-box;border:1px solid #000}.ol-unsupported{display:none}.ol-unselectable,.ol-viewport{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.ol-viewport canvas{all:unset}.ol-selectable{-webkit-touch-callout:default;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.ol-grabbing{cursor:-webkit-grabbing;cursor:-moz-grabbing;cursor:grabbing}.ol-grab{cursor:move;cursor:-webkit-grab;cursor:-moz-grab;cursor:grab}.ol-control{position:absolute;background-color:rgba(255,255,255,.4);border-radius:4px;padding:2px}.ol-control:hover{background-color:rgba(255,255,255,.6)}.ol-zoom{top:.5em;left:.5em}.ol-rotate{top:.5em;right:.5em;transition:opacity .25s linear,visibility 0s linear}.ol-rotate.ol-hidden{opacity:0;visibility:hidden;transition:opacity .25s linear,visibility 0s linear .25s}.ol-zoom-extent{top:4.643em;left:.5em}.ol-full-screen{right:.5em;top:.5em}.ol-control button{display:block;margin:1px;padding:0;color:#fff;font-weight:700;text-decoration:none;font-size:inherit;text-align:center;height:1.375em;width:1.375em;line-height:.4em;background-color:rgba(0,60,136,.5);border:none;border-radius:2px}.ol-control button::-moz-focus-inner{border:none;padding:0}.ol-zoom-extent button{line-height:1.4em}.ol-compass{display:block;font-weight:400;font-size:1.2em;will-change:transform}.ol-touch .ol-control button{font-size:1.5em}.ol-touch .ol-zoom-extent{top:5.5em}.ol-control button:focus,.ol-control button:hover{text-decoration:none;background-color:rgba(0,60,136,.7)}.ol-zoom .ol-zoom-in{border-radius:2px 2px 0 0}.ol-zoom .ol-zoom-out{border-radius:0 0 2px 2px}.ol-attribution{text-align:right;bottom:.5em;right:.5em;max-width:calc(100% - 1.3em);display:flex;flex-flow:row-reverse;align-items:center}.ol-attribution a{color:rgba(0,60,136,.7);text-decoration:none}.ol-attribution ul{margin:0;padding:1px .5em;color:#000;text-shadow:0 0 2px #fff;font-size:12px}.ol-attribution li{display:inline;list-style:none}.ol-attribution li:not(:last-child):after{content:" "}.ol-attribution img{max-height:2em;max-width:inherit;vertical-align:middle}.ol-attribution button{flex-shrink:0}.ol-attribution.ol-collapsed ul{display:none}.ol-attribution:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-attribution.ol-uncollapsible{bottom:0;right:0;border-radius:4px 0 0}.ol-attribution.ol-uncollapsible img{margin-top:-.2em;max-height:1.6em}.ol-attribution.ol-uncollapsible button{display:none}.ol-zoomslider{top:4.5em;left:.5em;height:200px}.ol-zoomslider button{position:relative;height:10px}.ol-touch .ol-zoomslider{top:5.5em}.ol-overviewmap{left:.5em;bottom:.5em}.ol-overviewmap.ol-uncollapsible{bottom:0;left:0;border-radius:0 4px 0 0}.ol-overviewmap .ol-overviewmap-map,.ol-overviewmap button{display:block}.ol-overviewmap .ol-overviewmap-map{border:1px solid #7b98bc;height:150px;margin:2px;width:150px}.ol-overviewmap:not(.ol-collapsed) button{bottom:2px;left:2px;position:absolute}.ol-overviewmap.ol-collapsed .ol-overviewmap-map,.ol-overviewmap.ol-uncollapsible button{display:none}.ol-overviewmap:not(.ol-collapsed){background:rgba(255,255,255,.8)}.ol-overviewmap-box{border:2px dotted rgba(0,60,136,.7)}.ol-overviewmap .ol-overviewmap-box:hover{cursor:move}
|
||||
/*# sourceMappingURL=ol.css.map */
|
8
public/libs/openlayers/6.14.1/ol.css.map
Normal file
8
public/libs/openlayers/6.14.1/ol.css.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": [
|
||||
"src/ol/ol.css"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAAA,QACE,WAAY,WACZ,cAAe,IACf,OAAQ,MAAM,MAAM,QACpB,iBAAkB,qBAGpB,mBACE,IAAK,IACL,MAAO,IACP,SAAU,SAGZ,eACE,WAAY,kBACZ,cAAe,IACf,OAAQ,IACR,KAAM,IACN,QAAS,IACT,SAAU,SAEZ,qBACE,OAAQ,IAAI,MAAM,KAClB,WAAY,KACZ,MAAO,KACP,UAAW,KACX,WAAY,OACZ,OAAQ,IACR,YAAa,QAAQ,CAAE,MACvB,WAAY,IAAI,KAElB,cACE,SAAU,SACV,OAAQ,IACR,KAAM,IAER,sBACE,MAAO,IACP,OAAQ,KACR,iBAAkB,KAClB,MAAO,MACP,QAAS,GAEX,oBACE,SAAU,SACV,OAAQ,KACR,UAAW,KACX,QAAS,GACT,MAAO,KACP,YAAa,KAAK,EAAE,IAAO,CAAE,EAAE,IAAI,IAAO,CAAE,IAAI,EAAE,IAAO,CAAE,EAAE,KAAK,KAEpE,eACE,SAAU,SACV,UAAW,KACX,WAAY,OACZ,OAAQ,KACR,MAAO,KACP,YAAa,KAAK,EAAE,IAAO,CAAE,EAAE,IAAI,IAAO,CAAE,IAAI,EAAE,IAAO,CAAE,EAAE,KAAK,KAEpE,oBACE,SAAU,SACV,OAAQ,KACR,QAAS,EACT,WAAY,WACZ,OAAQ,IAAI,MAAM,KAGpB,gBACE,QAAS,KAEG,iBAAd,aACE,sBAAuB,KACvB,oBAAqB,KACrB,iBAAkB,KAClB,gBAAiB,KACjB,YAAa,KACb,4BAA6B,YAE/B,oBACE,IAAK,MAEP,eACE,sBAAuB,QACvB,oBAAqB,KACrB,iBAAkB,KAClB,gBAAiB,KACjB,YAAa,KAEf,aACE,OAAQ,iBACR,OAAQ,cACR,OAAQ,SAEV,SACE,OAAQ,KACR,OAAQ,aACR,OAAQ,UACR,OAAQ,KAEV,YACE,SAAU,SACV,iBAAkB,qBAClB,cAAe,IACf,QAAS,IAEX,kBACE,iBAAkB,qBAEpB,SACE,IAAK,KACL,KAAM,KAER,WACE,IAAK,KACL,MAAO,KACP,WAAY,QAAQ,KAAK,MAAM,CAAE,WAAW,GAAG,OAEjD,qBACE,QAAS,EACT,WAAY,OACZ,WAAY,QAAQ,KAAK,MAAM,CAAE,WAAW,GAAG,OAAO,KAExD,gBACE,IAAK,QACL,KAAM,KAER,gBACE,MAAO,KACP,IAAK,KAGP,mBACE,QAAS,MACT,OAAQ,IACR,QAAS,EACT,MAAO,KACP,YAAa,IACb,gBAAiB,KACjB,UAAW,QACX,WAAY,OACZ,OAAQ,QACR,MAAO,QACP,YAAa,KACb,iBAAkB,kBAClB,OAAQ,KACR,cAAe,IAEjB,qCACE,OAAQ,KACR,QAAS,EAEX,uBACE,YAAa,MAEf,YACE,QAAS,MACT,YAAa,IACb,UAAW,MACX,YAAa,UAEf,6BACE,UAAW,MAEb,0BACE,IAAK,MAGP,yBADA,yBAEE,gBAAiB,KACjB,iBAAkB,kBAEpB,qBACE,cAAe,IAAI,IAAI,EAAE,EAE3B,sBACE,cAAe,EAAE,EAAE,IAAI,IAIzB,gBACE,WAAY,MACZ,OAAQ,KACR,MAAO,KACP,UAAW,mBACX,QAAS,KACT,UAAW,YACX,YAAa,OAEf,kBACE,MAAO,kBACP,gBAAiB,KAEnB,mBACE,OAAQ,EACR,QAAS,IAAI,KACb,MAAO,KACP,YAAa,EAAE,EAAE,IAAI,KACrB,UAAW,KAEb,mBACE,QAAS,OACT,WAAY,KAEd,0CACE,QAAS,IAEX,oBACE,WAAY,IACZ,UAAW,QACX,eAAgB,OAElB,uBACE,YAAa,EAEf,gCACE,QAAS,KAEX,mCACE,WAAY,qBAEd,iCACE,OAAQ,EACR,MAAO,EACP,cAAe,IAAI,EAAE,EAEvB,qCACE,WAAY,MACZ,WAAY,MAEd,wCACE,QAAS,KAGX,eACE,IAAK,MACL,KAAM,KACN,OAAQ,MAEV,sBACE,SAAU,SACV,OAAQ,KAGV,yBACE,IAAK,MAGP,gBACE,KAAM,KACN,OAAQ,KAEV,iCACE,OAAQ,EACR,KAAM,EACN,cAAe,EAAE,IAAI,EAAE,EAEzB,oCACA,uBACE,QAAS,MAEX,oCACE,OAAQ,IAAI,MAAM,QAClB,OAAQ,MACR,OAAQ,IACR,MAAO,MAET,0CACE,OAAQ,IACR,KAAM,IACN,SAAU,SAEZ,iDACA,wCACE,QAAS,KAEX,mCACE,WAAY,qBAEd,oBACE,OAAQ,IAAI,OAAO,kBAGrB,0CACE,OAAQ"
|
||||
}
|
3
public/libs/openlayers/6.14.1/ol.js
Normal file
3
public/libs/openlayers/6.14.1/ol.js
Normal file
File diff suppressed because one or more lines are too long
9328
public/libs/openlayers/6.14.1/ol.js.map
Normal file
9328
public/libs/openlayers/6.14.1/ol.js.map
Normal file
File diff suppressed because one or more lines are too long
681
public/libs/openlayers/ol3-echarts/1.3.6/ol3Echarts.js
Normal file
681
public/libs/openlayers/ol3-echarts/1.3.6/ol3Echarts.js
Normal file
@ -0,0 +1,681 @@
|
||||
/*!
|
||||
* author: FDD <smileFDD@gmail.com>
|
||||
* ol3-echarts v1.3.6
|
||||
* build-time: 2018-12-22 14:19
|
||||
* LICENSE: MIT
|
||||
* (c) 2017-2018 https://sakitam-fdd.github.io/ol3Echarts
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('echarts'), require('openlayers')) :
|
||||
typeof define === 'function' && define.amd ? define(['echarts', 'openlayers'], factory) :
|
||||
(global.ol3Echarts = factory(global.echarts,global.ol));
|
||||
}(this, (function (echarts,ol) { 'use strict';
|
||||
|
||||
echarts = echarts && echarts.hasOwnProperty('default') ? echarts['default'] : echarts;
|
||||
ol = ol && ol.hasOwnProperty('default') ? ol['default'] : ol;
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var inherits = function (subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
};
|
||||
|
||||
var possibleConstructorReturn = function (self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||||
};
|
||||
|
||||
var isObject = function isObject(value) {
|
||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||
return value !== null && (type === 'object' || type === 'function');
|
||||
};
|
||||
|
||||
var merge = function merge(a, b) {
|
||||
for (var key in b) {
|
||||
if (isObject(b[key]) && isObject(a[key])) {
|
||||
merge(a[key], b[key]);
|
||||
} else {
|
||||
a[key] = b[key];
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
var getTarget = function getTarget(selector) {
|
||||
var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document;
|
||||
|
||||
var dom = function () {
|
||||
var found = void 0;
|
||||
return doc && /^#([\w-]+)$/.test(selector) ? (found = doc.getElementById(RegExp.$1)) ? [found] : [] : Array.prototype.slice.call(/^\.([\w-]+)$/.test(selector) ? doc.getElementsByClassName(RegExp.$1) : /^[\w-]+$/.test(selector) ? doc.getElementsByTagName(selector) : doc.querySelectorAll(selector));
|
||||
}();
|
||||
return dom;
|
||||
};
|
||||
|
||||
var map = function map(obj, cb, context) {
|
||||
if (!(obj && cb)) {
|
||||
return;
|
||||
}
|
||||
if (obj.map && obj.map === Array.prototype.map) {
|
||||
return obj.map(cb, context);
|
||||
} else {
|
||||
var result = [];
|
||||
for (var i = 0, len = obj.length; i < len; i++) {
|
||||
result.push(cb.call(context, obj[i], i, obj));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
var bind = function bind(func, context) {
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
return function () {
|
||||
return func.apply(context, args.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
};
|
||||
|
||||
var arrayAdd = function arrayAdd(array, item) {
|
||||
var i = 0;
|
||||
var index = void 0;
|
||||
var length = array.length;
|
||||
for (; i < length; i++) {
|
||||
if (array[i]['seriesIndex'] === item['seriesIndex']) {
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
if (index === undefined) {
|
||||
array.push(item);
|
||||
} else {
|
||||
array[index] = item;
|
||||
}
|
||||
return array;
|
||||
};
|
||||
|
||||
var checkDecoded = function checkDecoded(json) {
|
||||
if (json.UTF8Encoding) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
var decode = function decode(json) {
|
||||
if (checkDecoded(json)) {
|
||||
return json;
|
||||
}
|
||||
var encodeScale = json.UTF8Scale;
|
||||
if (encodeScale == null) {
|
||||
encodeScale = 1024;
|
||||
}
|
||||
var features = json.features;
|
||||
for (var f = 0; f < features.length; f++) {
|
||||
var feature = features[f];
|
||||
var geometry = feature.geometry;
|
||||
var _ref = [geometry.coordinates, geometry.encodeOffsets],
|
||||
coordinates = _ref[0],
|
||||
encodeOffsets = _ref[1];
|
||||
|
||||
for (var c = 0; c < coordinates.length; c++) {
|
||||
var coordinate = coordinates[c];
|
||||
if (geometry.type === 'Polygon') {
|
||||
coordinates[c] = decodePolygon(coordinate, encodeOffsets[c], encodeScale);
|
||||
} else if (geometry.type === 'MultiPolygon') {
|
||||
for (var c2 = 0; c2 < coordinate.length; c2++) {
|
||||
var polygon = coordinate[c2];
|
||||
coordinate[c2] = decodePolygon(polygon, encodeOffsets[c][c2], encodeScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json.UTF8Encoding = false;
|
||||
return json;
|
||||
};
|
||||
|
||||
var decodePolygon = function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
||||
var _ref2 = [[], encodeOffsets[0], encodeOffsets[1]],
|
||||
result = _ref2[0],
|
||||
prevX = _ref2[1],
|
||||
prevY = _ref2[2];
|
||||
|
||||
for (var i = 0; i < coordinate.length; i += 2) {
|
||||
var x = coordinate.charCodeAt(i) - 64;
|
||||
var y = coordinate.charCodeAt(i + 1) - 64;
|
||||
|
||||
x = x >> 1 ^ -(x & 1);
|
||||
y = y >> 1 ^ -(y & 1);
|
||||
|
||||
x += prevX;
|
||||
y += prevY;
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
|
||||
result.push([x / encodeScale, y / encodeScale]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
function formatGeoJSON (json) {
|
||||
var geoJson = decode(json);
|
||||
var _features = echarts.util.map(echarts.util.filter(geoJson.features, function (featureObj) {
|
||||
return featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0;
|
||||
}), function (featureObj) {
|
||||
var properties = featureObj.properties;
|
||||
var geo = featureObj.geometry;
|
||||
var coordinates = geo.coordinates;
|
||||
var geometries = [];
|
||||
if (geo.type === 'Polygon') {
|
||||
geometries.push(coordinates[0]);
|
||||
}
|
||||
if (geo.type === 'MultiPolygon') {
|
||||
echarts.util.each(coordinates, function (item) {
|
||||
if (item[0]) {
|
||||
geometries.push(item[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: geometries
|
||||
},
|
||||
properties: properties
|
||||
};
|
||||
});
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
crs: {},
|
||||
features: _features
|
||||
};
|
||||
}
|
||||
|
||||
var _getCoordinateSystem = function _getCoordinateSystem(map$$1) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
var RegisterCoordinateSystem = function RegisterCoordinateSystem() {
|
||||
this._mapOffset = [0, 0];
|
||||
this.dimensions = ['lng', 'lat'];
|
||||
this.projCode_ = this._getProjectionCode();
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.dimensions = ['lng', 'lat'];
|
||||
|
||||
RegisterCoordinateSystem.dimensions = RegisterCoordinateSystem.prototype.dimensions;
|
||||
|
||||
RegisterCoordinateSystem.prototype.getZoom = function () {
|
||||
return map$$1.getView().getZoom();
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.setZoom = function (zoom) {
|
||||
return map$$1.getView().setZoom(zoom);
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.getViewRectAfterRoam = function () {
|
||||
return this.getViewRect().clone();
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.setMapOffset = function (mapOffset) {
|
||||
this._mapOffset = mapOffset;
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.dataToPoint = function (coords) {
|
||||
if (coords && Array.isArray(coords) && coords.length > 0) {
|
||||
coords = coords.map(function (item) {
|
||||
if (typeof item === 'string') {
|
||||
item = Number(item);
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
var source = options['source'] || 'EPSG:4326';
|
||||
var destination = options['destination'] || this.projCode_;
|
||||
var pixel = map$$1.getPixelFromCoordinate(ol.proj.transform(coords, source, destination));
|
||||
var mapOffset = this._mapOffset;
|
||||
return [pixel[0] - mapOffset[0], pixel[1] - mapOffset[1]];
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype._getProjectionCode = function () {
|
||||
var code = '';
|
||||
if (map$$1) {
|
||||
code = map$$1.getView() && map$$1.getView().getProjection().getCode();
|
||||
} else {
|
||||
code = 'EPSG:3857';
|
||||
}
|
||||
return code;
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.pointToData = function (pixel) {
|
||||
var mapOffset = this._mapOffset;
|
||||
return map$$1.getCoordinateFromPixel([pixel[0] + mapOffset[0], pixel[1] + mapOffset[1]]);
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.getViewRect = function () {
|
||||
var size = map$$1.getSize();
|
||||
return new echarts.graphic.BoundingRect(0, 0, size[0], size[1]);
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.getRoamTransform = function () {
|
||||
return echarts.matrix.create();
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.prototype.prepareCustoms = function (data) {
|
||||
var rect = this.getViewRect();
|
||||
return {
|
||||
coordSys: {
|
||||
type: 'openlayers',
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.width,
|
||||
height: rect.height
|
||||
},
|
||||
api: {
|
||||
coord: bind(this.dataToPoint, this),
|
||||
size: bind(RegisterCoordinateSystem.dataToCoordSize, this)
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.dataToCoordSize = function (dataSize, dataItem) {
|
||||
dataItem = dataItem || [0, 0];
|
||||
return map([0, 1], function (dimIdx) {
|
||||
var val = dataItem[dimIdx];
|
||||
var halfSize = dataSize[dimIdx] / 2;
|
||||
var p1 = [],
|
||||
p2 = [];
|
||||
|
||||
p1[dimIdx] = val - halfSize;
|
||||
p2[dimIdx] = val + halfSize;
|
||||
p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
|
||||
return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
|
||||
}, this);
|
||||
};
|
||||
|
||||
RegisterCoordinateSystem.create = function (echartModel, api) {
|
||||
echartModel.eachSeries(function (seriesModel) {
|
||||
if (seriesModel.get('coordinateSystem') === 'openlayers') {
|
||||
seriesModel.coordinateSystem = new RegisterCoordinateSystem(map$$1);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return RegisterCoordinateSystem;
|
||||
};
|
||||
|
||||
var pie = function pie(options, serie, coordinateSystem) {
|
||||
serie.center = coordinateSystem.dataToPoint(serie.coordinates);
|
||||
return serie;
|
||||
};
|
||||
|
||||
var bar = function bar(options, serie, coordinateSystem) {
|
||||
if (isObject(options.grid) && !Array.isArray(options.grid)) {
|
||||
console.log(options);
|
||||
} else if (Array.isArray(options.grid)) {
|
||||
options.grid = options.grid.map(function (gri, index) {
|
||||
var coorPixel = coordinateSystem.dataToPoint(options.series[index].coordinates);
|
||||
gri.left = coorPixel[0] - parseFloat(gri.width) / 2;
|
||||
gri.top = coorPixel[1] - parseFloat(gri.height) / 2;
|
||||
return gri;
|
||||
});
|
||||
}
|
||||
return serie;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var charts = /*#__PURE__*/Object.freeze({
|
||||
pie: pie,
|
||||
bar: bar
|
||||
});
|
||||
|
||||
var _options = {
|
||||
forcedRerender: false,
|
||||
forcedPrecomposeRerender: false,
|
||||
hideOnZooming: false,
|
||||
hideOnMoving: false,
|
||||
hideOnRotating: false,
|
||||
convertTypes: ['pie', 'line', 'bar']
|
||||
};
|
||||
|
||||
var ol3Echarts = function (_ol$Object) {
|
||||
inherits(ol3Echarts, _ol$Object);
|
||||
|
||||
function ol3Echarts(chartOptions) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var map$$1 = arguments[2];
|
||||
classCallCheck(this, ol3Echarts);
|
||||
|
||||
var _this = possibleConstructorReturn(this, _ol$Object.call(this));
|
||||
|
||||
_this.$options = merge(_options, options);
|
||||
|
||||
_this.$chartOptions = chartOptions;
|
||||
|
||||
_this.$chart = null;
|
||||
|
||||
_this.$Map = null;
|
||||
|
||||
_this._isRegistered = false;
|
||||
|
||||
_this._incremental = [];
|
||||
|
||||
_this._coordinateSystem = null;
|
||||
|
||||
if (map$$1) _this.appendTo(map$$1);
|
||||
return _this;
|
||||
}
|
||||
|
||||
ol3Echarts.prototype.appendTo = function appendTo(map$$1) {
|
||||
if (map$$1 && map$$1 instanceof ol.Map) {
|
||||
this.$Map = map$$1;
|
||||
this.$Map.once('postrender', this.render, this);
|
||||
this.$Map.renderSync();
|
||||
this._unRegisterEvents();
|
||||
this._registerEvents();
|
||||
} else {
|
||||
throw new Error('not map object');
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.getChartOptions = function getChartOptions() {
|
||||
return this.$chartOptions;
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.setChartOptions = function setChartOptions() {
|
||||
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
this.$chartOptions = options;
|
||||
this.$Map.once('postrender', this.render, this);
|
||||
this.$Map.renderSync();
|
||||
return this;
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.appendData = function appendData(data) {
|
||||
var save = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
||||
|
||||
if (data) {
|
||||
if (save) {
|
||||
this._incremental = arrayAdd(this._incremental, {
|
||||
data: data.data,
|
||||
seriesIndex: data.seriesIndex
|
||||
});
|
||||
}
|
||||
|
||||
this.$chart.appendData({
|
||||
data: data.data.copyWithin(),
|
||||
seriesIndex: data.seriesIndex
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.clear = function clear() {
|
||||
this._incremental = [];
|
||||
this.$chart.clear();
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.getMap = function getMap() {
|
||||
return this.$Map;
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._isVisible = function _isVisible() {
|
||||
return this.$container && this.$container.style.display === '';
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.show = function show() {
|
||||
if (this.$container) {
|
||||
this.$container.style.display = '';
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.hide = function hide() {
|
||||
if (this.$container) {
|
||||
this.$container.style.display = 'none';
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.remove = function remove() {
|
||||
this.$chart.clear();
|
||||
this.$chart.dispose();
|
||||
this._unRegisterEvents();
|
||||
this._incremental = [];
|
||||
delete this.$chart;
|
||||
delete this.$Map;
|
||||
this.$container.parentNode.removeChild(this.$container);
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.showLoading = function showLoading() {
|
||||
if (this.$chart) {
|
||||
this.$chart.showLoading();
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.hideLoading = function hideLoading() {
|
||||
if (this.$chart) {
|
||||
this.$chart.hideLoading();
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._createLayerContainer = function _createLayerContainer(map$$1, options) {
|
||||
var viewPort = map$$1.getViewport();
|
||||
var container = this.$container = document.createElement('div');
|
||||
container.style.position = 'absolute';
|
||||
container.style.top = '0px';
|
||||
container.style.left = '0px';
|
||||
container.style.right = '0px';
|
||||
container.style.bottom = '0px';
|
||||
var _target = getTarget(options['target'], viewPort);
|
||||
if (_target && _target[0] && _target[0] instanceof Element) {
|
||||
_target[0].appendChild(container);
|
||||
} else {
|
||||
var _target2 = getTarget('.ol-overlaycontainer', viewPort);
|
||||
if (_target2 && _target2[0] && _target2[0] instanceof Element) {
|
||||
_target2[0].appendChild(container);
|
||||
} else {
|
||||
viewPort.appendChild(container);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._resizeContainer = function _resizeContainer() {
|
||||
var size = this.getMap().getSize();
|
||||
this.$container.style.height = size[1] + 'px';
|
||||
this.$container.style.width = size[0] + 'px';
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._clearAndRedraw = function _clearAndRedraw() {
|
||||
if (!this.$chart || this.$container && this.$container.style.display === 'none') {
|
||||
return;
|
||||
}
|
||||
this.dispatchEvent({
|
||||
type: 'redraw',
|
||||
source: this
|
||||
});
|
||||
if (this.$options.forcedRerender) {
|
||||
this.$chart.clear();
|
||||
}
|
||||
this.$chart.resize();
|
||||
if (this.$chartOptions) {
|
||||
this._registerMap();
|
||||
this.$chart.setOption(this.reConverData(this.$chartOptions), false);
|
||||
if (this._incremental && this._incremental.length > 0) {
|
||||
for (var i = 0; i < this._incremental.length; i++) {
|
||||
this.appendData(this._incremental[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onResize = function onResize() {
|
||||
this._resizeContainer();
|
||||
this._clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'change:size',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onZoomEnd = function onZoomEnd() {
|
||||
this.$options['hideOnZooming'] && this.show();
|
||||
this._clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'zoomend',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onDragRotateEnd = function onDragRotateEnd() {
|
||||
this.$options['hideOnRotating'] && this.show();
|
||||
this._clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'change:rotation',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onMoveStart = function onMoveStart() {
|
||||
this.$options['hideOnMoving'] && this.hide();
|
||||
this.dispatchEvent({
|
||||
type: 'movestart',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onMoveEnd = function onMoveEnd() {
|
||||
this.$options['hideOnMoving'] && this.show();
|
||||
this._clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'moveend',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.onCenterChange = function onCenterChange(event) {
|
||||
this._clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'change:center',
|
||||
source: this
|
||||
});
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._registerEvents = function _registerEvents() {
|
||||
var Map = this.$Map;
|
||||
var view = Map.getView();
|
||||
if (this.$options.forcedPrecomposeRerender) {
|
||||
Map.on('precompose', this.reRender, this);
|
||||
}
|
||||
Map.on('change:size', this.onResize, this);
|
||||
view.on('change:resolution', this.onZoomEnd, this);
|
||||
view.on('change:center', this.onCenterChange, this);
|
||||
view.on('change:rotation', this.onDragRotateEnd, this);
|
||||
Map.on('movestart', this.onMoveStart, this);
|
||||
Map.on('moveend', this.onMoveEnd, this);
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._unRegisterEvents = function _unRegisterEvents() {
|
||||
var Map = this.$Map;
|
||||
var view = Map.getView();
|
||||
Map.un('change:size', this.onResize, this);
|
||||
if (this.$options.forcedPrecomposeRerender) {
|
||||
Map.un('precompose', this.reRender, this);
|
||||
}
|
||||
view.un('change:resolution', this.onZoomEnd, this);
|
||||
view.un('change:center', this.onCenterChange, this);
|
||||
view.un('change:rotation', this.onDragRotateEnd, this);
|
||||
Map.un('movestart', this.onMoveStart, this);
|
||||
Map.un('moveend', this.onMoveEnd, this);
|
||||
};
|
||||
|
||||
ol3Echarts.prototype._registerMap = function _registerMap() {
|
||||
if (!this._isRegistered) {
|
||||
echarts.registerCoordinateSystem('openlayers', _getCoordinateSystem(this.getMap(), this.$options));
|
||||
this._isRegistered = true;
|
||||
}
|
||||
var series = this.$chartOptions.series;
|
||||
if (series && isObject(series)) {
|
||||
for (var i = series.length - 1; i >= 0; i--) {
|
||||
if (!(this.$options.convertTypes.indexOf(series[i]['type']) > -1)) {
|
||||
series[i]['coordinateSystem'] = 'openlayers';
|
||||
}
|
||||
series[i]['animation'] = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.reConverData = function reConverData(options) {
|
||||
var series = options['series'];
|
||||
if (series && series.length > 0) {
|
||||
if (!this._coordinateSystem) {
|
||||
var _cs = _getCoordinateSystem(this.getMap(), this.$options);
|
||||
this._coordinateSystem = new _cs();
|
||||
}
|
||||
if (series && isObject(series)) {
|
||||
for (var i = series.length - 1; i >= 0; i--) {
|
||||
if (this.$options.convertTypes.indexOf(series[i]['type']) > -1) {
|
||||
if (series[i] && series[i].hasOwnProperty('coordinates')) {
|
||||
series[i] = charts[series[i]['type']](options, series[i], this._coordinateSystem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.render = function render() {
|
||||
if (!this.$container) {
|
||||
this._createLayerContainer(this.$Map, this.$options);
|
||||
this._resizeContainer();
|
||||
}
|
||||
if (!this.$chart) {
|
||||
this.$chart = echarts.init(this.$container);
|
||||
if (this.$chartOptions) {
|
||||
this._registerMap();
|
||||
this.$chart.setOption(this.reConverData(this.$chartOptions), false);
|
||||
}
|
||||
} else if (this._isVisible()) {
|
||||
this.$chart.resize();
|
||||
this.reRender();
|
||||
}
|
||||
};
|
||||
|
||||
ol3Echarts.prototype.reRender = function reRender() {
|
||||
this._clearAndRedraw();
|
||||
};
|
||||
|
||||
return ol3Echarts;
|
||||
}(ol.Object);
|
||||
|
||||
ol3Echarts.getTarget = getTarget;
|
||||
ol3Echarts.merge = merge;
|
||||
ol3Echarts.map = map;
|
||||
ol3Echarts.bind = bind;
|
||||
ol3Echarts.formatGeoJSON = formatGeoJSON;
|
||||
|
||||
return ol3Echarts;
|
||||
|
||||
})));
|
8
public/libs/openlayers/ol3-echarts/1.3.6/ol3Echarts.min.js
vendored
Normal file
8
public/libs/openlayers/ol3-echarts/1.3.6/ol3Echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
853
public/libs/openlayers/ol3-echarts/2.0.6/ol3Echarts.js
Normal file
853
public/libs/openlayers/ol3-echarts/2.0.6/ol3Echarts.js
Normal file
@ -0,0 +1,853 @@
|
||||
/*!
|
||||
* author: sakitam-fdd <smilefdd@gmail.com>
|
||||
* ol3-echarts v2.0.5
|
||||
* build-time: 2022-1-6 15:31
|
||||
* LICENSE: MIT
|
||||
* (c) 2017-2022 https://sakitam-fdd.github.io/ol3Echarts
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('openlayers'), require('echarts')) :
|
||||
typeof define === 'function' && define.amd ? define(['openlayers', 'echarts'], factory) :
|
||||
(global = global || self, global.ol3Echarts = factory(global.ol, global.echarts));
|
||||
}(this, function (ol, echarts) { 'use strict';
|
||||
|
||||
ol = ol && ol.hasOwnProperty('default') ? ol['default'] : ol;
|
||||
echarts = echarts && echarts.hasOwnProperty('default') ? echarts['default'] : echarts;
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
var isObject = function (value) {
|
||||
var type = typeof value;
|
||||
return value !== null && (type === 'object' || type === 'function');
|
||||
};
|
||||
var merge = function (a, b) {
|
||||
Object.keys(b).forEach(function (key) {
|
||||
if (isObject(b[key]) && isObject(a[key])) {
|
||||
merge(a[key], b[key]);
|
||||
}
|
||||
else {
|
||||
a[key] = b[key];
|
||||
}
|
||||
});
|
||||
return a;
|
||||
};
|
||||
var bind = function (func, context) {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var args = [];
|
||||
for (var _i = 2; _i < arguments.length; _i++) {
|
||||
args[_i - 2] = arguments$1[_i];
|
||||
}
|
||||
return function () {
|
||||
var arguments$1 = arguments;
|
||||
|
||||
var innerArgs = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
innerArgs[_i] = arguments$1[_i];
|
||||
}
|
||||
return func.apply(context, args.concat(Array.prototype.slice.call(innerArgs)));
|
||||
};
|
||||
};
|
||||
var arrayAdd = function (array, item) {
|
||||
var i = 0;
|
||||
var index;
|
||||
var length = array.length;
|
||||
for (; i < length; i++) {
|
||||
if (array[i].index === item.index) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index === undefined) {
|
||||
array.push(item);
|
||||
}
|
||||
else {
|
||||
array[index] = item;
|
||||
}
|
||||
return array;
|
||||
};
|
||||
var uuid = function () {
|
||||
function rd(a) {
|
||||
return a ? (a ^ Math.random() * 16 >> a / 4).toString(16)
|
||||
: ([1e7] + -[1e3] + -4e3 + -8e3 + -1e11).replace(/[018]/g, rd);
|
||||
}
|
||||
return rd();
|
||||
};
|
||||
function bindAll(fns, context) {
|
||||
fns.forEach(function (fn) {
|
||||
if (!context[fn]) {
|
||||
return;
|
||||
}
|
||||
context[fn] = context[fn].bind(context);
|
||||
});
|
||||
}
|
||||
function removeNode(node) {
|
||||
return node && node.parentNode ? node.parentNode.removeChild(node) : null;
|
||||
}
|
||||
function mockEvent(type, event) {
|
||||
var e = new MouseEvent(type, {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
button: event.pointerEvent.button,
|
||||
buttons: event.pointerEvent.buttons,
|
||||
clientX: event.pointerEvent.clientX,
|
||||
clientY: event.pointerEvent.clientY,
|
||||
zrX: event.pointerEvent.offsetX,
|
||||
zrY: event.pointerEvent.offsetY,
|
||||
movementX: event.pointerEvent.movementX,
|
||||
movementY: event.pointerEvent.movementY,
|
||||
relatedTarget: event.pointerEvent.relatedTarget,
|
||||
screenX: event.pointerEvent.screenX,
|
||||
screenY: event.pointerEvent.screenY,
|
||||
view: window,
|
||||
});
|
||||
e.zrX = event.pointerEvent.offsetX;
|
||||
e.zrY = event.pointerEvent.offsetY;
|
||||
e.event = e;
|
||||
return e;
|
||||
}
|
||||
|
||||
var checkDecoded = function (json) { return !json.UTF8Encoding; };
|
||||
var decodePolygon = function (coordinate, encodeOffsets, encodeScale) {
|
||||
var result = [];
|
||||
var _a = [encodeOffsets[0], encodeOffsets[1]], prevX = _a[0], prevY = _a[1];
|
||||
for (var i = 0; i < coordinate.length; i += 2) {
|
||||
var x = coordinate.charCodeAt(i) - 64;
|
||||
var y = coordinate.charCodeAt(i + 1) - 64;
|
||||
x = (x >> 1) ^ -(x & 1);
|
||||
y = (y >> 1) ^ -(y & 1);
|
||||
x += prevX;
|
||||
y += prevY;
|
||||
prevX = x;
|
||||
prevY = y;
|
||||
result.push([x / encodeScale, y / encodeScale]);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
var decode = function (json) {
|
||||
if (checkDecoded(json)) {
|
||||
return json;
|
||||
}
|
||||
var encodeScale = json.UTF8Scale;
|
||||
if (encodeScale == null) {
|
||||
encodeScale = 1024;
|
||||
}
|
||||
var features = json.features;
|
||||
for (var f = 0; f < features.length; f++) {
|
||||
var feature = features[f];
|
||||
var geometry = feature.geometry;
|
||||
var _a = [geometry.coordinates, geometry.encodeOffsets], coordinates = _a[0], encodeOffsets = _a[1];
|
||||
for (var c = 0; c < coordinates.length; c++) {
|
||||
var coordinate = coordinates[c];
|
||||
if (geometry.type === 'Polygon') {
|
||||
coordinates[c] = decodePolygon(coordinate, encodeOffsets[c], encodeScale);
|
||||
}
|
||||
else if (geometry.type === 'MultiPolygon') {
|
||||
for (var c2 = 0; c2 < coordinate.length; c2++) {
|
||||
var polygon = coordinate[c2];
|
||||
coordinate[c2] = decodePolygon(polygon, encodeOffsets[c][c2], encodeScale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
json.UTF8Encoding = false;
|
||||
return json;
|
||||
};
|
||||
function formatGeoJSON (json) {
|
||||
var geoJson = decode(json);
|
||||
var _features = echarts.util.map(echarts.util.filter(geoJson.features, function (featureObj) {
|
||||
return featureObj.geometry && featureObj.properties && featureObj.geometry.coordinates.length > 0;
|
||||
}), function (featureObj) {
|
||||
var properties = featureObj.properties;
|
||||
var geo = featureObj.geometry;
|
||||
var coordinates = geo.coordinates;
|
||||
var geometries = [];
|
||||
if (geo.type === 'Polygon') {
|
||||
geometries.push(coordinates[0]);
|
||||
}
|
||||
if (geo.type === 'MultiPolygon') {
|
||||
echarts.util.each(coordinates, function (item) {
|
||||
if (item[0]) {
|
||||
geometries.push(item[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
properties: properties,
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Polygon',
|
||||
coordinates: geometries,
|
||||
},
|
||||
};
|
||||
});
|
||||
return {
|
||||
type: 'FeatureCollection',
|
||||
crs: {},
|
||||
features: _features,
|
||||
};
|
||||
}
|
||||
|
||||
var pie = function (_options, serie, coordinateSystem) {
|
||||
serie.center = coordinateSystem.dataToPoint(serie.coordinates);
|
||||
return serie;
|
||||
};
|
||||
|
||||
var bar = function (options, serie, coordinateSystem) {
|
||||
if (isObject(options.grid) && !Array.isArray(options.grid)) {
|
||||
console.log(options);
|
||||
}
|
||||
else if (Array.isArray(options.grid)) {
|
||||
options.grid = options.grid.map(function (gri, index) {
|
||||
var coorPixel = coordinateSystem.dataToPoint(options.series[index].coordinates);
|
||||
gri.left = coorPixel[0] - parseFloat(gri.width) / 2;
|
||||
gri.top = coorPixel[1] - parseFloat(gri.height) / 2;
|
||||
return gri;
|
||||
});
|
||||
}
|
||||
return serie;
|
||||
};
|
||||
|
||||
var line = function (options, serie, coordinateSystem) {
|
||||
if (isObject(options.grid) && !Array.isArray(options.grid)) {
|
||||
console.log(options);
|
||||
}
|
||||
else if (Array.isArray(options.grid)) {
|
||||
options.grid = options.grid.map(function (gri, index) {
|
||||
var coorPixel = coordinateSystem.dataToPoint(options.series[index].coordinates);
|
||||
gri.left = coorPixel[0] - parseFloat(gri.width) / 2;
|
||||
gri.top = coorPixel[1] - parseFloat(gri.height) / 2;
|
||||
return gri;
|
||||
});
|
||||
}
|
||||
return serie;
|
||||
};
|
||||
|
||||
|
||||
|
||||
var charts = /*#__PURE__*/Object.freeze({
|
||||
pie: pie,
|
||||
bar: bar,
|
||||
line: line
|
||||
});
|
||||
|
||||
var Map = ol.Map;
|
||||
var obj = ol.Object;
|
||||
var transform = ol.proj.transform;
|
||||
if (!Map.prototype.getOverlayContainer) {
|
||||
Map.prototype.getOverlayContainer = function (className) {
|
||||
className = className || 'ol-overlaycontainer';
|
||||
var viewport = this.getViewport();
|
||||
if (viewport) {
|
||||
var overlays = viewport.getElementsByClassName(className);
|
||||
return overlays && overlays.length > 0 ? overlays[0] : null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
if (!Map.prototype.getOverlayContainerStopEvent) {
|
||||
Map.prototype.getOverlayContainerStopEvent = function (className) {
|
||||
className = className || 'ol-overlaycontainer-stopevent';
|
||||
var viewport = this.getViewport();
|
||||
if (viewport) {
|
||||
var overlays = viewport.getElementsByClassName(className);
|
||||
return overlays && overlays.length > 0 ? overlays[0] : null;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
var _options = {
|
||||
forcedRerender: false,
|
||||
forcedPrecomposeRerender: false,
|
||||
hideOnZooming: false,
|
||||
hideOnMoving: false,
|
||||
hideOnRotating: false,
|
||||
convertTypes: ['pie', 'line', 'bar'],
|
||||
insertFirst: false,
|
||||
stopEvent: false,
|
||||
polyfillEvents: false,
|
||||
};
|
||||
var EChartsLayer = (function (_super) {
|
||||
__extends(EChartsLayer, _super);
|
||||
function EChartsLayer(chartOptions, options, map) {
|
||||
var _this = this;
|
||||
var opts = Object.assign(_options, options);
|
||||
_this = _super.call(this, opts) || this;
|
||||
_this._options = opts;
|
||||
_this._chartOptions = chartOptions;
|
||||
_this.set('chartOptions', chartOptions);
|
||||
_this.$chart = null;
|
||||
_this.$container = undefined;
|
||||
_this._isRegistered = false;
|
||||
_this._initEvent = false;
|
||||
_this._incremental = [];
|
||||
_this._coordinateSystem = null;
|
||||
_this.coordinateSystemId = '';
|
||||
_this.prevVisibleState = '';
|
||||
bindAll([
|
||||
'redraw', 'onResize', 'onZoomEnd', 'onCenterChange',
|
||||
'onDragRotateEnd', 'onMoveStart', 'onMoveEnd',
|
||||
'mouseDown', 'mouseUp', 'onClick', 'mouseMove' ], _this);
|
||||
if (map)
|
||||
{ _this.setMap(map); }
|
||||
return _this;
|
||||
}
|
||||
EChartsLayer.prototype.appendTo = function (map, forceIgnore) {
|
||||
if (forceIgnore === void 0) { forceIgnore = false; }
|
||||
this.setMap(map, forceIgnore);
|
||||
};
|
||||
EChartsLayer.prototype.getMap = function () {
|
||||
return this._map;
|
||||
};
|
||||
EChartsLayer.prototype.setMap = function (map, forceIgnore) {
|
||||
var _this = this;
|
||||
if (forceIgnore === void 0) { forceIgnore = false; }
|
||||
if (map && (forceIgnore || map instanceof Map)) {
|
||||
this._map = map;
|
||||
this._map.once('postrender', function () {
|
||||
_this.handleMapChanged();
|
||||
});
|
||||
this._map.renderSync();
|
||||
}
|
||||
else {
|
||||
throw new Error('not ol map object');
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.getChartOptions = function () {
|
||||
return this.get('chartOptions');
|
||||
};
|
||||
EChartsLayer.prototype.setChartOptions = function (options) {
|
||||
if (options === void 0) { options = {}; }
|
||||
this._chartOptions = options;
|
||||
this.set('chartOptions', options);
|
||||
this.clearAndRedraw();
|
||||
return this;
|
||||
};
|
||||
EChartsLayer.prototype.appendData = function (data, save) {
|
||||
if (save === void 0) { save = true; }
|
||||
if (data) {
|
||||
if (save) {
|
||||
this._incremental = arrayAdd(this._incremental, {
|
||||
index: this._incremental.length,
|
||||
data: data.data,
|
||||
seriesIndex: data.seriesIndex,
|
||||
});
|
||||
}
|
||||
this.$chart.appendData({
|
||||
data: data.data.copyWithin(),
|
||||
seriesIndex: data.seriesIndex,
|
||||
});
|
||||
}
|
||||
return this;
|
||||
};
|
||||
EChartsLayer.prototype.clear = function (keep) {
|
||||
if (!keep) {
|
||||
this._incremental = [];
|
||||
}
|
||||
if (this.$chart) {
|
||||
this.$chart.clear();
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.remove = function () {
|
||||
this.clear();
|
||||
if (this.$chart) {
|
||||
this.$chart.dispose();
|
||||
}
|
||||
if (this._initEvent && this.$container) {
|
||||
this.$container && removeNode(this.$container);
|
||||
this.unBindEvent();
|
||||
}
|
||||
delete this.$chart;
|
||||
delete this._map;
|
||||
};
|
||||
EChartsLayer.prototype.show = function () {
|
||||
this.setVisible(true);
|
||||
};
|
||||
EChartsLayer.prototype.innerShow = function () {
|
||||
if (this.$container) {
|
||||
this.$container.style.display = this.prevVisibleState;
|
||||
this.prevVisibleState = '';
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.hide = function () {
|
||||
this.setVisible(false);
|
||||
};
|
||||
EChartsLayer.prototype.innerHide = function () {
|
||||
if (this.$container) {
|
||||
this.prevVisibleState = this.$container.style.display;
|
||||
this.$container.style.display = 'none';
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.isVisible = function () {
|
||||
return this.$container && this.$container.style.display !== 'none';
|
||||
};
|
||||
EChartsLayer.prototype.showLoading = function () {
|
||||
if (this.$chart) {
|
||||
this.$chart.showLoading();
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.hideLoading = function () {
|
||||
if (this.$chart) {
|
||||
this.$chart.hideLoading();
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.setZIndex = function (zIndex) {
|
||||
if (this.$container) {
|
||||
if (typeof zIndex === 'number') {
|
||||
zIndex = String(zIndex);
|
||||
}
|
||||
this.$container.style.zIndex = zIndex;
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.getZIndex = function () {
|
||||
return this.$container && this.$container.style.zIndex;
|
||||
};
|
||||
EChartsLayer.prototype.setVisible = function (visible) {
|
||||
if (visible) {
|
||||
if (this.$container) {
|
||||
this.$container.style.display = '';
|
||||
}
|
||||
this._chartOptions = this.getChartOptions();
|
||||
this.clearAndRedraw();
|
||||
}
|
||||
else {
|
||||
if (this.$container) {
|
||||
this.$container.style.display = 'none';
|
||||
}
|
||||
this.clear(true);
|
||||
this._chartOptions = {};
|
||||
this.clearAndRedraw();
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.render = function () {
|
||||
if (!this.$chart && this.$container) {
|
||||
this.$chart = echarts.init(this.$container);
|
||||
if (this._chartOptions) {
|
||||
this.registerMap();
|
||||
this.$chart.setOption(this.convertData(this._chartOptions), false);
|
||||
}
|
||||
this.dispatchEvent({
|
||||
type: 'load',
|
||||
source: this,
|
||||
value: this.$chart,
|
||||
});
|
||||
}
|
||||
else if (this.isVisible()) {
|
||||
this.redraw();
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.redraw = function () {
|
||||
this.clearAndRedraw();
|
||||
};
|
||||
EChartsLayer.prototype.updateViewSize = function (size) {
|
||||
if (!this.$container)
|
||||
{ return; }
|
||||
this.$container.style.width = size[0] + "px";
|
||||
this.$container.style.height = size[1] + "px";
|
||||
this.$container.setAttribute('width', String(size[0]));
|
||||
this.$container.setAttribute('height', String(size[1]));
|
||||
};
|
||||
EChartsLayer.prototype.onResize = function (event) {
|
||||
var map = this.getMap();
|
||||
if (map) {
|
||||
var size = map.getSize();
|
||||
this.updateViewSize(size);
|
||||
this.clearAndRedraw();
|
||||
if (event) {
|
||||
this.dispatchEvent({
|
||||
type: 'change:size',
|
||||
source: this,
|
||||
value: size,
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onZoomEnd = function () {
|
||||
this._options.hideOnZooming && this.innerShow();
|
||||
var map = this.getMap();
|
||||
if (map && map.getView()) {
|
||||
this.clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'zoomend',
|
||||
source: this,
|
||||
value: map.getView().getZoom(),
|
||||
});
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onDragRotateEnd = function () {
|
||||
this._options.hideOnRotating && this.innerShow();
|
||||
var map = this.getMap();
|
||||
if (map && map.getView()) {
|
||||
this.clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'change:rotation',
|
||||
source: this,
|
||||
value: map.getView().getRotation(),
|
||||
});
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onMoveStart = function () {
|
||||
this._options.hideOnMoving && this.innerHide();
|
||||
var map = this.getMap();
|
||||
if (map && map.getView()) {
|
||||
this.dispatchEvent({
|
||||
type: 'movestart',
|
||||
source: this,
|
||||
value: map.getView().getCenter(),
|
||||
});
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onMoveEnd = function () {
|
||||
this._options.hideOnMoving && this.innerShow();
|
||||
var map = this.getMap();
|
||||
if (map && map.getView()) {
|
||||
this.clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'moveend',
|
||||
source: this,
|
||||
value: map.getView().getCenter(),
|
||||
});
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onClick = function (event) {
|
||||
if (this.$chart) {
|
||||
this.$chart.getZr().painter.getViewportRoot().dispatchEvent(mockEvent('click', event));
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.mouseDown = function (event) {
|
||||
if (this.$chart) {
|
||||
this.$chart.getZr().painter.getViewportRoot().dispatchEvent(mockEvent('mousedown', event));
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.mouseUp = function (event) {
|
||||
if (this.$chart) {
|
||||
this.$chart.getZr().painter.getViewportRoot().dispatchEvent(mockEvent('mouseup', event));
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.mouseMove = function (event) {
|
||||
if (this.$chart) {
|
||||
var target = event.originalEvent.target;
|
||||
while (target) {
|
||||
if (target.className === 'ol-overlaycontainer-stopevent') {
|
||||
this.$chart.getZr().painter.getViewportRoot().dispatchEvent(mockEvent('mousemove', event));
|
||||
return;
|
||||
}
|
||||
target = target.parentElement;
|
||||
}
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.onCenterChange = function () {
|
||||
var map = this.getMap();
|
||||
if (map && map.getView()) {
|
||||
this.clearAndRedraw();
|
||||
this.dispatchEvent({
|
||||
type: 'change:center',
|
||||
source: this,
|
||||
value: map.getView().getCenter(),
|
||||
});
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.handleMapChanged = function () {
|
||||
var map = this.getMap();
|
||||
if (this._initEvent && this.$container) {
|
||||
this.$container && removeNode(this.$container);
|
||||
this.unBindEvent();
|
||||
}
|
||||
if (!this.$container) {
|
||||
this.createLayerContainer();
|
||||
this.onResize(false);
|
||||
}
|
||||
if (map) {
|
||||
var container = this._options.stopEvent ? map.getOverlayContainerStopEvent() : map.getOverlayContainer();
|
||||
if (this._options.insertFirst) {
|
||||
container.insertBefore(this.$container, container.childNodes[0] || null);
|
||||
}
|
||||
else {
|
||||
container.appendChild(this.$container);
|
||||
}
|
||||
this.render();
|
||||
this.bindEvent(map);
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.createLayerContainer = function () {
|
||||
this.$container = document.createElement('div');
|
||||
this.$container.style.position = 'absolute';
|
||||
this.$container.style.top = '0px';
|
||||
this.$container.style.left = '0px';
|
||||
this.$container.style.right = '0px';
|
||||
this.$container.style.bottom = '0px';
|
||||
};
|
||||
EChartsLayer.prototype.bindEvent = function (map) {
|
||||
var view = map.getView();
|
||||
if (this._options.forcedPrecomposeRerender) {
|
||||
map.on('precompose', this.redraw);
|
||||
}
|
||||
map.on('change:size', this.onResize);
|
||||
view.on('change:resolution', this.onZoomEnd);
|
||||
view.on('change:center', this.onCenterChange);
|
||||
view.on('change:rotation', this.onDragRotateEnd);
|
||||
map.on('movestart', this.onMoveStart);
|
||||
map.on('moveend', this.onMoveEnd);
|
||||
if (this._options.polyfillEvents) {
|
||||
map.on('pointerdown', this.mouseDown);
|
||||
map.on('pointerup', this.mouseUp);
|
||||
map.on('pointermove', this.mouseMove);
|
||||
map.on('click', this.onClick);
|
||||
}
|
||||
this._initEvent = true;
|
||||
};
|
||||
EChartsLayer.prototype.unBindEvent = function () {
|
||||
var map = this.getMap();
|
||||
if (!map)
|
||||
{ return; }
|
||||
var view = map.getView();
|
||||
if (!view)
|
||||
{ return; }
|
||||
map.un('precompose', this.redraw);
|
||||
map.un('change:size', this.onResize);
|
||||
view.un('change:resolution', this.onZoomEnd);
|
||||
view.un('change:center', this.onCenterChange);
|
||||
view.un('change:rotation', this.onDragRotateEnd);
|
||||
map.un('movestart', this.onMoveStart);
|
||||
map.un('moveend', this.onMoveEnd);
|
||||
if (this._options.polyfillEvents) {
|
||||
map.un('pointerdown', this.mouseDown);
|
||||
map.un('pointerup', this.mouseUp);
|
||||
map.un('pointermove', this.mouseMove);
|
||||
map.un('click', this.onClick);
|
||||
}
|
||||
this._initEvent = false;
|
||||
};
|
||||
EChartsLayer.prototype.clearAndRedraw = function () {
|
||||
if (!this.$chart || !this.isVisible())
|
||||
{ return; }
|
||||
if (this._options.forcedRerender) {
|
||||
this.$chart.clear();
|
||||
}
|
||||
this.$chart.resize();
|
||||
if (this._chartOptions) {
|
||||
this.registerMap();
|
||||
this.$chart.setOption(this.convertData(this._chartOptions), false);
|
||||
if (this._incremental && this._incremental.length > 0) {
|
||||
for (var i = 0; i < this._incremental.length; i++) {
|
||||
this.appendData(this._incremental[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.dispatchEvent({
|
||||
type: 'redraw',
|
||||
source: this,
|
||||
});
|
||||
};
|
||||
EChartsLayer.prototype.registerMap = function () {
|
||||
if (!this._isRegistered) {
|
||||
this.coordinateSystemId = "openlayers_" + uuid();
|
||||
echarts.registerCoordinateSystem(this.coordinateSystemId, this.getCoordinateSystem(this._options));
|
||||
this._isRegistered = true;
|
||||
}
|
||||
if (this._chartOptions) {
|
||||
var series = this._chartOptions.series;
|
||||
if (series && isObject(series)) {
|
||||
var convertTypes = this._options.convertTypes;
|
||||
if (convertTypes) {
|
||||
for (var i = series.length - 1; i >= 0; i--) {
|
||||
if (!(convertTypes.indexOf(series[i].type) > -1)) {
|
||||
series[i].coordinateSystem = this.coordinateSystemId;
|
||||
}
|
||||
series[i].animation = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
EChartsLayer.prototype.convertData = function (options) {
|
||||
var series = options.series;
|
||||
if (series && series.length > 0) {
|
||||
if (!this._coordinateSystem) {
|
||||
var Rc = this.getCoordinateSystem(this._options);
|
||||
this._coordinateSystem = new Rc(this.getMap());
|
||||
}
|
||||
if (series && isObject(series)) {
|
||||
var convertTypes = this._options.convertTypes;
|
||||
if (convertTypes) {
|
||||
for (var i = series.length - 1; i >= 0; i--) {
|
||||
if (convertTypes.indexOf(series[i].type) > -1) {
|
||||
if (series[i] && series[i].hasOwnProperty('coordinates')) {
|
||||
series[i] = charts[series[i].type](options, series[i], this._coordinateSystem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return options;
|
||||
};
|
||||
EChartsLayer.prototype.getCoordinateSystem = function (options) {
|
||||
var map = this.getMap();
|
||||
var coordinateSystemId = this.coordinateSystemId;
|
||||
var RegisterCoordinateSystem = function (map) {
|
||||
this.map = map;
|
||||
this._mapOffset = [0, 0];
|
||||
this.dimensions = ['lng', 'lat'];
|
||||
this.projCode = RegisterCoordinateSystem.getProjectionCode(this.map);
|
||||
};
|
||||
RegisterCoordinateSystem.dimensions = RegisterCoordinateSystem.prototype.dimensions || ['lng', 'lat'];
|
||||
RegisterCoordinateSystem.prototype.getZoom = function () {
|
||||
return this.map.getView().getZoom();
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.setZoom = function (zoom) {
|
||||
return this.map.getView().setZoom(zoom);
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.getViewRectAfterRoam = function () {
|
||||
return this.getViewRect().clone();
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.setMapOffset = function (mapOffset) {
|
||||
this._mapOffset = mapOffset;
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.dataToPoint = function (data) {
|
||||
var coords;
|
||||
if (data && Array.isArray(data) && data.length > 0) {
|
||||
coords = data.map(function (item) {
|
||||
var res = 0;
|
||||
if (typeof item === 'string') {
|
||||
res = Number(item);
|
||||
}
|
||||
else {
|
||||
res = item;
|
||||
}
|
||||
return res;
|
||||
});
|
||||
var source = (options && options.source) || 'EPSG:4326';
|
||||
var destination = (options && options.destination) || this.projCode;
|
||||
var pixel = this.map.getPixelFromCoordinate(transform(coords, source, destination));
|
||||
var mapOffset = this._mapOffset;
|
||||
return [pixel[0] - mapOffset[0], pixel[1] - mapOffset[1]];
|
||||
}
|
||||
return [0, 0];
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.pointToData = function (pixel) {
|
||||
var mapOffset = this._mapOffset;
|
||||
return this.map.getCoordinateFromPixel([pixel[0] + mapOffset[0], pixel[1] + mapOffset[1]]);
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.getViewRect = function () {
|
||||
var size = this.map.getSize();
|
||||
return new echarts.graphic.BoundingRect(0, 0, size[0], size[1]);
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.getRoamTransform = function () {
|
||||
return echarts.matrix.create();
|
||||
};
|
||||
RegisterCoordinateSystem.prototype.prepareCustoms = function () {
|
||||
var rect = this.getViewRect();
|
||||
return {
|
||||
coordSys: {
|
||||
type: coordinateSystemId,
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
},
|
||||
api: {
|
||||
coord: bind(this.dataToPoint, this),
|
||||
size: bind(RegisterCoordinateSystem.dataToCoordsSize, this),
|
||||
},
|
||||
};
|
||||
};
|
||||
RegisterCoordinateSystem.create = function (echartsModel) {
|
||||
echartsModel.eachSeries(function (seriesModel) {
|
||||
if (seriesModel.get('coordinateSystem') === coordinateSystemId) {
|
||||
seriesModel.coordinateSystem = new RegisterCoordinateSystem(map);
|
||||
}
|
||||
});
|
||||
};
|
||||
RegisterCoordinateSystem.getProjectionCode = function (map) {
|
||||
var code = '';
|
||||
if (map) {
|
||||
code = map.getView()
|
||||
&& map
|
||||
.getView()
|
||||
.getProjection()
|
||||
.getCode();
|
||||
}
|
||||
else {
|
||||
code = 'EPSG:3857';
|
||||
}
|
||||
return code;
|
||||
};
|
||||
RegisterCoordinateSystem.dataToCoordsSize = function (dataSize, dataItem) {
|
||||
var _this = this;
|
||||
if (dataItem === void 0) { dataItem = [0, 0]; }
|
||||
return [0, 1].map(function (dimIdx) {
|
||||
var val = dataItem[dimIdx];
|
||||
var p1 = [];
|
||||
var p2 = [];
|
||||
var halfSize = dataSize[dimIdx] / 2;
|
||||
p1[dimIdx] = val - halfSize;
|
||||
p2[dimIdx] = val + halfSize;
|
||||
p1[1 - dimIdx] = dataItem[1 - dimIdx];
|
||||
p2[1 - dimIdx] = dataItem[1 - dimIdx];
|
||||
var offset = _this.dataToPoint(p1)[dimIdx] - _this.dataToPoint(p2)[dimIdx];
|
||||
return Math.abs(offset);
|
||||
}, this);
|
||||
};
|
||||
return RegisterCoordinateSystem;
|
||||
};
|
||||
EChartsLayer.prototype.dispatchEvent = function (event) {
|
||||
return _super.prototype.dispatchEvent.call(this, event);
|
||||
};
|
||||
EChartsLayer.prototype.set = function (key, value, optSilent) {
|
||||
return _super.prototype.set.call(this, key, value, optSilent);
|
||||
};
|
||||
EChartsLayer.prototype.get = function (key) {
|
||||
return _super.prototype.get.call(this, key);
|
||||
};
|
||||
EChartsLayer.prototype.unset = function (key, optSilent) {
|
||||
return _super.prototype.unset.call(this, key, optSilent);
|
||||
};
|
||||
EChartsLayer.prototype.on = function (type, listener, optThis) {
|
||||
return _super.prototype.on.call(this, type, listener, optThis);
|
||||
};
|
||||
EChartsLayer.prototype.un = function (type, listener, optThis) {
|
||||
return _super.prototype.un.call(this, type, listener, optThis);
|
||||
};
|
||||
EChartsLayer.formatGeoJSON = formatGeoJSON;
|
||||
EChartsLayer.bind = bind;
|
||||
EChartsLayer.merge = merge;
|
||||
EChartsLayer.uuid = uuid;
|
||||
EChartsLayer.bindAll = bindAll;
|
||||
EChartsLayer.arrayAdd = arrayAdd;
|
||||
EChartsLayer.removeNode = removeNode;
|
||||
EChartsLayer.isObject = isObject;
|
||||
return EChartsLayer;
|
||||
}(obj));
|
||||
|
||||
return EChartsLayer;
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=ol3Echarts.js.map
|
1
public/libs/openlayers/ol3-echarts/2.0.6/ol3Echarts.min.js
vendored
Normal file
1
public/libs/openlayers/ol3-echarts/2.0.6/ol3Echarts.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,206 @@
|
||||
/*
|
||||
Copyright (c) 2015 Jean-Marc VIGLINO,
|
||||
released under the CeCILL-B license (http://www.cecill.info/).
|
||||
github: https://github.com/Viglino/OL3-AnimatedCluster
|
||||
ol.layer.AnimatedCluster is a vector layer tha animate cluster
|
||||
|
||||
olx.layer.AnimatedClusterOptions: extend olx.layer.Options
|
||||
{ animationDuration {Number} animation duration in ms, default is 700ms
|
||||
animationMethod {function} easing method to use, default ol.easing.easeOut
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @constructor AnimatedCluster
|
||||
* @extends {ol.layer.Vector}
|
||||
* @param {olx.layer.AnimatedClusterOptions=} options
|
||||
* @todo
|
||||
*/
|
||||
ol.layer.AnimatedCluster = function(opt_options)
|
||||
{ var options = opt_options || {};
|
||||
|
||||
ol.layer.Vector.call (this, options);
|
||||
|
||||
this.oldcluster = new ol.source.Vector();
|
||||
this.clusters = [];
|
||||
this.animation={start:false};
|
||||
this.set('animationDuration', typeof(options.animationDuration)=='number' ? options.animationDuration : 700);
|
||||
this.set('animationMethod', options.animationMethod || ol.easing.easeOut);
|
||||
|
||||
// Save cluster before change
|
||||
this.getSource().on('change', this.saveCluster, this);
|
||||
// Animate the cluster
|
||||
this.on('precompose', this.animate, this);
|
||||
this.on('postcompose', this.postanimate, this);
|
||||
};
|
||||
ol.inherits (ol.layer.AnimatedCluster, ol.layer.Vector);
|
||||
|
||||
/** @private save cluster features before change
|
||||
*/
|
||||
ol.layer.AnimatedCluster.prototype.saveCluster = function()
|
||||
{ this.oldcluster.clear();
|
||||
if (!this.get('animationDuration')) return;
|
||||
var features = this.getSource().getFeatures();
|
||||
if (features.length && features[0].get('features'))
|
||||
{ this.oldcluster.addFeatures (this.clusters);
|
||||
this.clusters = features.slice(0);
|
||||
this.sourceChanged = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** @private Get the cluster that contains a feature
|
||||
*/
|
||||
ol.layer.AnimatedCluster.prototype.getClusterForFeature = function(f, cluster)
|
||||
{ for (var j=0, c; c=cluster[j]; j++)
|
||||
{ var features = cluster[j].get('features');
|
||||
if (features && features.length)
|
||||
{ for (var k=0, f2; f2=features[k]; k++)
|
||||
{ if (f===f2)
|
||||
{ return cluster[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/** @private
|
||||
*/
|
||||
ol.layer.AnimatedCluster.prototype.stopAnimation = function()
|
||||
{ this.animation.start = false;
|
||||
this.animation.cA = [];
|
||||
this.animation.cB = [];
|
||||
};
|
||||
|
||||
/** @private animate the cluster
|
||||
*/
|
||||
ol.layer.AnimatedCluster.prototype.animate = function(e)
|
||||
{ var duration = this.get('animationDuration');
|
||||
if (!duration) return;
|
||||
var resolution = e.frameState.viewState.resolution;
|
||||
var a = this.animation;
|
||||
var time = e.frameState.time;
|
||||
|
||||
// Start a new animation, if change resolution and source has changed
|
||||
if (a.resolution != resolution && this.sourceChanged)
|
||||
{ var extent = e.frameState.extent;
|
||||
if (a.resolution < resolution)
|
||||
{ extent = ol.extent.buffer(extent, 100*resolution);
|
||||
a.cA = this.oldcluster.getFeaturesInExtent(extent);
|
||||
a.cB = this.getSource().getFeaturesInExtent(extent);
|
||||
a.revers = false;
|
||||
}
|
||||
else
|
||||
{ extent = ol.extent.buffer(extent, 100*resolution);
|
||||
a.cA = this.getSource().getFeaturesInExtent(extent);
|
||||
a.cB = this.oldcluster.getFeaturesInExtent(extent);
|
||||
a.revers = true;
|
||||
}
|
||||
a.clusters = [];
|
||||
for (var i=0, c0; c0=a.cA[i]; i++)
|
||||
{ var f = c0.get('features');
|
||||
if (f && f.length)
|
||||
{ var c = this.getClusterForFeature (f[0], a.cB);
|
||||
if (c) a.clusters.push({ f:c0, pt:c.getGeometry().getCoordinates() });
|
||||
}
|
||||
}
|
||||
// Save state
|
||||
a.resolution = resolution;
|
||||
this.sourceChanged = false;
|
||||
|
||||
// No cluster or too much to animate
|
||||
if (!a.clusters.length || a.clusters.length>1000)
|
||||
{ this.stopAnimation();
|
||||
return;
|
||||
}
|
||||
// Start animation from now
|
||||
time = a.start = (new Date()).getTime();
|
||||
}
|
||||
|
||||
// Run animation
|
||||
if (a.start)
|
||||
{ var vectorContext = e.vectorContext;
|
||||
var d = (time - a.start) / duration;
|
||||
// Animation ends
|
||||
if (d > 1.0)
|
||||
{ this.stopAnimation();
|
||||
d = 1;
|
||||
}
|
||||
d = this.get('animationMethod')(d);
|
||||
// Animate
|
||||
var style = this.getStyle();
|
||||
var stylefn = (typeof(style) == 'function') ? style : style.length ? function(){ return style; } : function(){ return [style]; } ;
|
||||
// Layer opacity
|
||||
e.context.save();
|
||||
e.context.globalAlpha = this.getOpacity();
|
||||
// Retina device
|
||||
var ratio = e.frameState.pixelRatio;
|
||||
for (var i=0, c; c=a.clusters[i]; i++)
|
||||
{ var pt = c.f.getGeometry().getCoordinates();
|
||||
if (a.revers)
|
||||
{ pt[0] = c.pt[0] + d * (pt[0]-c.pt[0]);
|
||||
pt[1] = c.pt[1] + d * (pt[1]-c.pt[1]);
|
||||
}
|
||||
else
|
||||
{ pt[0] = pt[0] + d * (c.pt[0]-pt[0]);
|
||||
pt[1] = pt[1] + d * (c.pt[1]-pt[1]);
|
||||
}
|
||||
// Draw feature
|
||||
var st = stylefn(c.f, resolution);
|
||||
/* Preserve pixel ration on retina */
|
||||
var geo = new ol.geom.Point(pt);
|
||||
for (var k=0; s=st[k]; k++)
|
||||
{ var sc;
|
||||
// OL < v4.3 : setImageStyle doesn't check retina
|
||||
var imgs = ol.Map.prototype.getFeaturesAtPixel ? false : s.getImage();
|
||||
if (imgs)
|
||||
{ sc = imgs.getScale();
|
||||
imgs.setScale(sc*ratio);
|
||||
}
|
||||
// OL3 > v3.14
|
||||
if (vectorContext.setStyle)
|
||||
{ vectorContext.setStyle(s);
|
||||
vectorContext.drawGeometry(geo);
|
||||
}
|
||||
// older version
|
||||
else
|
||||
{ vectorContext.setImageStyle(imgs);
|
||||
vectorContext.setTextStyle(s.getText());
|
||||
vectorContext.drawPointGeometry(geo);
|
||||
}
|
||||
if (imgs) imgs.setScale(sc);
|
||||
}
|
||||
/*/
|
||||
var f = new ol.Feature(new ol.geom.Point(pt));
|
||||
for (var k=0; s=st[k]; k++)
|
||||
{ var imgs = s.getImage();
|
||||
var sc = imgs.getScale();
|
||||
imgs.setScale(sc*ratio); // drawFeature don't check retina
|
||||
vectorContext.drawFeature(f, s);
|
||||
imgs.setScale(sc);
|
||||
}
|
||||
/**/
|
||||
}
|
||||
e.context.restore();
|
||||
// tell OL3 to continue postcompose animation
|
||||
e.frameState.animate = true;
|
||||
|
||||
// Prevent layer drawing (clip with null rect)
|
||||
e.context.save();
|
||||
e.context.beginPath();
|
||||
e.context.rect(0,0,0,0);
|
||||
e.context.clip();
|
||||
this.clip_ = true;
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
/** @private remove clipping after the layer is drawn
|
||||
*/
|
||||
ol.layer.AnimatedCluster.prototype.postanimate = function(e)
|
||||
{ if (this.clip_)
|
||||
{ e.context.restore();
|
||||
this.clip_ = false;
|
||||
}
|
||||
};
|
@ -0,0 +1,183 @@
|
||||
.layer-switcher {
|
||||
position: absolute;
|
||||
top: 3.5em;
|
||||
right: 0.5em;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.layer-switcher .panel {
|
||||
margin: 0;
|
||||
border: 4px solid #eee;
|
||||
border-radius: 4px;
|
||||
background-color: white;
|
||||
display: none;
|
||||
max-height: inherit;
|
||||
height: 100%;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.layer-switcher button {
|
||||
float: right;
|
||||
z-index: 1;
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAACE1BMVEX///8A//8AgICA//8AVVVAQID///8rVVVJtttgv98nTmJ2xNgkW1ttyNsmWWZmzNZYxM4gWGgeU2JmzNNr0N1Rwc0eU2VXxdEhV2JqytQeVmMhVmNoydUfVGUgVGQfVGQfVmVqy9hqy9dWw9AfVWRpydVry9YhVmMgVGNUw9BrytchVWRexdGw294gVWQgVmUhVWPd4N6HoaZsy9cfVmQgVGRrytZsy9cgVWQgVWMgVWRsy9YfVWNsy9YgVWVty9YgVWVry9UgVWRsy9Zsy9UfVWRsy9YgVWVty9YgVWRty9Vsy9aM09sgVWRTws/AzM0gVWRtzNYgVWRuy9Zsy9cgVWRGcHxty9bb5ORbxdEgVWRty9bn6OZTws9mydRfxtLX3Nva5eRix9NFcXxOd4JPeINQeIMiVmVUws9Vws9Vw9BXw9BYxNBaxNBbxNBcxdJexdElWWgmWmhjyNRlx9IqXGtoipNpytVqytVryNNrytZsjZUuX210k5t1y9R2zNR3y9V4lp57zth9zdaAnKOGoaeK0NiNpquV09mesrag1tuitbmj1tuj19uktrqr2d2svcCu2d2xwMO63N+7x8nA3uDC3uDFz9DK4eHL4eLN4eIyYnDX5OM5Z3Tb397e4uDf4uHf5uXi5ePi5+Xj5+Xk5+Xm5+Xm6OY6aHXQ19fT4+NfhI1Ww89gx9Nhx9Nsy9ZWw9Dpj2abAAAAWnRSTlMAAQICAwQEBgcIDQ0ODhQZGiAiIyYpKywvNTs+QklPUlNUWWJjaGt0dnd+hIWFh4mNjZCSm6CpsbW2t7nDzNDT1dje5efr7PHy9PT29/j4+Pn5+vr8/f39/f6DPtKwAAABTklEQVR4Xr3QVWPbMBSAUTVFZmZmhhSXMjNvkhwqMzMzMzPDeD+xASvObKePPa+ffHVl8PlsnE0+qPpBuQjVJjno6pZpSKXYl7/bZyFaQxhf98hHDKEppwdWIW1frFnrxSOWHFfWesSEWC6R/P4zOFrix3TzDFLlXRTR8c0fEEJ1/itpo7SVO9Jdr1DVxZ0USyjZsEY5vZfiiAC0UoTGOrm9PZLuRl8X+Dq1HQtoFbJZbv61i+Poblh/97TC7n0neCcK0ETNUrz1/xPHf+DNAW9Ac6t8O8WH3Vp98f5lCaYKAOFZMLyHL4Y0fe319idMNgMMp+zWVSybUed/+/h7I4wRAG1W6XDy4XmjR9HnzvDRZXUAYDFOhC1S/Hh+fIXxen+eO+AKqbs+wAo30zDTDvDxKoJN88sjUzDFAvBzEUGFsnADoIvAJzoh2BZ8sner+Ke/vwECuQAAAABJRU5ErkJggg==')
|
||||
/*logo.png*/;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 2px;
|
||||
background-color: white;
|
||||
color: black;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.layer-switcher button:focus,
|
||||
.layer-switcher button:hover {
|
||||
background-color: white;
|
||||
}
|
||||
.layer-switcher.shown {
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.layer-switcher.shown.ol-control {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.layer-switcher.shown.ol-control:hover {
|
||||
background-color: transparent;
|
||||
}
|
||||
.layer-switcher.shown .panel {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.layer-switcher.shown button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.layer-switcher.shown.layer-switcher-activation-mode-click > button {
|
||||
display: block;
|
||||
background-image: unset;
|
||||
right: 2px;
|
||||
position: absolute;
|
||||
background-color: #eee;
|
||||
margin: 0 1px;
|
||||
}
|
||||
|
||||
.layer-switcher.shown button:focus,
|
||||
.layer-switcher.shown button:hover {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.layer-switcher ul {
|
||||
list-style: none;
|
||||
margin: 1.6em 0.4em;
|
||||
padding-left: 0;
|
||||
}
|
||||
.layer-switcher ul ul {
|
||||
padding-left: 1.2em;
|
||||
margin: 0.1em 0 0 0;
|
||||
}
|
||||
.layer-switcher li.group + li.group {
|
||||
margin-top: 0.4em;
|
||||
}
|
||||
.layer-switcher li.group + li.layer-switcher-base-group {
|
||||
}
|
||||
|
||||
.layer-switcher li.group > label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.layer-switcher.layer-switcher-group-select-style-none li.group > label {
|
||||
padding-left: 1.2em;
|
||||
}
|
||||
|
||||
.layer-switcher li {
|
||||
position: relative;
|
||||
margin-top: 0.3em;
|
||||
}
|
||||
|
||||
.layer-switcher li input {
|
||||
position: absolute;
|
||||
left: 1.2em;
|
||||
height: 1em;
|
||||
width: 1em;
|
||||
font-size: 1em;
|
||||
}
|
||||
.layer-switcher li label {
|
||||
padding-left: 2.7em;
|
||||
padding-right: 1.2em;
|
||||
display: inline-block;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
.layer-switcher label.disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.layer-switcher input {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.layer-switcher.touch ::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
|
||||
.layer-switcher.touch ::-webkit-scrollbar-track {
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.layer-switcher.touch ::-webkit-scrollbar-thumb {
|
||||
border-radius: 10px;
|
||||
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
li.layer-switcher-base-group > label {
|
||||
padding-left: 1.2em;
|
||||
}
|
||||
|
||||
.layer-switcher .group button {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
float: none;
|
||||
font-size: 1em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin: 0;
|
||||
background-position: center 2px;
|
||||
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAW0lEQVR4nGNgGAWMyBwXFxcGBgaGeii3EU0tXHzPnj1wQRYsihqQ+I0ExDEMQAYNONgoAN0AmMkNaDSyQSheY8JiaCMOGzE04zIAmyFYNTMw4A+DRhzsUUBtAADw4BCeIZkGdwAAAABJRU5ErkJggg==');
|
||||
-webkit-transition: -webkit-transform 0.2s ease-in-out;
|
||||
-ms-transition: -ms-transform 0.2s ease-in-out;
|
||||
transition: transform 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.layer-switcher .group.layer-switcher-close button {
|
||||
transform: rotate(-90deg);
|
||||
-webkit-transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
.layer-switcher .group.layer-switcher-fold.layer-switcher-close > ul {
|
||||
overflow: hidden;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/*layerswitcher on the right*/
|
||||
.layer-switcher.shown.layer-switcher-activation-mode-click {
|
||||
padding-left: 34px;
|
||||
}
|
||||
.layer-switcher.shown.layer-switcher-activation-mode-click > button {
|
||||
left: 0;
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
/*layerswitcher on the left*/
|
||||
/*
|
||||
.layer-switcher.shown.layer-switcher-activation-mode-click {
|
||||
padding-right: 34px;
|
||||
}
|
||||
.layer-switcher.shown.layer-switcher-activation-mode-click > button {
|
||||
right: 0;
|
||||
border-left: 0;
|
||||
}
|
||||
*/
|
@ -0,0 +1,694 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('ol/control/Control'), require('ol/Observable'), require('ol/layer/Group')) :
|
||||
typeof define === 'function' && define.amd ? define(['ol/control/Control', 'ol/Observable', 'ol/layer/Group'], factory) :
|
||||
(global.LayerSwitcher = factory(global.ol.control.Control,global.ol.Observable,global.ol.layer.Group));
|
||||
}(this, (function (Control,ol_Observable,LayerGroup) { 'use strict';
|
||||
|
||||
Control = 'default' in Control ? Control['default'] : Control;
|
||||
LayerGroup = 'default' in LayerGroup ? LayerGroup['default'] : LayerGroup;
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var get = function get(object, property, receiver) {
|
||||
if (object === null) object = Function.prototype;
|
||||
var desc = Object.getOwnPropertyDescriptor(object, property);
|
||||
|
||||
if (desc === undefined) {
|
||||
var parent = Object.getPrototypeOf(object);
|
||||
|
||||
if (parent === null) {
|
||||
return undefined;
|
||||
} else {
|
||||
return get(parent, property, receiver);
|
||||
}
|
||||
} else if ("value" in desc) {
|
||||
return desc.value;
|
||||
} else {
|
||||
var getter = desc.get;
|
||||
|
||||
if (getter === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return getter.call(receiver);
|
||||
}
|
||||
};
|
||||
|
||||
var inherits = function (subClass, superClass) {
|
||||
if (typeof superClass !== "function" && superClass !== null) {
|
||||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
|
||||
}
|
||||
|
||||
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
||||
constructor: {
|
||||
value: subClass,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var possibleConstructorReturn = function (self, call) {
|
||||
if (!self) {
|
||||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
||||
}
|
||||
|
||||
return call && (typeof call === "object" || typeof call === "function") ? call : self;
|
||||
};
|
||||
|
||||
/**
|
||||
* @protected
|
||||
*/
|
||||
var CSS_PREFIX = 'layer-switcher-';
|
||||
/**
|
||||
* OpenLayers LayerSwitcher Control, displays a list of layers and groups
|
||||
* associated with a map which have a `title` property.
|
||||
*
|
||||
* To be shown in the LayerSwitcher panel layers must have a `title` property;
|
||||
* base map layers should have a `type` property set to `base`. Group layers
|
||||
* (`LayerGroup`) can be used to visually group layers together; a group
|
||||
* with a `fold` property set to either `'open'` or `'close'` will be displayed
|
||||
* with a toggle.
|
||||
*
|
||||
* See [BaseLayerOptions](#baselayeroptions) for a full list of LayerSwitcher
|
||||
* properties for layers (`TileLayer`, `ImageLayer`, `VectorTile` etc.) and
|
||||
* [GroupLayerOptions](#grouplayeroptions) for group layer (`LayerGroup`)
|
||||
* LayerSwitcher properties.
|
||||
*
|
||||
* Layer and group properties can either be set by adding extra properties
|
||||
* to their options when they are created or via their set method.
|
||||
*
|
||||
* Specify a `title` for a Layer by adding a `title` property to it's options object:
|
||||
* ```javascript
|
||||
* var lyr = new ol.layer.Tile({
|
||||
* // Specify a title property which will be displayed by the layer switcher
|
||||
* title: 'OpenStreetMap',
|
||||
* visible: true,
|
||||
* source: new ol.source.OSM()
|
||||
* })
|
||||
* ```
|
||||
*
|
||||
* Alternatively the properties can be set via the `set` method after a layer has been created:
|
||||
* ```javascript
|
||||
* var lyr = new ol.layer.Tile({
|
||||
* visible: true,
|
||||
* source: new ol.source.OSM()
|
||||
* })
|
||||
* // Specify a title property which will be displayed by the layer switcher
|
||||
* lyr.set('title', 'OpenStreetMap');
|
||||
* ```
|
||||
*
|
||||
* To create a LayerSwitcher and add it to a map, create a new instance then pass it to the map's [`addControl` method](https://openlayers.org/en/latest/apidoc/module-ol_PluggableMap-PluggableMap.html#addControl).
|
||||
* ```javascript
|
||||
* var layerSwitcher = new LayerSwitcher({
|
||||
* reverse: true,
|
||||
* groupSelectStyle: 'group'
|
||||
* });
|
||||
* map.addControl(layerSwitcher);
|
||||
* ```
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol/control/Control~Control}
|
||||
* @param opt_options LayerSwitcher options, see [LayerSwitcher Options](#options) and [RenderOptions](#renderoptions) which LayerSwitcher `Options` extends for more details.
|
||||
*/
|
||||
|
||||
var LayerSwitcher = function (_Control) {
|
||||
inherits(LayerSwitcher, _Control);
|
||||
|
||||
function LayerSwitcher(opt_options) {
|
||||
classCallCheck(this, LayerSwitcher);
|
||||
|
||||
var options = Object.assign({}, opt_options);
|
||||
// TODO Next: Rename to showButtonTitle
|
||||
var tipLabel = options.tipLabel ? options.tipLabel : 'Legend';
|
||||
// TODO Next: Rename to hideButtonTitle
|
||||
var collapseTipLabel = options.collapseTipLabel ? options.collapseTipLabel : 'Collapse legend';
|
||||
var element = document.createElement('div');
|
||||
|
||||
var _this = possibleConstructorReturn(this, (LayerSwitcher.__proto__ || Object.getPrototypeOf(LayerSwitcher)).call(this, { element: element, target: options.target }));
|
||||
|
||||
_this.activationMode = options.activationMode || 'mouseover';
|
||||
_this.startActive = options.startActive === true;
|
||||
// TODO Next: Rename to showButtonContent
|
||||
var label = options.label !== undefined ? options.label : '';
|
||||
// TODO Next: Rename to hideButtonContent
|
||||
var collapseLabel = options.collapseLabel !== undefined ? options.collapseLabel : '\xBB';
|
||||
_this.groupSelectStyle = LayerSwitcher.getGroupSelectStyle(options.groupSelectStyle);
|
||||
_this.reverse = options.reverse !== false;
|
||||
_this.mapListeners = [];
|
||||
_this.hiddenClassName = 'ol-unselectable ol-control layer-switcher';
|
||||
if (LayerSwitcher.isTouchDevice_()) {
|
||||
_this.hiddenClassName += ' touch';
|
||||
}
|
||||
_this.shownClassName = 'shown';
|
||||
element.className = _this.hiddenClassName;
|
||||
var button = document.createElement('button');
|
||||
button.setAttribute('title', tipLabel);
|
||||
button.setAttribute('aria-label', tipLabel);
|
||||
element.appendChild(button);
|
||||
_this.panel = document.createElement('div');
|
||||
_this.panel.className = 'panel';
|
||||
element.appendChild(_this.panel);
|
||||
LayerSwitcher.enableTouchScroll_(_this.panel);
|
||||
button.textContent = label;
|
||||
element.classList.add(CSS_PREFIX + 'group-select-style-' + _this.groupSelectStyle);
|
||||
element.classList.add(CSS_PREFIX + 'activation-mode-' + _this.activationMode);
|
||||
if (_this.activationMode === 'click') {
|
||||
// TODO Next: Remove in favour of layer-switcher-activation-mode-click
|
||||
element.classList.add('activationModeClick');
|
||||
if (_this.startActive) {
|
||||
button.textContent = collapseLabel;
|
||||
button.setAttribute('title', collapseTipLabel);
|
||||
button.setAttribute('aria-label', collapseTipLabel);
|
||||
}
|
||||
button.onclick = function (e) {
|
||||
var evt = e || window.event;
|
||||
if (_this.element.classList.contains(_this.shownClassName)) {
|
||||
_this.hidePanel();
|
||||
button.textContent = label;
|
||||
button.setAttribute('title', tipLabel);
|
||||
button.setAttribute('aria-label', tipLabel);
|
||||
} else {
|
||||
_this.showPanel();
|
||||
button.textContent = collapseLabel;
|
||||
button.setAttribute('title', collapseTipLabel);
|
||||
button.setAttribute('aria-label', collapseTipLabel);
|
||||
}
|
||||
evt.preventDefault();
|
||||
};
|
||||
} else {
|
||||
button.onmouseover = function () {
|
||||
_this.showPanel();
|
||||
};
|
||||
button.onclick = function (e) {
|
||||
var evt = e || window.event;
|
||||
_this.showPanel();
|
||||
evt.preventDefault();
|
||||
};
|
||||
_this.panel.onmouseout = function (evt) {
|
||||
if (!_this.panel.contains(evt.relatedTarget)) {
|
||||
_this.hidePanel();
|
||||
}
|
||||
};
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
/**
|
||||
* Set the map instance the control is associated with.
|
||||
* @param map The map instance.
|
||||
*/
|
||||
|
||||
|
||||
createClass(LayerSwitcher, [{
|
||||
key: 'setMap',
|
||||
value: function setMap(map) {
|
||||
var _this2 = this;
|
||||
|
||||
// Clean up listeners associated with the previous map
|
||||
for (var i = 0; i < this.mapListeners.length; i++) {
|
||||
ol_Observable.unByKey(this.mapListeners[i]);
|
||||
}
|
||||
this.mapListeners.length = 0;
|
||||
// Wire up listeners etc. and store reference to new map
|
||||
get(LayerSwitcher.prototype.__proto__ || Object.getPrototypeOf(LayerSwitcher.prototype), 'setMap', this).call(this, map);
|
||||
if (map) {
|
||||
if (this.startActive) {
|
||||
this.showPanel();
|
||||
} else {
|
||||
this.renderPanel();
|
||||
}
|
||||
if (this.activationMode !== 'click') {
|
||||
this.mapListeners.push(map.on('pointerdown', function () {
|
||||
_this2.hidePanel();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Show the layer panel.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'showPanel',
|
||||
value: function showPanel() {
|
||||
if (!this.element.classList.contains(this.shownClassName)) {
|
||||
this.element.classList.add(this.shownClassName);
|
||||
this.renderPanel();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Hide the layer panel.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'hidePanel',
|
||||
value: function hidePanel() {
|
||||
if (this.element.classList.contains(this.shownClassName)) {
|
||||
this.element.classList.remove(this.shownClassName);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Re-draw the layer panel to represent the current state of the layers.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'renderPanel',
|
||||
value: function renderPanel() {
|
||||
this.dispatchEvent('render');
|
||||
LayerSwitcher.renderPanel(this.getMap(), this.panel, {
|
||||
groupSelectStyle: this.groupSelectStyle,
|
||||
reverse: this.reverse
|
||||
});
|
||||
this.dispatchEvent('rendercomplete');
|
||||
}
|
||||
/**
|
||||
* **_[static]_** - Re-draw the layer panel to represent the current state of the layers.
|
||||
* @param map The OpenLayers Map instance to render layers for
|
||||
* @param panel The DOM Element into which the layer tree will be rendered
|
||||
* @param options Options for panel, group, and layers
|
||||
*/
|
||||
|
||||
}], [{
|
||||
key: 'renderPanel',
|
||||
value: function renderPanel(map, panel, options) {
|
||||
// Create the event.
|
||||
var render_event = new Event('render');
|
||||
// Dispatch the event.
|
||||
panel.dispatchEvent(render_event);
|
||||
options = options || {};
|
||||
options.groupSelectStyle = LayerSwitcher.getGroupSelectStyle(options.groupSelectStyle);
|
||||
LayerSwitcher.ensureTopVisibleBaseLayerShown(map, options.groupSelectStyle);
|
||||
while (panel.firstChild) {
|
||||
panel.removeChild(panel.firstChild);
|
||||
}
|
||||
// Reset indeterminate state for all layers and groups before
|
||||
// applying based on groupSelectStyle
|
||||
LayerSwitcher.forEachRecursive(map, function (l, _idx, _a) {
|
||||
l.set('indeterminate', false);
|
||||
});
|
||||
if (options.groupSelectStyle === 'children' || options.groupSelectStyle === 'none') {
|
||||
// Set visibile and indeterminate state of groups based on
|
||||
// their children's visibility
|
||||
LayerSwitcher.setGroupVisibility(map);
|
||||
} else if (options.groupSelectStyle === 'group') {
|
||||
// Set child indetermiate state based on their parent's visibility
|
||||
LayerSwitcher.setChildVisibility(map);
|
||||
}
|
||||
var ul = document.createElement('ul');
|
||||
panel.appendChild(ul);
|
||||
// passing two map arguments instead of lyr as we're passing the map as the root of the layers tree
|
||||
LayerSwitcher.renderLayers_(map, map, ul, options, function render(_changedLyr) {
|
||||
LayerSwitcher.renderPanel(map, panel, options);
|
||||
});
|
||||
// Create the event.
|
||||
var rendercomplete_event = new Event('rendercomplete');
|
||||
// Dispatch the event.
|
||||
panel.dispatchEvent(rendercomplete_event);
|
||||
}
|
||||
/**
|
||||
* **_[static]_** - Determine if a given layer group contains base layers
|
||||
* @param grp Group to test
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'isBaseGroup',
|
||||
value: function isBaseGroup(grp) {
|
||||
if (grp instanceof LayerGroup) {
|
||||
var lyrs = grp.getLayers().getArray();
|
||||
return lyrs.length && lyrs[0].get('type') === 'base';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'setGroupVisibility',
|
||||
value: function setGroupVisibility(map) {
|
||||
// Get a list of groups, with the deepest first
|
||||
var groups = LayerSwitcher.getGroupsAndLayers(map, function (l) {
|
||||
return l instanceof LayerGroup && !l.get('combine') && !LayerSwitcher.isBaseGroup(l);
|
||||
}).reverse();
|
||||
// console.log(groups.map(g => g.get('title')));
|
||||
groups.forEach(function (grp) {
|
||||
// TODO Can we use getLayersArray, is it public in the esm build?
|
||||
var descendantVisibility = grp.getLayersArray().map(function (l) {
|
||||
var state = l.getVisible();
|
||||
// console.log('>', l.get('title'), state);
|
||||
return state;
|
||||
});
|
||||
// console.log(descendantVisibility);
|
||||
if (descendantVisibility.every(function (v) {
|
||||
return v === true;
|
||||
})) {
|
||||
grp.setVisible(true);
|
||||
grp.set('indeterminate', false);
|
||||
} else if (descendantVisibility.every(function (v) {
|
||||
return v === false;
|
||||
})) {
|
||||
grp.setVisible(false);
|
||||
grp.set('indeterminate', false);
|
||||
} else {
|
||||
grp.setVisible(true);
|
||||
grp.set('indeterminate', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'setChildVisibility',
|
||||
value: function setChildVisibility(map) {
|
||||
// console.log('setChildVisibility');
|
||||
var groups = LayerSwitcher.getGroupsAndLayers(map, function (l) {
|
||||
return l instanceof LayerGroup && !l.get('combine') && !LayerSwitcher.isBaseGroup(l);
|
||||
});
|
||||
groups.forEach(function (grp) {
|
||||
var group = grp;
|
||||
// console.log(group.get('title'));
|
||||
var groupVisible = group.getVisible();
|
||||
var groupIndeterminate = group.get('indeterminate');
|
||||
group.getLayers().getArray().forEach(function (l) {
|
||||
l.set('indeterminate', false);
|
||||
if ((!groupVisible || groupIndeterminate) && l.getVisible()) {
|
||||
l.set('indeterminate', true);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Ensure only the top-most base layer is visible if more than one is visible.
|
||||
* @param map The map instance.
|
||||
* @param groupSelectStyle
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'ensureTopVisibleBaseLayerShown',
|
||||
value: function ensureTopVisibleBaseLayerShown(map, groupSelectStyle) {
|
||||
var lastVisibleBaseLyr = void 0;
|
||||
LayerSwitcher.forEachRecursive(map, function (lyr, _idx, _arr) {
|
||||
if (lyr.get('type') === 'base' && lyr.getVisible()) {
|
||||
lastVisibleBaseLyr = lyr;
|
||||
}
|
||||
});
|
||||
if (lastVisibleBaseLyr) LayerSwitcher.setVisible_(map, lastVisibleBaseLyr, true, groupSelectStyle);
|
||||
}
|
||||
/**
|
||||
* **_[static]_** - Get an Array of all layers and groups displayed by the LayerSwitcher (has a `'title'` property)
|
||||
* contained by the specified map or layer group; optionally filtering via `filterFn`
|
||||
* @param grp The map or layer group for which layers are found.
|
||||
* @param filterFn Optional function used to filter the returned layers
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'getGroupsAndLayers',
|
||||
value: function getGroupsAndLayers(grp, filterFn) {
|
||||
var layers = [];
|
||||
filterFn = filterFn || function (_lyr, _idx, _arr) {
|
||||
return true;
|
||||
};
|
||||
LayerSwitcher.forEachRecursive(grp, function (lyr, idx, arr) {
|
||||
if (lyr.get('title')) {
|
||||
if (filterFn(lyr, idx, arr)) {
|
||||
layers.push(lyr);
|
||||
}
|
||||
}
|
||||
});
|
||||
return layers;
|
||||
}
|
||||
/**
|
||||
* Toggle the visible state of a layer.
|
||||
* Takes care of hiding other layers in the same exclusive group if the layer
|
||||
* is toggle to visible.
|
||||
* @protected
|
||||
* @param map The map instance.
|
||||
* @param lyr layer whose visibility will be toggled.
|
||||
* @param visible Set whether the layer is shown
|
||||
* @param groupSelectStyle
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'setVisible_',
|
||||
value: function setVisible_(map, lyr, visible, groupSelectStyle) {
|
||||
// console.log(lyr.get('title'), visible, groupSelectStyle);
|
||||
lyr.setVisible(visible);
|
||||
if (visible && lyr.get('type') === 'base') {
|
||||
// Hide all other base layers regardless of grouping
|
||||
LayerSwitcher.forEachRecursive(map, function (l, _idx, _arr) {
|
||||
if (l != lyr && l.get('type') === 'base') {
|
||||
l.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (lyr instanceof LayerGroup && !lyr.get('combine') && groupSelectStyle === 'children') {
|
||||
lyr.getLayers().forEach(function (l) {
|
||||
LayerSwitcher.setVisible_(map, l, lyr.getVisible(), groupSelectStyle);
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Render all layers that are children of a group.
|
||||
* @param map The map instance.
|
||||
* @param lyr Layer to be rendered (should have a title property).
|
||||
* @param idx Position in parent group list.
|
||||
* @param options Options for groups and layers
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'renderLayer_',
|
||||
value: function renderLayer_(map, lyr, idx, options, render) {
|
||||
var li = document.createElement('li');
|
||||
var lyrTitle = lyr.get('title');
|
||||
var checkboxId = LayerSwitcher.uuid();
|
||||
var label = document.createElement('label');
|
||||
if (lyr instanceof LayerGroup && !lyr.get('combine')) {
|
||||
var isBaseGroup = LayerSwitcher.isBaseGroup(lyr);
|
||||
li.classList.add('group');
|
||||
if (isBaseGroup) {
|
||||
li.classList.add(CSS_PREFIX + 'base-group');
|
||||
}
|
||||
// Group folding
|
||||
if (lyr.get('fold')) {
|
||||
li.classList.add(CSS_PREFIX + 'fold');
|
||||
li.classList.add(CSS_PREFIX + lyr.get('fold'));
|
||||
var btn = document.createElement('button');
|
||||
btn.onclick = function (e) {
|
||||
var evt = e || window.event;
|
||||
LayerSwitcher.toggleFold_(lyr, li);
|
||||
evt.preventDefault();
|
||||
};
|
||||
li.appendChild(btn);
|
||||
}
|
||||
if (!isBaseGroup && options.groupSelectStyle != 'none') {
|
||||
var input = document.createElement('input');
|
||||
input.type = 'checkbox';
|
||||
input.id = checkboxId;
|
||||
input.checked = lyr.getVisible();
|
||||
input.indeterminate = lyr.get('indeterminate');
|
||||
input.onchange = function (e) {
|
||||
var target = e.target;
|
||||
LayerSwitcher.setVisible_(map, lyr, target.checked, options.groupSelectStyle);
|
||||
render(lyr);
|
||||
};
|
||||
li.appendChild(input);
|
||||
label.htmlFor = checkboxId;
|
||||
}
|
||||
label.innerHTML = lyrTitle;
|
||||
li.appendChild(label);
|
||||
var ul = document.createElement('ul');
|
||||
li.appendChild(ul);
|
||||
LayerSwitcher.renderLayers_(map, lyr, ul, options, render);
|
||||
} else {
|
||||
li.className = 'layer';
|
||||
var _input = document.createElement('input');
|
||||
if (lyr.get('type') === 'base') {
|
||||
_input.type = 'radio';
|
||||
_input.name = 'base';
|
||||
} else {
|
||||
_input.type = 'checkbox';
|
||||
}
|
||||
_input.id = checkboxId;
|
||||
_input.checked = lyr.get('visible');
|
||||
_input.indeterminate = lyr.get('indeterminate');
|
||||
_input.onchange = function (e) {
|
||||
var target = e.target;
|
||||
LayerSwitcher.setVisible_(map, lyr, target.checked, options.groupSelectStyle);
|
||||
render(lyr);
|
||||
};
|
||||
li.appendChild(_input);
|
||||
label.htmlFor = checkboxId;
|
||||
label.innerHTML = lyrTitle;
|
||||
var rsl = map.getView().getResolution();
|
||||
if (rsl > lyr.getMaxResolution() || rsl < lyr.getMinResolution()) {
|
||||
label.className += ' disabled';
|
||||
}
|
||||
li.appendChild(label);
|
||||
}
|
||||
return li;
|
||||
}
|
||||
/**
|
||||
* Render all layers that are children of a group.
|
||||
* @param map The map instance.
|
||||
* @param lyr Group layer whose children will be rendered.
|
||||
* @param elm DOM element that children will be appended to.
|
||||
* @param options Options for groups and layers
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'renderLayers_',
|
||||
value: function renderLayers_(map, lyr, elm, options, render) {
|
||||
var lyrs = lyr.getLayers().getArray().slice();
|
||||
if (options.reverse) lyrs = lyrs.reverse();
|
||||
for (var i = 0, l; i < lyrs.length; i++) {
|
||||
l = lyrs[i];
|
||||
if (l.get('title')) {
|
||||
elm.appendChild(LayerSwitcher.renderLayer_(map, l, i, options, render));
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* **_[static]_** - Call the supplied function for each layer in the passed layer group
|
||||
* recursing nested groups.
|
||||
* @param lyr The layer group to start iterating from.
|
||||
* @param fn Callback which will be called for each layer
|
||||
* found under `lyr`.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'forEachRecursive',
|
||||
value: function forEachRecursive(lyr, fn) {
|
||||
lyr.getLayers().forEach(function (lyr, idx, a) {
|
||||
fn(lyr, idx, a);
|
||||
if (lyr instanceof LayerGroup) {
|
||||
LayerSwitcher.forEachRecursive(lyr, fn);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* **_[static]_** - Generate a UUID
|
||||
* Adapted from http://stackoverflow.com/a/2117523/526860
|
||||
* @returns {String} UUID
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'uuid',
|
||||
value: function uuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0,
|
||||
v = c == 'x' ? r : r & 0x3 | 0x8;
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Apply workaround to enable scrolling of overflowing content within an
|
||||
* element. Adapted from https://gist.github.com/chrismbarr/4107472
|
||||
* @param elm Element on which to enable touch scrolling
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'enableTouchScroll_',
|
||||
value: function enableTouchScroll_(elm) {
|
||||
if (LayerSwitcher.isTouchDevice_()) {
|
||||
var scrollStartPos = 0;
|
||||
elm.addEventListener('touchstart', function (event) {
|
||||
scrollStartPos = this.scrollTop + event.touches[0].pageY;
|
||||
}, false);
|
||||
elm.addEventListener('touchmove', function (event) {
|
||||
this.scrollTop = scrollStartPos - event.touches[0].pageY;
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Determine if the current browser supports touch events. Adapted from
|
||||
* https://gist.github.com/chrismbarr/4107472
|
||||
* @returns {Boolean} True if client can have 'TouchEvent' event
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'isTouchDevice_',
|
||||
value: function isTouchDevice_() {
|
||||
try {
|
||||
document.createEvent('TouchEvent');
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fold/unfold layer group
|
||||
* @param lyr Layer group to fold/unfold
|
||||
* @param li List item containing layer group
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'toggleFold_',
|
||||
value: function toggleFold_(lyr, li) {
|
||||
li.classList.remove(CSS_PREFIX + lyr.get('fold'));
|
||||
lyr.set('fold', lyr.get('fold') === 'open' ? 'close' : 'open');
|
||||
li.classList.add(CSS_PREFIX + lyr.get('fold'));
|
||||
}
|
||||
/**
|
||||
* If a valid groupSelectStyle value is not provided then return the default
|
||||
* @param groupSelectStyle The string to check for validity
|
||||
* @returns The value groupSelectStyle, if valid, the default otherwise
|
||||
* @protected
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: 'getGroupSelectStyle',
|
||||
value: function getGroupSelectStyle(groupSelectStyle) {
|
||||
return ['none', 'children', 'group'].indexOf(groupSelectStyle) >= 0 ? groupSelectStyle : 'children';
|
||||
}
|
||||
}]);
|
||||
return LayerSwitcher;
|
||||
}(Control);
|
||||
if (window['ol'] && window['ol']['control']) {
|
||||
window['ol']['control']['LayerSwitcher'] = LayerSwitcher;
|
||||
}
|
||||
|
||||
return LayerSwitcher;
|
||||
|
||||
})));
|
8
public/libs/openlayers/plugins/ol-layerswitcher/3.8.3/ol-layerswitcher.min.js
vendored
Normal file
8
public/libs/openlayers/plugins/ol-layerswitcher/3.8.3/ol-layerswitcher.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
29217
public/libs/openlayers/plugins/ol-mapbox-style/2.11.2-4/olms-debug.js
Normal file
29217
public/libs/openlayers/plugins/ol-mapbox-style/2.11.2-4/olms-debug.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user