[OpenLayers-Users] Hide/Show a Vector Feature?

Andre Pereira de Matos andre.matos at co.sapo.pt
Mon Jan 12 09:12:44 EST 2009


Have you tried that? I used an icon in the feature and it worked...

I set the style in the feature of course:

this.feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(coords.lon, coords.lat), null,
                                                        {
                                                        externalGraphic: this.markerImage,
                                                        backgroundGraphic: this.markerShadow,
                                                        backgroundXOffset: this.iconAnchor.x,
                                                        backgroundYOffset: this.iconAnchor.y,
                                                        graphicZIndex: 10,
                                                        backgroundGraphicZIndex: 11,
                                                        pointRadius: this.markerRadius
                                                        });

And when I want to hide the feature I set the radius to zero.

Regards,
André Matos
http://mapas.sapo.pt

-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On Behalf Of Salvaro
Sent: segunda-feira, 12 de Janeiro de 2009 13:20
To: users at openlayers.org
Subject: Re: [OpenLayers-Users] Hide/Show a Vector Feature?


I'm using the vector feature with an icon (in the VectorStyle), so the radius
didn't work.
And set display=false or none only work if I delete the reference to the
icon.

Thanks.


André Matos wrote:
>
> You can try this one too
>
> feature.style.pointRadius = 0;
> feature.layer.drawFeature(feature);
>
> To show the feature again:
>
> feature.style.pointRadius = lastPointRadius;
> feature.layer.drawFeature(feature);
>
>
> Regards
> André Matos
> http://mapas.sapo.pt
>
>
>
> To
>
> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of Zac Spitzer
> Sent: segunda-feira, 12 de Janeiro de 2009 12:17
> To: Salvaro
> Cc: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Hide/Show a Vector Feature?
>
> try feature.style="";
>
> On Mon, Jan 12, 2009 at 10:46 PM, Salvaro <asufsc at gmail.com> wrote:
>>
>> Thanks.
>> But what you do to show after?
>>
>> Set display=false in the Style and redraw the Layer works and hide the
>> feature.
>> But when I try to set display=true and redraw didn't show the feature =/.
>>
>>
>> zspitzer wrote:
>>>
>>> setting feature.style="display:none;" and redrawing it works for me
>>>
>>> On Mon, Jan 12, 2009 at 9:43 PM, Salvaro <asufsc at gmail.com> wrote:
>>>>
>>>> Is possible hide a VectorFeature added in a Vector Layer?
>>>>
>>>> Thanks.
>>>> --
>>>> View this message in context:
>>>> http://n2.nabble.com/Hide-Show-a-Vector-Feature--tp2145088p2145088.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
>>>>
>>>
>>>
>>>
>>> --
>>> Zac Spitzer -
>>> http://zacster.blogspot.com
>>> +61 405 847 168
>>> _______________________________________________
>>> Users mailing list
>>> Users at openlayers.org
>>> http://openlayers.org/mailman/listinfo/users
>>>
>>>
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Hide-Show-a-Vector-Feature--tp2145088p2145259.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
>>
>
>
>
> --
> Zac Spitzer -
> http://zacster.blogspot.com
> +61 405 847 168
> _______________________________________________
> 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/Hide-Show-a-Vector-Feature--tp2145088p2145559.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


More information about the Users mailing list