<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>what version of GeoExt are you using? Please upgrade to 1.1 if you're not running it already.</div><div><br></div><div>This was fixed with: <a href="http://trac.geoext.org/ticket/451">http://trac.geoext.org/ticket/451</a></div><div><br></div><div>Best regards,</div><div>Bart</div><div><br></div><div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div>-- <br>Bart van den Eijnden<br>OpenGeo - <a href="http://opengeo.org/">http://opengeo.org</a><br>Expert service straight from the developers.</div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Mar 5, 2012, at 5:12 PM, frank wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<div bgcolor="#FFFFFF" text="#000000">
Dear list<br>
<br>
I'm using a self-made function for clearing all layers in my map and
adding a stored set of predefined layers.<br>
In this routine i call map.removeLayer() for all non-base layers,
before I add the new layer set.<br>
<br>
However, after having removed the layers I get an exception from
GeoExt.VectorLegend:<br>
<ol class="outline-disclosure" tabindex="0" style="box-sizing:
border-box; font-size: 12px; list-style-type: none;
-webkit-padding-start: 12px; margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; outline-style: none;
outline-width: initial; outline-color: initial; padding-left: 0px;
line-height: 12px; color: rgb(0, 0, 0); font-family: Consolas,
'Lucida Console', monospace; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; orphans: 2;
text-align: -webkit-auto; text-indent: 0px; text-transform: none;
white-space: normal; widows: 2; word-spacing: 0px;
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); ">
<li title="" class="parent expanded" style="box-sizing:
border-box; padding-top: 0px; padding-right: 0px;
padding-bottom: 0px; padding-left: 14px; margin-top: 1px;
margin-bottom: 1px; margin-left: -12px; word-wrap: break-word; "><span class="console-message-text source-code" style="box-sizing:
border-box; white-space: pre-wrap; font-family: Consolas,
'Lucida Console', monospace; font-size: 12px !important;
color: red !important; "><span style="box-sizing: border-box;
">Uncaught TypeError: Cannot read property 'map' of null</span></span></li>
<ol class="children expanded" style="box-sizing: border-box;
position: relative; padding-top: 0px !important; padding-right:
0px !important; padding-bottom: 0px !important; padding-left:
12px !important; margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; color: black; cursor:
default; min-width: 100%; list-style-type: none;
-webkit-padding-start: 12px; font-size: inherit; line-height:
12px; display: block; ">
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">GeoExt.VectorLegend.Ext.extend.onMapZoom</span><a href="http://localhost/barentswatch/GeoExt-1.1/lib/GeoExt/widgets/VectorLegend.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/GeoExt-1.1/lib/GeoExt/widgets/VectorLegend.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">VectorLegend.js:261</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Events.OpenLayers.Class.triggerEvent</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Events.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Events.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Events.js:798</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Map.OpenLayers.Class.moveTo</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Map.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Map.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Map.js:1890</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Map.OpenLayers.Class.setCenter</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Map.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Map.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Map.js:1662</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Control.Navigation.OpenLayers.Class.wheelChange</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Control/Navigation.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Control/Navigation.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Navigation.js:279</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Control.Navigation.OpenLayers.Class.wheelDown</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Control/Navigation.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Control/Navigation.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Navigation.js:303</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Handler.OpenLayers.Class.callback</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">Handler.js:205</a></div>
</li>
<li title="" style="box-sizing: border-box; padding-top: 0px;
padding-right: 0px; padding-bottom: 0px; padding-left: 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Handler.MouseWheel.OpenLayers.Class.wheelZoom</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler/MouseWheel.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler/MouseWheel.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">MouseWheel.js:229</a></div>
</li>
<li title="" class="" style="box-sizing: border-box;
padding-top: 0px; padding-right: 0px; padding-bottom: 0px;
padding-left: 14px; margin-top: 1px; margin-bottom: 1px;
margin-left: -2px; word-wrap: break-word; ">
<div style="box-sizing: border-box; "><span class="console-message-text source-code" style="box-sizing: border-box; white-space: pre-wrap;
font-family: Consolas, 'Lucida Console', monospace;
font-size: 12px !important; color: red !important; ">OpenLayers.Handler.MouseWheel.OpenLayers.Class.onWheelEvent</span><a href="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler/MouseWheel.js" class="console-message-url webkit-html-resource-link" title="http://localhost/barentswatch/OpenLayers-2.11/lib/OpenLayers/Handler/MouseWheel.js" style="box-sizing: border-box; float: right; margin-left:
4px; color: rgb(84, 84, 84); cursor: pointer; max-width:
100%; ">MouseWheel.js:191</a></div>
</li>
<li title="" class="selected" style="padding: 0px 0px 0px 14px;
margin-top: 1px; margin-bottom: 1px; margin-left: -2px;
word-wrap: break-word;">
<div style=""><span class="console-message-text source-code" style="white-space: pre-wrap; font-family:
Consolas,'Lucida Console',monospace; font-size: 12px !
important; color: red ! important;">(anonymous function)</span></div>
</li>
</ol>
</ol><p>To the inner level this maps down to the function<br>
onMapZoom: function() {<br>
this.setCurrentScaleDenominator(<br>
this.layer.map.getScale()<br>
);<br>
},<br>
</p><p>And by inspection this.layer is undefined.<br>
</p><p>How can this be?<br>
Removing the layer with any combination of (one or both)<br>
map.removeLayer(layer) and<br>
layer.destroy()<br>
gives the same result.<br>
</p><p>best regards,<br>
Frank<br>
</p><p><br>
</p>
<br>
</div>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@geoext.org">Users@geoext.org</a><br>http://www.geoext.org/cgi-bin/mailman/listinfo/users<br></blockquote></div><br></div></body></html>