Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

marker cluster sumatory of markers label #1

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
15 changes: 13 additions & 2 deletions www/MarkerCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -955,13 +955,24 @@ Object.defineProperty(MarkerCluster.prototype, '_redraw', {
}

unionedMarkers.forEach(function (cluster) {
var countCluster = 0;
cluster._markerArray.forEach(function (marker) {
var data = marker.get('data');
if (data && data.data && data.data.operative == 'ECHARGE') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Le pondria algo mas generico. Algo como

if (data && data.data && data.data.sumLabel) {
countCluster += data.data.label;
} else {
countCluster += 1;
}

Al meter el else ya no te hace falta el if de la linea 966

countCluster = countCluster + data.data.label
}
});

if (countCluster == 0) {
countCluster = cluster.getItemLength();
}

var icon = self.getClusterIcon(cluster),
clusterOpts = {
'count': cluster.getItemLength(),
'count': countCluster,
'position': cluster.getBounds().getCenter(),
'__pgmId': cluster.getId()
};
};

if (self.debug) {
clusterOpts.geocell = cluster.geocell;
Expand Down