[Commits] r934 - in apps/opengeo/geoexplorer/trunk: lib lib/GeoExplorer script tests/user
commits at geoext.org
commits at geoext.org
Mon Jun 1 23:44:55 CEST 2009
Author: sbenthall
Date: 2009-06-01 23:44:55 +0200 (Mon, 01 Jun 2009)
New Revision: 934
Added:
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/GroupContainer.js
Modified:
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/CapabilitiesGrid.js
apps/opengeo/geoexplorer/trunk/script/GeoExplorer-debug.js
apps/opengeo/geoexplorer/trunk/tests/user/smoke.txt
Log:
towards "background" instead of "base" layers
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/CapabilitiesGrid.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/CapabilitiesGrid.js 2009-06-01 21:39:11 UTC (rev 933)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/CapabilitiesGrid.js 2009-06-01 21:44:55 UTC (rev 934)
@@ -113,13 +113,13 @@
layer.maxExtent = layer.restrictedExtent;
}
- layer.setIsBaseLayer(!!base);
+ record.set("background", !!base);
this.mapPanel.layers.add(record);
if(base){
- this.mapPanel.map.setBaseLayer(layer);
+ // this.mapPanel.map.setBaseLayer(layer);
//this is a hack around OpenLayers #2111
- layer.events.triggerEvent("visibilitychanged");
+ // layer.events.triggerEvent("visibilitychanged");
}
}
Added: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/GroupContainer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/GroupContainer.js (rev 0)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/GroupContainer.js 2009-06-01 21:44:55 UTC (rev 934)
@@ -0,0 +1,50 @@
+/**
+ * @requires GeoExt/widgets/tree/LayerContainer.js
+ */
+Ext.namespace("GeoExplorer");
+
+GeoExplorer.GroupContainer = Ext.extend(GeoExt.tree.LayerContainer, {
+
+ background: null,
+
+ /**
+ * Constructor: GeoExt.tree.OverlayLayerContainer
+ *
+ * Parameters:
+ * config - {Object}
+ */
+ constructor: function(config) {
+ config.text = config.text || "Overlays";
+ this.background = config.background;
+ GeoExplorer.GroupContainer.superclass.constructor.apply(this,
+ arguments);
+ },
+
+ /**
+ * Method: addLayerNode
+ * Adds a child node representing a overlay layer of the map
+ *
+ * Parameters:
+ * layerRecord - {Ext.data.Record} the layer record to add a node for
+ */
+ addLayerNode: function(layerRecord) {
+ if (layerRecord.get("background") == this.background) {
+ GeoExplorer.GroupContainer.superclass.addLayerNode.call(this,
+ layerRecord);
+ }
+ },
+
+ /**
+ * Method: removeLayerNode
+ * Removes a child node representing an overlay layer of the map
+ *
+ * Parameters:
+ * layerRecord - {Ext.data.Record} the layer record to remove the node for
+ */
+ removeLayerNode: function(layerRecord) {
+ if (layerRecord.get("background") == this.background) {
+ GeoExplorer.GroupContainer.superclass.removeLayerNode.call(
+ this, layerRecord);
+ }
+ }
+});
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-06-01 21:39:11 UTC (rev 933)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-06-01 21:44:55 UTC (rev 934)
@@ -48,8 +48,6 @@
*/
layers: null,
-
-
/**
* private: property[mapPanel]
* the :class:`GeoExt.MapPanel` instance for the main viewport
@@ -143,12 +141,28 @@
id = id || OpenLayers.Util.createUniqueID("source");
var capsURL = this.createWMSCapabilitiesURL(url);
-
+ var store = new GeoExt.data.WMSCapabilitiesStore();
+
+
+
OpenLayers.Request.GET({
proxy: this.proxy,
url: capsURL,
success: function(request){
- var store = new GeoExt.data.WMSCapabilitiesStore();
+ var store = new GeoExt.data.WMSCapabilitiesStore({
+ fields: [
+ {name: "name", type: "string"},
+ {name: "abstract", type: "string"},
+ {name: "queryable", type: "boolean"},
+ {name: "formats"},
+ {name: "styles"},
+ {name: "llbbox"},
+ {name: "minScale"},
+ {name: "maxScale"},
+ {name: "prefix"},
+ {name: "background", type: "boolean"}
+ ]
+ });
var data = request.responseXML || request.responseText;
try {
@@ -213,6 +227,7 @@
// create the map
// TODO: check this.initialConfig.map for any map options
this.map = new OpenLayers.Map({
+ allOverlays: true,
controls: [new OpenLayers.Control.PanPanel(),
new OpenLayers.Control.ZoomPanel()]
});
@@ -306,9 +321,6 @@
store.remove(store.getAt(store.findBy(function(record) {
return record.get("layer") === layer;
})));
-
- //this is a hack around OpenLayers #2111
- map.baseLayer.events.triggerEvent("visibilitychanged");
removeLayerAction.disable();
}
@@ -350,7 +362,8 @@
var overlayLayerTree = new Ext.tree.TreePanel(
Ext.apply(
{
- root: new GeoExt.tree.OverlayLayerContainer({
+ root: new GeoExplorer.GroupContainer({
+ background: false,
layerStore: this.layerStore
}),
ddGroup: "OverlayLayerDD",
@@ -362,7 +375,8 @@
var baseLayerTree = new Ext.tree.TreePanel(
Ext.apply(
{
- root: new GeoExt.tree.BaseLayerContainer({
+ root: new GeoExplorer.GroupContainer({
+ background: true,
layerStore: this.layerStore
}),
ddGroup: "BaseLayerDD",
@@ -467,14 +481,16 @@
continue;
}
- var record = this.layerSources.getAt(index);
- var store = record.data.store;
+ var storeRecord = this.layerSources.getAt(index);
+ var store = storeRecord.data.store;
var id = store.find("name", conf.name);
+ var record;
if (id >= 0) {
record = store.getAt(id).copy();
- var layer = record.get("layer");
+
+ layer = record.get("layer");
// set layer max extent from capabilities
// TODO: make this SRS independent
@@ -485,7 +501,11 @@
} else {
layer.maxExtent = layer.restrictedExtent;
}
-
+
+ layer = layer.clone();
+ record.set("layer", null); //need to do this because record.set compares String(value) to determine equality (dumb)
+ record.set("layer", layer);
+
// set layer visibility from config
layer.visibility = ("visibility" in conf) ? conf.visibility : true;
@@ -493,10 +513,10 @@
if (conf.title) {
layer.name = conf.title;
}
+
+ record.set("background", ("background" in conf ?
+ conf.background : false));
- layer.setIsBaseLayer("isBaseLayer" in conf ?
- conf.isBaseLayer: false);
-
// set any other layer configuration
records.push(record);
}
Modified: apps/opengeo/geoexplorer/trunk/script/GeoExplorer-debug.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/script/GeoExplorer-debug.js 2009-06-01 21:39:11 UTC (rev 933)
+++ apps/opengeo/geoexplorer/trunk/script/GeoExplorer-debug.js 2009-06-01 21:44:55 UTC (rev 934)
@@ -12,6 +12,7 @@
"lib/GeoExplorer/Wizard.js",
"lib/GeoExplorer/LayerMenuItem.js",
"lib/GeoExplorer/CapabilitiesGrid.js",
+ "lib/GeoExplorer/GroupContainer.js",
"lib/GeoExplorer/Full/Full.js",
"lib/GeoExplorer/Embed/Embed.js",
"lib/GeoExplorer/NewSourceWindow.js"
Modified: apps/opengeo/geoexplorer/trunk/tests/user/smoke.txt
===================================================================
--- apps/opengeo/geoexplorer/trunk/tests/user/smoke.txt 2009-06-01 21:39:11 UTC (rev 933)
+++ apps/opengeo/geoexplorer/trunk/tests/user/smoke.txt 2009-06-01 21:44:55 UTC (rev 934)
@@ -79,6 +79,8 @@
6. Click the Done button at the bottom of the dialog.
7. Expect: that you now have some additional layers on the map, and that the available layer dialog is hidden.
9. Expect: that the added layers appear on the map, in the layer tree, and in the legend panel.
+10. Select some other layers (preferably with some nice coverage) and click 'Add Base Layers'
+11. Expect: that you will now have some additional base layers on the map, and that one of the newly added base layers will be selected as the new active, visible map base layer.
10. Click the identify (circled [i]) tool and then click some points on the map where features from different layers overlap.
11. Expect: that you get information about multiple layers in the identify popups now.
12. Select a layer in the tree by single-clicking on it.
@@ -87,11 +89,13 @@
Scenario: Rearrange layers via the layer tree
1. Add some layers to the map.
-2. Drag the top layer from the list to the bottom.
+2. Drag the top layer from the overlay list to the bottom.
3. Expect: that features from the layer are now obscured by features from other layers.
4. Expect: that the move is reflected in the legend panel beneath the layer tree.
5. Repeat steps 2-4 until the same layer is back at the top of the list.
6. Swap the first and second layers a few times, noting the appropriate changes in the map rendering and legend panel.
+7. Try to move a base layer to be on top of an overlay layer.
+8. Expect: you are not able to move a base layer on top of an overlay layer.
Scenario: Hide and display layers via the layer tree.
1. Add some layers to the map.
More information about the Commits
mailing list