AW: [OpenLayers-Users] Feature "style" and layer "styleMap"

gbrun gbrun at myopera.com
Tue Aug 30 13:07:29 EDT 2011


Thanks for this reply! I tried to add a "select" style to the feature but  
it didn't work. I tried many ways, but unfortunately, the only way to  
style a feature is to put directly the style properties in the  
feature.style property like this (so without "select", or "default"):

feature.style = {fillColor: #FFFFFF,
		strokeColor: #222222,
		..................
}

But I didn't try exactly what you said, with the  
ctrlSelectFeature.selectStyle property. So I will try this tomorrow and  
come back to this thread to say if it works! This issue is not so  
important, it's only unpleasant for the user because once he has changed  
the feature color, he can't see if the feature is well selected when he is  
selecting it...

Geoffrey


Le Tue, 30 Aug 2011 18:53:08 +0200, Arnd Wippermann  
<arnd.wippermann at web.de> a écrit:

> Hi,
>
> I'm not sure, if it's possible to add a default and select style to a
> feature.
> But you can force the selectControl to use a select style of your choice.
>
> var selectStyle = OpenLayers.Util.extend({},
> OpenLayers.Feature.Vector.style['select']);
> ctrlSelectFeature.selectStyle=selectStyle;
>
>
> Arnd
>
> -----Ursprüngliche Nachricht-----
> Von: openlayers-users-bounces at lists.osgeo.org
> [mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von gbrun
> Gesendet: Dienstag, 30. August 2011 10:23
> An: openlayers-users at lists.osgeo.org
> Betreff: [OpenLayers-Users] Feature "style" and layer "styleMap"
>
> Hi everybody!
>
> I've got a question about styles capabilities. I have a layer on which  
> users
> can draw features. At this layers, I assigned a "styleMap" property.
>
> When a user has finished drawing a polygon on this layer for example, he  
> can
> select this one and change its color. For this, I use the "style"
> property of the drawn feature. It works fine, but then, the "styleMap"
> property of the layer doesn't apply at this feature anymore. This is a
> problem, because the "styleMap" property defines a "select" style: this  
> one
> doesn't concern the feature which had its color changed anymore. So the  
> user
> can't see if he selected the feature or not! It seems that, if there is a
> style applied to a feature, the styleMap isn't taken into account for  
> this
> feature anymore.
>
> Does anyone know if there are some conflict between feature "style" and
> layer "styleMap"?
>
> Geoffrey
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>


-- 
-- 
Geoffrey BRUN

Étudiant en master SIGMA
Stagiaire au PNR du Haut-Languedoc

Hameau de Brassac
Saint-Pons de Thomières
+33 (0) 6 77 74 44 16


More information about the Users mailing list