support marker clusters
This commit is contained in:
@ -20,6 +20,9 @@
|
|||||||
<!-- leaflet map -->
|
<!-- leaflet map -->
|
||||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.3/dist/leaflet.css" integrity="sha256-kLaT2GOSpHechhsozzB+flnD+zUyjE2LlfWPgU04xyI=" crossorigin="" />
|
||||||
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
|
<script src="https://unpkg.com/leaflet@1.9.3/dist/leaflet.js" integrity="sha256-WBkoXOwTeyKclOHuWtc+i2uENFpDZ9YPdf5Hf+D7ewM=" crossorigin=""></script>
|
||||||
|
<script src="plugins/leaflet.markercluster/leaflet.markercluster.js"></script>
|
||||||
|
<link rel="stylesheet" href="plugins/leaflet.markercluster/MarkerCluster.css"/>
|
||||||
|
<link rel="stylesheet" href="plugins/leaflet.markercluster/MarkerCluster.Default.css"/>
|
||||||
|
|
||||||
<!-- moment -->
|
<!-- moment -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.1/moment.min.js"></script>
|
||||||
@ -882,6 +885,9 @@
|
|||||||
// create layer groups
|
// create layer groups
|
||||||
var nodesLayerGroup = new L.LayerGroup();
|
var nodesLayerGroup = new L.LayerGroup();
|
||||||
var neighboursLayerGroup = new L.LayerGroup();
|
var neighboursLayerGroup = new L.LayerGroup();
|
||||||
|
var nodesClusteredLayerGroup = L.markerClusterGroup({
|
||||||
|
showCoverageOnHover: false,
|
||||||
|
});
|
||||||
|
|
||||||
// create icons
|
// create icons
|
||||||
var iconOnline = L.divIcon({ className: 'icon-online'});
|
var iconOnline = L.divIcon({ className: 'icon-online'});
|
||||||
@ -898,11 +904,11 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
var baseLayers = {
|
var baseLayers = {
|
||||||
|
"Nodes (All)": nodesLayerGroup,
|
||||||
|
"Nodes (Clustered)": nodesClusteredLayerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
var overlays = {
|
var overlays = {
|
||||||
"Nodes": nodesLayerGroup,
|
|
||||||
"Neighbours": neighboursLayerGroup,
|
"Neighbours": neighboursLayerGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -910,7 +916,8 @@
|
|||||||
L.control.layers(baseLayers, overlays).addTo(map);
|
L.control.layers(baseLayers, overlays).addTo(map);
|
||||||
|
|
||||||
// add layers to map that should be enabled by default
|
// add layers to map that should be enabled by default
|
||||||
nodesLayerGroup.addTo(map);
|
// nodesLayerGroup.addTo(map);
|
||||||
|
nodesClusteredLayerGroup.addTo(map);
|
||||||
// neighboursLayerGroup.addTo(map);
|
// neighboursLayerGroup.addTo(map);
|
||||||
// legend.addTo(map);
|
// legend.addTo(map);
|
||||||
|
|
||||||
@ -1176,8 +1183,11 @@
|
|||||||
.on('click', function(event) {
|
.on('click', function(event) {
|
||||||
// close tooltip on click to prevent tooltip and popup showing at same time
|
// close tooltip on click to prevent tooltip and popup showing at same time
|
||||||
event.target.closeTooltip();
|
event.target.closeTooltip();
|
||||||
})
|
});
|
||||||
.addTo(nodesLayerGroup);
|
|
||||||
|
// add marker to node layer groups
|
||||||
|
marker.addTo(nodesLayerGroup);
|
||||||
|
nodesClusteredLayerGroup.addLayer(marker);
|
||||||
|
|
||||||
// show node info sidebar when clicking node marker
|
// show node info sidebar when clicking node marker
|
||||||
marker.on("click", function(event) {
|
marker.on("click", function(event) {
|
||||||
|
60
src/public/plugins/leaflet.markercluster/MarkerCluster.Default.css
Executable file
60
src/public/plugins/leaflet.markercluster/MarkerCluster.Default.css
Executable file
@ -0,0 +1,60 @@
|
|||||||
|
.marker-cluster-small {
|
||||||
|
background-color: rgba(181, 226, 140, 0.6);
|
||||||
|
}
|
||||||
|
.marker-cluster-small div {
|
||||||
|
background-color: rgba(110, 204, 57, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-cluster-medium {
|
||||||
|
background-color: rgba(241, 211, 87, 0.6);
|
||||||
|
}
|
||||||
|
.marker-cluster-medium div {
|
||||||
|
background-color: rgba(240, 194, 12, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-cluster-large {
|
||||||
|
background-color: rgba(253, 156, 115, 0.6);
|
||||||
|
}
|
||||||
|
.marker-cluster-large div {
|
||||||
|
background-color: rgba(241, 128, 23, 0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* IE 6-8 fallback colors */
|
||||||
|
.leaflet-oldie .marker-cluster-small {
|
||||||
|
background-color: rgb(181, 226, 140);
|
||||||
|
}
|
||||||
|
.leaflet-oldie .marker-cluster-small div {
|
||||||
|
background-color: rgb(110, 204, 57);
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-oldie .marker-cluster-medium {
|
||||||
|
background-color: rgb(241, 211, 87);
|
||||||
|
}
|
||||||
|
.leaflet-oldie .marker-cluster-medium div {
|
||||||
|
background-color: rgb(240, 194, 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-oldie .marker-cluster-large {
|
||||||
|
background-color: rgb(253, 156, 115);
|
||||||
|
}
|
||||||
|
.leaflet-oldie .marker-cluster-large div {
|
||||||
|
background-color: rgb(241, 128, 23);
|
||||||
|
}
|
||||||
|
|
||||||
|
.marker-cluster {
|
||||||
|
background-clip: padding-box;
|
||||||
|
border-radius: 20px;
|
||||||
|
}
|
||||||
|
.marker-cluster div {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
margin-left: 5px;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 15px;
|
||||||
|
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||||
|
}
|
||||||
|
.marker-cluster span {
|
||||||
|
line-height: 30px;
|
||||||
|
}
|
14
src/public/plugins/leaflet.markercluster/MarkerCluster.css
Executable file
14
src/public/plugins/leaflet.markercluster/MarkerCluster.css
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
|
||||||
|
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||||
|
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||||
|
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||||
|
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaflet-cluster-spider-leg {
|
||||||
|
/* stroke-dashoffset (duration and function) should match with leaflet-marker-icon transform in order to track it exactly */
|
||||||
|
-webkit-transition: -webkit-stroke-dashoffset 0.3s ease-out, -webkit-stroke-opacity 0.3s ease-in;
|
||||||
|
-moz-transition: -moz-stroke-dashoffset 0.3s ease-out, -moz-stroke-opacity 0.3s ease-in;
|
||||||
|
-o-transition: -o-stroke-dashoffset 0.3s ease-out, -o-stroke-opacity 0.3s ease-in;
|
||||||
|
transition: stroke-dashoffset 0.3s ease-out, stroke-opacity 0.3s ease-in;
|
||||||
|
}
|
2690
src/public/plugins/leaflet.markercluster/leaflet.markercluster-src.js
Executable file
2690
src/public/plugins/leaflet.markercluster/leaflet.markercluster-src.js
Executable file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
3
src/public/plugins/leaflet.markercluster/leaflet.markercluster.js
Executable file
3
src/public/plugins/leaflet.markercluster/leaflet.markercluster.js
Executable file
File diff suppressed because one or more lines are too long
1
src/public/plugins/leaflet.markercluster/leaflet.markercluster.js.map
Executable file
1
src/public/plugins/leaflet.markercluster/leaflet.markercluster.js.map
Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user