[OpenLayers-Users] SelectFeatureControl invalid when set style to vector?

shane_china xiaying4415139 at 163.com
Wed Apr 29 11:38:20 EDT 2009




Kris Geusebroek wrote:
> 
> Hi Shane,
> 
> You need to set a select style also, so extend
> Feature.Vector.style['select'] and add that to the layerstyle
> 
> Cheers Kris
> 
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of shane_china
> Sent: Wednesday, April 29, 2009 2:38 PM
> To: users at openlayers.org
> Subject: Re: [OpenLayers-Users] SelectFeatureControl invalid when set
> style to vector?
> 
> 
> here is the detail code
> 
> When I construct vecotr like this:  var vector = new
> OpenLayers.Feature.Vector(point);
> select feature control works well. When the vector was selected, color
> changed.
> 
> But when I construct vector like this :
> var layer_style = OpenLayers.Util.extend({},
> OpenLayers.Feature.Vector.style['default']);
> layer_style.strokeColor = "blue";
> layer_style.fillColor = "blue";
> var vector = new OpenLayers.Feature.Vector(point, null, layer_style);
> Then the vector was selected, the color didn't change althought the
> vector
> was actually selected.
> I don't know why, is there any other style I should set?
> 
> -- 
> View this message in context:
> http://n2.nabble.com/SelectFeatureControl-invalid-when-set-style-to-vect
> or--tp2739954p2740297.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
> 
> 




var layer_style = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']); 
var layer_style = OpenLayers.Uitl.extend(layer_style,
OpenLayers.Feature.Vector.style['select']);
layer_style.strokeColor = "blue"; 
layer_style.fillColor = "blue"; 
var vector = new OpenLayers.Feature.Vector(point, null, layer_style);

I add the second line to my code. But it also doesn't work. Could you tell
me more exactly or some simple code? Add style to layer style? But layer
style should already have some select style, I thought. Why should I add
another? Why default one doesn't work? Thank you.

-- 
View this message in context: http://n2.nabble.com/SelectFeatureControl-invalid-when-set-style-to-vector--tp2739954p2741324.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list