1

With DrawFeature I'm putting new features to my map. With the hover option of SelectFeature it is possible to get feature information when hovering over it. Now I have the problem of disappearing features on the map when hovering over newly added (=temporary) features?

Any solutions how to style the features so that they stay on the map during storage/editing process?

Here is the relevant code I use styling the point features:

var defaultPoint = new OpenLayers.Style({ label: "D", pointRadius: 8, fillColor: "red", fillOpacity: 0.7, strokeColor: "black", strokeWidth: 3});
var selectPoint  = new OpenLayers.Style({ label: "S",pointRadius: 8, fillColor: "blue", fillOpacity: 0.7, strokeColor: "black", strokeWidth: 3 });
var tempPoint    = new OpenLayers.Style({ label: "T",pointRadius: 8, fillColor: "green",    fillOpacity: 0.7, strokeColor: "black", strokeWidth: 3 }); 

var stylemapPoints = new OpenLayers.StyleMap({'default': defaultPoint, 'select' : selectPoint , 'temporary': tempPoint});

This is the code for the Hover control:

HoverSelectControl = new OpenLayers.Control.SelectFeature([layerName],  
                        { hover:true, 
                          highlightOnly:true, 
                          renderIntent: "select" 
                         }); 
HoverSelectControl.handlers.feature.stopDown = false;
map.addControl(HoverSelectControl);
HoverSelectControl.activate();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.