diff --git a/frontend/src/assets/svgs/legend/maps.marker-alt-1.svg b/frontend/src/assets/svgs/legend/maps.marker-alt-1.svg new file mode 100644 index 0000000..86c86f4 --- /dev/null +++ b/frontend/src/assets/svgs/legend/maps.marker-alt-1.svg @@ -0,0 +1,11 @@ + diff --git a/frontend/src/assets/svgs/legend/maps.marker-alt.svg b/frontend/src/assets/svgs/legend/maps.marker-alt.svg new file mode 100644 index 0000000..0b49a12 --- /dev/null +++ b/frontend/src/assets/svgs/legend/maps.marker-alt.svg @@ -0,0 +1,11 @@ + diff --git a/frontend/src/assets/svgs/legend/maps.marker.cluster-large-alt.svg b/frontend/src/assets/svgs/legend/maps.marker.cluster-large-alt.svg new file mode 100644 index 0000000..5eed779 --- /dev/null +++ b/frontend/src/assets/svgs/legend/maps.marker.cluster-large-alt.svg @@ -0,0 +1,5 @@ + diff --git a/frontend/src/assets/svgs/legend/maps.marker.cluster-medium-alt.svg b/frontend/src/assets/svgs/legend/maps.marker.cluster-medium-alt.svg new file mode 100644 index 0000000..9aa81b8 --- /dev/null +++ b/frontend/src/assets/svgs/legend/maps.marker.cluster-medium-alt.svg @@ -0,0 +1,5 @@ + diff --git a/frontend/src/assets/svgs/legend/maps.marker.cluster-small-alt.svg b/frontend/src/assets/svgs/legend/maps.marker.cluster-small-alt.svg new file mode 100644 index 0000000..9effd07 --- /dev/null +++ b/frontend/src/assets/svgs/legend/maps.marker.cluster-small-alt.svg @@ -0,0 +1,5 @@ + diff --git a/frontend/src/components/map/LeafletMap.vue b/frontend/src/components/map/LeafletMap.vue index 543868f..4e15855 100644 --- a/frontend/src/components/map/LeafletMap.vue +++ b/frontend/src/components/map/LeafletMap.vue @@ -22,6 +22,9 @@ import clusterSmall from "../../assets/svgs/legend/maps.marker.cluster-small.svg" import clusterMedium from "../../assets/svgs/legend/maps.marker.cluster-medium.svg" import clusterLarge from "../../assets/svgs/legend/maps.marker.cluster-large.svg" +import clusterSmallAlt from "../../assets/svgs/legend/maps.marker.cluster-small-alt.svg" +import clusterMediumAlt from "../../assets/svgs/legend/maps.marker.cluster-medium-alt.svg" +import clusterLargeAlt from "../../assets/svgs/legend/maps.marker.cluster-large-alt.svg" import "leaflet/dist/leaflet.css" import L from 'leaflet'; import "leaflet.markercluster/dist/MarkerCluster.css" @@ -34,7 +37,7 @@ import Stomp from "webstomp-client"; import KnowledgeGraph from "@/components/graph/KnowledgeGraph.vue"; import MapButtons from "@/components/modal/MapButtons.vue"; -const iconCreateFunction = (cluster) => { +const iconCreateFunction = (cluster, name) => { const count = cluster.getChildCount(); let clusterSize; let iconAnchor; @@ -42,8 +45,8 @@ const iconCreateFunction = (cluster) => { if (count < 21) { clusterSize = "small"; - iconAnchor = [23, 23] - iconUrl = clusterSmall + iconAnchor = [23, 23]; + iconUrl = name === "bluebikes" ? clusterSmall : clusterSmallAlt; } else if (count < 61) { clusterSize = "medium"; iconAnchor = [33, 33]; @@ -78,7 +81,37 @@ export default { const time = ref(new Date().getTime()) const timePeriod = ref("PT10M") const layersToShow = ref(new Map(layerNames.map(name => [name, true]))); - const layers = new Map(layerNames.map(name => [name, L.markerClusterGroup({iconCreateFunction})])) + const layers = new Map(layerNames.map(name => [name, L.markerClusterGroup( + { + iconCreateFunction: function (cluster) { + const count = cluster.getChildCount(); + let clusterSize; + let iconAnchor; + let iconUrl; + + if (count < 21) { + clusterSize = "small"; + iconAnchor = [23, 23]; + iconUrl = name === "bluebikes" ? clusterSmall : clusterSmallAlt + } else if (count < 61) { + clusterSize = "medium"; + iconAnchor = [33, 33]; + iconUrl = name === "bluebikes" ? clusterMedium : clusterMediumAlt + } else { + clusterSize = "large"; + iconAnchor = [40.5, 40.5]; + iconUrl = name === "bluebikes" ? clusterLarge : clusterLargeAlt + } + + const className = `marker-cluster-${clusterSize}`; + + return L.divIcon({ + html: `