[OpenLayers-Users] Reusing defined style

Paul Meems bontepaarden at gmail.com
Tue Nov 27 05:57:56 PST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121127/a3f9cd46/attachment.html>


More information about the Users mailing list