Ticket #283 (reopened defect)

Opened 4 months ago

Last modified 1 week ago

layerstore treepanel loader plus groupPanel dont play nice with Google maps.

Reported by: pscadden Assigned to:
Priority: major Milestone: 1.0
Component: GeoExt Version: trunk
Keywords: google map treeloader Cc:
State: Needs more work

Description

If a map is created but not rendered, and then google layers added a treepanel, then the google map does not display, and if layer is switched (whether by treepanel or layerswitcher), it does not display the correct size or bounds. Identical code without treepanel work okay.

Attach are two test html files. The first doesnt work. The second (without treepanel), does.

Attachments

test.html (7.4 kB) - added by pscadden on 05/18/10 06:11:42.
Code showing failure
test4.html (6.2 kB) - added by pscadden on 05/18/10 06:12:40.
Same code, no treepanel
geoext-283.patch (0.7 kB) - added by ahocevar on 06/01/10 11:31:25.

Change History

05/18/10 06:11:42 changed by pscadden

  • attachment test.html added.

Code showing failure

05/18/10 06:12:40 changed by pscadden

  • attachment test4.html added.

Same code, no treepanel

06/01/10 04:06:58 changed by pscadden

Attached is very minimal code from Thomas Baginski.

<!DOCTYPE html

PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Google/Map Panel Bug test</title> <script type="text/javascript" src="ext-3.1.1/adapter/ext/ext-base-debug.js"></script> <script type="text/javascript" src="ext-3.1.1/ext-all-debug.js"></script> <script type="text/javascript" src="OpenLayers-2.9/lib/OpenLayers.js"></script> <script type="text/javascript" src="GeoExt0.7/script/GeoExt.js"></script> <script type="text/javascript" language="javascript" src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAR7YD2FMuJnK6_0QbbbF44hS3s4pSqQ84owDwZe7riLV-_wB94xRGhe29tjh7Jrc8S8JJWUWq19mq-A"></script> <link rel="stylesheet" href="ext-3.1.1/resources/css/ext-all.css" type="text/css" />

</head> <body style="margin:5; padding:0; height:100%; width:100%; border:none;"> <script type="text/javascript"><!--

Ext.onReady(function(){

var map = new OpenLayers.Map(); map.addLayers([new OpenLayers.Layer.Google(

"Google Physical", {type: G_PHYSICAL_MAP, visibility: true}

), new OpenLayers.Layer.Google(

"Google Streets", {numZoomLevels: 20}

)]);

var myLayerStore = new GeoExt.data.LayerStore({

map: map

}); var mapViewer = new Ext.Panel({

renderTo: 'mapviewerid', layout: 'border', width: 800, height: 600, collapsible: false, items:[{

xtype: 'treepanel', id: 'westid', title: 'West', region: 'west', width: 200, collapsible: true, collapsed: true, root: new GeoExt.tree.LayerContainer({

text: 'All Layers', layerStore: myLayerStore, leaf: false, expanded: true

})

}, {

xtype: 'gx_mappanel', region: 'center', layout: 'fit', map: map, layers: myLayerStore, center: [-122, 38], zoom: 5

} ]

}); // Kludge to make google and GeoExt.tree.LayerContainer play nice together // start with the treepanel collapsed // then these three steps in order make it work. // The combination of switching layers and causing the mappanel to resize // gets the google layer to fill the mappanel

// map.layers[1].setVisibility(true); // Ext.getCmp('westid').expand(false); // map.layers[0].setVisibility(true); });

//--> </script> <div id='mapviewerid' style="width: 900px; height: 500px;"></div>

</body> </html>

06/01/10 11:31:25 changed by ahocevar

  • attachment geoext-283.patch added.

06/01/10 11:33:20 changed by ahocevar

  • state changed from None to Review.

attachment:geoext-283.patch fixes the issue. enforceOneVisibile should not be used for the internal baselayer group. All tests still pass, and the example pasted above works with the patch applied. Thanks for any review.

06/01/10 18:52:48 changed by tschaub

  • priority changed from blocker to major.
  • state changed from Review to Commit.

Looks good. Please commit.

06/01/10 19:02:22 changed by ahocevar

  • status changed from new to closed.
  • resolution set to fixed.

(In [2222]) do not enforceOneVisible for "real" base layers. r=tschaub (closes #283)

06/01/10 19:02:45 changed by ahocevar

  • type changed from enhancement to defect.

06/17/10 02:34:40 changed by pscadden

  • status changed from closed to reopened.
  • resolution deleted.

A zombie! If you remove all google layers from map and then add different ones, the problem resurfaces.

08/30/10 09:14:08 changed by fredj

  • state changed from Commit to Needs more work.