[OpenLayers-Users] Visibility of features in vector layer

Matthew Doyle M.Doyle at bom.gov.au
Wed Jul 8 03:46:31 EDT 2009


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?

Many thanks in advance,
Matt

PS. I have trawled through the API/code/usergroups to no avail so far, yet
it feels like the solution may be staring me right in the face, yet i can't
quite see it :-) 



Heidtmare wrote:
> 
> I'm assuming that when you tell it to redraw you pass it params for that
> redraw but those params are for that redraw only.
> When you change your zoom lvl OL is redrawing the feature with its
> origional style settings.
> 
> Try changing the features render intent(style setting) prior to redraw.
> 
> var featureStyles = new OpenLayers.StyleMap({
> 	"default": OpenLayers.Feature.Vector.style["default"],
> 	"select": OpenLayers.Feature.Vector.style.select,
> 	"hidden":{
> 		fillOpacity: 0.0,		
> 		strokeOpacity: 0.0
> 	}
> });
> 
> //then later you can
> feature.renderIntent = 'hidden';
> _featureLayer.drawFeature(feature);
> 
> 
> 
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of djud
> Sent: Tuesday, May 05, 2009 9:16 AM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Visibility of features in vector layer
> 
> 
> Thanks Heidtmare,
> 
> I will try this but I'm still concerned as to why drawing the feature
> with
> "display: none" doesn't work at all zoom levels.
> 
> Dave
> 
> 
> --
> View this message in context:
> http://n2.nabble.com/Visibility-of-features-in-vector-layer-tp2792029p27
> 94303.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Visibility-of-features-in-vector-layer-tp2792029p3224229.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list