From aa07df4442bf3bd7cff2703607d22d0f72b7c655 Mon Sep 17 00:00:00 2001 From: arno Date: Tue, 6 Oct 2009 00:34:59 +0200 Subject: [PATCH 1/1] show number of features on cluster markers --- js/syp.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/syp.js b/js/syp.js index 8c2e5bc..9bccba6 100644 --- a/js/syp.js +++ b/js/syp.js @@ -127,13 +127,23 @@ var SYP = { createDataLayer: function(map) { var defaultStyle = new OpenLayers.Style({ externalGraphic: this.Markers.ICON, - graphicHeight: "${height}" + graphicHeight: "${height}", + label: "${label}", + fontColor: "white", + fontWeight: "bold" }, { context: { height: function(feature) { var defaultHeight = SYP.Markers.HEIGHT || 32; var increase = 4 * (feature.attributes.count - 1); return Math.min(defaultHeight + increase, 50); + }, + label: function(feature) { + var renderer = feature.layer.renderer; + if (renderer.CLASS_NAME == "OpenLayers.Renderer.Canvas") { + return ""; // canvas backend cannot draw text above an external Image + } + return (feature.attributes.count > 1) ? feature.attributes.count: ""; } } }); -- 2.39.5