[OpenLayers-Users] Limit total Vector Layer points to be drawn
Andreas Hocevar
ahocevar at opengeo.org
Mon Jul 12 09:48:28 EDT 2010
Hi,
looks like your OpenLayers version is too old. This was fixed after the 2.9.1 release (http://trac.openlayers.org/changeset/10362), so you have to use a current development version.
Regards,
Andreas.
On Jul 12, 2010, at 15:40 , giraam wrote:
>
> Hi people,
>
> I'm trying to limit the total Vector Layer's point to be drawn.. For
> example, after one point has been drawn prevent new points to be added..
>
> I tried registering beforefeatureadded event as the definition for this
> event says:
>
> Triggered before a feature is added. Listeners will receive an object with
> a feature property referencing the feature to be added. To stop the feature
> from being added, a listener should return false.
>
> My code:
>
> vectorLayer.events.register('beforefeatureadded', this,
> function(feature){
> if(vectorLayer.features.length = 1){
> alert("false "+vectorLayer.features.length);
> return false;
> }else{
> alert("true "+vectorLayer.features.length);
> return true;
> }
> });
>
> But even if I return false, the feature is added to the layer! :S
>
> Any suggestion, please?
>
> Thanks in advance!
>
> Gilberto Ramos
>
> -----
> just another web developer
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Limit-total-Vector-Layer-points-to-be-drawn-tp5282918p5282918.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
--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.
More information about the Users
mailing list