[OpenLayers-Users] Visibility of features in vector layer
Paul Spencer
pagameba at gmail.com
Wed Jul 8 09:35:56 EDT 2009
Eric,
On 8-Jul-09, at 9:25 AM, Eric Lemoine wrote:
> On Wednesday, July 8, 2009, Matthew Doyle <M.Doyle at bom.gov.au> wrote:
>>
>> Hello all,
>>
>> Sorry for resurrecting this topic, but i am having trouble getting my
>> features to "remember" which StylemMap they have been changed to,
>> using the
>> renderIntent.
>>
>> After following Heidtmare's suggestions below, my WFS layer is now
>> showing
>> and hiding features on the fly using the renderIntent and then
>> calling
>> drawFeature, as follows:
>>
>> for(var i = 0; i < WFSLayer.features.length; i++) {
>> WFSLayer.features[i].renderIntent = "hidden";
>> WFSLayer.drawFeature(WFSLayer.features[i]);
>> }
>>
>> This works great, right up until i zoom the map or move to a
>> different
>> extent. Each feature goes back to their "default" renderIntent and
>> the
>> features are shown once again.
>>
>> How can i force a permanent change for each feature so that when
>> the user
>> zooms it remembers what changes have just been made?
>
> Hi
>
> You can use the "style" property. E.g.
>
> feature.style = OpenLayers.Feature.Vector.style["delete"];
why does the renderIntent approach not work? It does work for
controls like SelectFeature. From what I see in the code, the
renderIntent of the feature is changed in createSymbolizer called from
drawFeature, which should use the renderIntent of the feature (in this
case, 'hidden'). Unless the style map doesn't contain a 'hidden'
style, in which case it would default back to ... um ... 'default' :)
Paul
More information about the Users
mailing list