[OpenLayers-Users] Reusing defined style

Bart van den Eijnden bartvde at opengeo.org
Tue Nov 27 07:09:36 PST 2012


1. don't apply defaults on OpenLayers.Feature.Vector.style["select"] but on your parsed style object from the SLD.
2. try wfsLayer.features[0].style.fillColor (not sure if it will work but report back if it doesn't)

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



On Nov 27, 2012, at 7:57 AM, Paul Meems <bontepaarden at gmail.com> wrote:

> I have two related questions.
> 
> I have a Vector layer with a few polygon features.
> 
> I assign some coloring to the polygons using a SLD file (using OpenLayers.Format.SLD().read())
> This works fine.
> When I select a feature I want to change the color of the outline but not the fill color.
> I'm using this piece to define the select style:
>     styleMap: new OpenLayers.StyleMap({ 
>       "select": new OpenLayers.Style(OpenLayers.Util.applyDefaults({
>         strokeColor: "gray",
>         graphicName: "square"
>       }, OpenLayers.Feature.Vector.style["select"]))
>     })
> 
> The above code will fill my feature with blue, but I want to retain the original color.
> Q1: How do I do that?
> 
> I'm also showing the data of the features in a table. I want to give each row of the table a background color that corresponds with the feature.
> I was looking for something like this:
> wfsLayer.features[0].FillColor
> but that is not working. 
> Q2: How can I get the fill color of a feature?
> 
> Thanks,
> 
> Paul
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121127/b0378b9b/attachment-0001.html>


More information about the Users mailing list