"users should be able to customize the select style per feature": Created a !StyleMap class which stores all styles that are needed for a layer. Controls that need to render features differently can now just give a render intent (e.g. "default", "select" or "temporary") to the layer's drawFeature method, instead of having extra style informations like Control.!SelectFeature.selectStyle. Existing application that set layer.style or feature.style are still supported, but both of these style properties are now null by default. r=crschmidt,elemoine,tschaub (closes #1120)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@6240 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2008-02-12 23:05:47 +00:00
parent dd1f4d1fa9
commit c5dd8ada2c
19 changed files with 257 additions and 142 deletions
+6 -2
View File
@@ -31,6 +31,9 @@
// the thumbail attribute of the rss item
style = new OpenLayers.Style({externalGraphic: "${thumbnail}"});
// make the thumbnails larger when we select them
selectStyle = new OpenLayers.Style({pointRadius: 35});
// create a rule with a point symbolizer that will make the thumbnail
// larger if the title of the rss item conatins "powder"
var rule = new OpenLayers.Rule.Comparison({
@@ -47,12 +50,13 @@
style.addRules([rule, elseRule]);
markerLayer = new OpenLayers.Layer.Vector("", {style: style});
markerLayer = new OpenLayers.Layer.Vector("", {styleMap: new OpenLayers.StyleMap({
"default": style,
"select": selectStyle})});
map.addLayer(markerLayer);
// control that will show a popup when clicking on a thumbnail
var popupControl = new OpenLayers.Control.SelectFeature(markerLayer, {
selectStyle: style,
onSelect: function(feature) {
var pos = feature.geometry;
if (popup) {