My measuresControl were each added 2 twice in the map



steve.tout...@inspq.qc.ca@lists.osgeo.org 
Envoyé par : openlayers-users-boun...@lists.osgeo.org
2013-03-12 13:51

A
openlayers-users@lists.osgeo.org
cc

Objet
[OpenLayers-Users] Map.js - control destructor problem









Using OL 2.10, This code in maps.js has a strange behavior 
for (var i = this.controls.length - 1; i>=0; --i) { 
                this.controls[i].destroy(); 
            } 

Initially length=26. There is a problem when destroying controls[24]...it 
also destroys controls[23]. 
So on the next loop, i = length = 23 and controls[23] doesn't exist 
anymore. 

Why this.controls[i].destroy() would also destroy controls[i-1]? 

In this case control[24] and control[23] are OpenLayers.Control.Measure 

I've defined 2measure controls (linear and area) 
var oMeasrPolgnCtrl = new OpenLayers.Control.Measure ( 
OpenLayers.Handler.Polygon, oMeasrPolgnCtrlOptions ); 
var oMeasrPolgnCtrl = new OpenLayers.Control.Measure ( 
OpenLayers.Handler.Polygon, oMeasrPolgnCtrlOptions ); 
I don't know what to verify anymore... 
Thans for your help, 
Steve _______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to