[Users] VectorLegend exception after removing layer

24 views
Skip to first unread message

frank

unread,
Mar 5, 2012, 11:12:10 AM3/5/12
to us...@geoext.org
Dear list

I'm using a self-made function for clearing all layers in my map and adding a stored set of predefined layers.
In this routine i call map.removeLayer() for all non-base layers, before I add the new layer set.

However, after having removed the layers I get an exception from GeoExt.VectorLegend:
  1. Uncaught TypeError: Cannot read property 'map' of null
    1. GeoExt.VectorLegend.Ext.extend.onMapZoomVectorLegend.js:261
    2. OpenLayers.Events.OpenLayers.Class.triggerEventEvents.js:798
    3. OpenLayers.Map.OpenLayers.Class.moveToMap.js:1890
    4. OpenLayers.Map.OpenLayers.Class.setCenterMap.js:1662
    5. OpenLayers.Control.Navigation.OpenLayers.Class.wheelChangeNavigation.js:279
    6. OpenLayers.Control.Navigation.OpenLayers.Class.wheelDownNavigation.js:303
    7. OpenLayers.Handler.OpenLayers.Class.callbackHandler.js:205
    8. OpenLayers.Handler.MouseWheel.OpenLayers.Class.wheelZoomMouseWheel.js:229
    9. OpenLayers.Handler.MouseWheel.OpenLayers.Class.onWheelEventMouseWheel.js:191
    10. (anonymous function)

To the inner level this maps down to the function
    onMapZoom: function() {
            this.setCurrentScaleDenominator(
                this.layer.map.getScale()
            );
    },

And by inspection this.layer is undefined.

How can this be?
Removing the layer with any combination of (one or both)
    map.removeLayer(layer) and
    layer.destroy()
gives the same result.

best regards,
Frank



Bart van den Eijnden

unread,
Mar 5, 2012, 1:14:57 PM3/5/12
to frank, us...@geoext.org
Hi,

what version of GeoExt are you using? Please upgrade to 1.1 if you're not running it already.

This was fixed with: http://trac.geoext.org/ticket/451

Best regards,
Bart

-- 
Bart van den Eijnden
OpenGeo - http://opengeo.org
Expert service straight from the developers.



_______________________________________________
Users mailing list
Us...@geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Andreas Hocevar

unread,
Mar 5, 2012, 6:01:14 PM3/5/12
to frank, us...@geoext.org
Hi,

if your legend is auto-created from a MapPanel's layers store, this
should not happen. If you build your legend manually, you have to
delete a layer's legend before you destroy the layer.

Andreas.

> _______________________________________________
> Users mailing list
> Us...@geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>

--
Andreas Hocevar
OpenGeo - http://opengeo.org/


Expert service straight from the developers.

Reply all
Reply to author
Forward
0 new messages