[OpenLayers-Users] Different renderIntents when features have different styles?

Andreas Hocevar ahocevar at opengeo.org
Fri Apr 29 04:31:34 EDT 2011


Hi,

If feature.style is set, it will always take precedence over layer
styles. To achieve what you want, create a stylemap with a "default"
and a "select" renderIntent. See
http://openlayers.org/dev/examples/styles-rotation.html for an example
that does this.

Andreas.

On Wed, Apr 27, 2011 at 6:37 PM, Jeff Dege <jeff.dege at korterra.com> wrote:
> I have a map with a vector layer.
>
>
>
> On that layer I am drawing a number of features.
>
>
>
> I want those features to have different appearances, so I am setting the
> style attribute on each.
>
>
>
> I have a SelectControl, with which I am selecting features on the map.  I
> want the selected features to have a different appearance than the
> unselected features.  But I’m having problems with this.
>
>
>
> Inside Vector.drawFeature(), regardless of what renderIntent I have set on
> the feature, or what my layer’s styleMap may have, if the feature has a
> style assigned, it looks like it’s that style that is used to render the
> feature, no matter what.
>
>
>
> I can set a StyleMap on the vector layer, so I can have selected features
> drawn differently than unselected features, but this is ignored if I set a
> style on the feature, itself.
>
>
>
> Any ideas on how I can get different features to draw on the same layer,
> with different appearances, and still have their appearances change when the
> user selects one?
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list