[Commits] r929 - in apps/opengeo/geoexplorer/trunk/lib: . GeoExplorer/Full
commits at geoext.org
commits at geoext.org
Mon Jun 1 21:09:57 CEST 2009
Author: dwins
Date: 2009-06-01 21:09:57 +0200 (Mon, 01 Jun 2009)
New Revision: 929
Modified:
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Full/Full.js
Log:
Reinstate sphinxy comments, redo layout a bit.
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Full/Full.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Full/Full.js 2009-06-01 18:47:30 UTC (rev 928)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer/Full/Full.js 2009-06-01 19:09:57 UTC (rev 929)
@@ -68,10 +68,10 @@
modal: true,
title: "Export Map",
pages: [{
- title: 'Choose Layers',
+ title: 'Layers',
panel: layerSelection
},{
- title: 'Finish',
+ title: 'Done!',
panel: finalize
}]
});
@@ -232,7 +232,7 @@
}
],
autoExpandColumn:'layer',
- title: "Pure",
+ title: "Data Layers",
listeners: {
rowclick: function(grid, index, evt) {
var record = grid.getStore().getAt(index);
@@ -288,7 +288,7 @@
region: 'north',
cls: "gx-wizard-description",
border: false,
- html:'<p>Select the layers that are visible by default.</p>'
+ html:'<p>Next, choose layers to include in the map:</p>'
},
datagrid,
basegrid
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-06-01 18:47:30 UTC (rev 928)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-06-01 19:09:57 UTC (rev 929)
@@ -7,86 +7,96 @@
*/
/**
- * Constructor: GeoExplorer
- * Create a new GeoExplorer application.
+ * api: (define)
+ * module = GeoExplorer
+ * extends = Viewer
+ */
+
+/** api: constructor
+ * .. class:: GeoExplorer(config)
+ * Create a new GeoExplorer application.
*
- * Parameters:
- * config - {Object} Optional application configuration properties.
+ * Parameters:
+ * config - {Object} Optional application configuration properties.
*
- * Valid config properties:
- * map - {Object} Map configuration object.
- * ows - {String} OWS URL
- * alignToGrid - {boolean} if true, align tile requests to the grid enforced by
- * tile caches such as GeoWebCache or Tilecache
+ * Valid config properties:
+ * map - {Object} Map configuration object.
+ * ows - {String} OWS URL
+ * alignToGrid - {boolean} if true, align tile requests to the grid
+ * enforced by tile caches such as GeoWebCache or Tilecache
*
- * Valid map config properties:
- * layers - {Array} A list of layer configuration objects.
- * center - {Array} A two item array with center coordinates.
- * zoom - {Number} An initial zoom level.
+ * Valid map config properties:
+ * layers - {Array} A list of layer configuration objects.
+ * center - {Array} A two item array with center coordinates.
+ * zoom - {Number} An initial zoom level.
*
- * Valid layer config properties:
- * name - {String} Required WMS layer name.
- * title - {String} Optional title to display for layer.
+ * Valid layer config properties:
+ * name - {String} Required WMS layer name.
+ * title - {String} Optional title to display for layer.
*
- * Extends:
- * - Viewer
*/
var GeoExplorer = Ext.extend(Viewer, {
- /**
- * Property: map
- * {OpenLayers.Map} The application's map.
+ /** api: property[map]
+ * :class:`OpenLayers.Map` The application's map.
*/
map: null,
- /**
- * Property: layers
- * {GeoExt.data.LayerStore} A store containing a record for each layer
- * on the map.
+ /** private: property[layers]
+ * A :class:`GeoExt.data.LayerStore` containing a record for each layer
+ * on the map.
*/
layers: null,
- /**
- * Property: capabilities
- * {GeoExt.data.WMSCapabilitiesStore} A store containing a record for each
- * layer on the server.
- */
- capabilities: null,
+
/**
- * Property: mapPanel
- * {GeoExt.MapPanel} the MapPanel instance for the main viewport
+ * private: property[mapPanel]
+ * the :class:`GeoExt.MapPanel` instance for the main viewport
*/
mapPanel: null,
/**
- * Property: alignToGrid
- * whether or not to restrict tile request to tiled mapping service recommendation
+ * api: config[alignToGrid]
+ * A boolean indicating whether or not to restrict tile request to tiled
+ * mapping service recommendation.
+ *
+ * True => align to grid
+ * False => unrestrained tile requests
*/
alignToGrid: false,
/**
- * Property: capGrid
- * {<Ext.Window>} A window which includes a CapabilitiesGrid panel.
+ * private: property[capGrid]
+ * :class:`Ext.Window` The window containing the CapabilitiesGrid panel to
+ * use when the user is adding new layers to the map.
*/
capGrid: null,
/**
- * Property: popupCache
- * {Object} An object containing references to visible popups so that
- * we can insert responses from multiple requests.
+ * private: property[popupCache]
+ * :class:`Object` An object containing references to visible popups so that
+ * we can insert responses from multiple requests.
+ *
+ * ..seealso:: :method:`GeoExplorer.displayPopup()`
*/
popupCache: {},
+ /** api: property[layerSources]
+ * A :class:`Ext.data.Store` containing one
+ * :class:`GeoExt.data.WMSCapabilitiesStore` for each WMS service in use by
+ * the application, along with service-specific metadata like the service
+ * name.
+ */
layerSources: null,
/**
- * Method: load
+ * private: method[load]
* Called at the end of construction. This initiates the sequence that
- * prepares the application for use.
+ * prepares the application for use, including tasks such as loading
+ * capabilities from remote servers, populating the map, etc.
*/
load: function() {
-
this.layerSources = new Ext.data.SimpleStore({
fields: ["identifier", "name", "store", "url"],
data: []
@@ -110,16 +120,14 @@
return function(done){
this.addSource(this.ows[id], id, done, done);
};
- })(id)
- );
+ })(id));
}
this.dispatch(
dispatchQueue,
// activate app when the above are both done
- this.activate
- );
+ this.activate);
},
/** private: method[addSource]
@@ -197,8 +205,7 @@
return url;
},
- /**
- * Method: createLayout
+ /** private: method[createLayout]
* Create the various parts that compose the layout.
*/
createLayout: function() {
@@ -206,7 +213,6 @@
// 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()]
});
@@ -285,6 +291,8 @@
}
});
+ //this is a hack around OpenLayers #2111
+ var map = this.map
var removeLayerAction = new Ext.Action({
text: "Remove Layer",
iconCls: "icon-removelayers",
@@ -298,13 +306,17 @@
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();
}
}
});
var layerTreeConfig = {
- border: true,
+ border:false,
rootVisible: false,
enableDD: true,
selModel: selectionModel,
@@ -341,7 +353,9 @@
root: new GeoExt.tree.OverlayLayerContainer({
layerStore: this.layerStore
}),
- ddGroup: "OverlayLayerDD"
+ ddGroup: "OverlayLayerDD",
+ height: 'auto',
+ region: 'center'
},
layerTreeConfig));
@@ -351,7 +365,10 @@
root: new GeoExt.tree.BaseLayerContainer({
layerStore: this.layerStore
}),
- ddGroup: "BaseLayerDD"
+ ddGroup: "BaseLayerDD",
+ title: 'Base Layers',
+ height: 120,
+ region: 'south'
},
layerTreeConfig));
@@ -360,6 +377,7 @@
border: false,
region: 'center',
title: "Layers",
+ layout: 'border',
items: [overlayLayerTree, baseLayerTree],
tbar: [
addLayerButton,
@@ -416,8 +434,7 @@
});
},
- /**
- * Method: activate
+ /** private: method[activate]
* Activate the application. Call after application is configured.
*/
activate: function() {
@@ -432,9 +449,9 @@
},
- /**
- * Method: addLayers
- * Construct the layer store to be used with the map (referenced as <layers>).
+ /** private: method[addLayers]
+ * Construct the layer store to be used with the map (referenced as
+ * :attr:`GeoExplorer.layers`).
*/
addLayers: function() {
var mapConfig = this.initialConfig.map;
@@ -502,7 +519,7 @@
},
/**
- * Method: initCapGrid
+ * private: method[initCapGrid]
* Constructs a window with a capabilities grid.
*/
initCapGrid: function(){
@@ -600,6 +617,14 @@
scope : this
}),
new Ext.Button({
+ text: "Add Base Layers",
+ iconCls: "icon-addlayers",
+ handler: function(){
+ capGridPanel.addLayers(true);
+ },
+ scope : this
+ }),
+ new Ext.Button({
text: "Done",
handler: function() {
this.capGrid.hide();
@@ -615,8 +640,7 @@
});
},
- /**
- * Method: showCapabilitiesGrid
+ /** private: method[showCapabilitiesGrid]
* Shows the window with a capabilities grid.
*/
showCapabilitiesGrid: function() {
@@ -626,6 +650,11 @@
this.capGrid.show();
},
+ /** private: method[createMapOverlay]
+ * Builds the :class:`Ext.Panel` containing components to be overlaid on the
+ * map, setting up the special configuration for its layout and
+ * map-friendliness.
+ */
createMapOverlay: function() {
var scaleLinePanel = new Ext.Panel({
cls: 'olControlScaleLine overlay-element overlay-scaleline',
@@ -703,6 +732,11 @@
return mapOverlay;
},
+ /** private: method[createTools]
+ * Create the toolbar configuration for the main panel. This method can be
+ * overridden in derived explorer classes such as :class:`GeoExplorer.Full`
+ * or :class:`GeoExplorer.Embed` to provide specialized controls.
+ */
createTools: function() {
// create a navigation control
@@ -787,7 +821,7 @@
layers: [x.get("layer")],
eventListeners: {
getfeatureinfo: function(evt) {
- gx.displayPopup(evt, x.get("title"));
+ gx.displayPopup(evt, x.get("title") || x.get("name"));
},
scope: gx
}
@@ -886,6 +920,14 @@
return tools;
},
+ /** private: method[createMeasureTool]
+ * :param: handlerType: the :class:`OpenLayers.Handler` for the measurement
+ * operation
+ * :param: title: the string label to display alongside results
+ *
+ * Convenience method for creating a :class:`OpenLayers.Control.Measure`
+ * control
+ */
createMeasureTool: function(handlerType, title) {
var styleMap = new OpenLayers.StyleMap({
@@ -999,7 +1041,13 @@
return measureControl;
},
- displayPopup: function(evt, title){
+ /** private: method[displayPopup]
+ * :param: evt: the event object from a
+ * :class:`OpenLayers.Control.GetFeatureInfo` control
+ * :param: title: a String to use for the title of the results section
+ * reporting the info to the user
+ */
+ displayPopup: function(evt, title) {
var popup;
var popupKey = evt.xy.x + "." + evt.xy.y;
@@ -1042,12 +1090,11 @@
/**
- * Method: bookmark
+ * private: method[bookmark]
+ * :return: the URL :class:`String` that was displayed to the user
+ *
* Creates a window that shows the user a URL that can be used to
* reload the map in its current configuration.
- *
- * Returns:
- *{String} The URL displayed to the user.
*/
bookmark: function(){
var config = this.extractConfiguration();
@@ -1077,13 +1124,10 @@
},
/**
- * Method: extractConfiguration
- * Returns an object that represents the app's current configuration.
- *
- * Returns:
- *{Object} An object that represents the app's current configuration.
+ * private: method[extractConfiguration]
+ * :return: an :class:`Object` representing the app's current configuration.
*/
- extractConfiguration: function(){
+ extractConfiguration: function() {
var config = {};
// Map configuration
@@ -1099,21 +1143,26 @@
config.map.layers = [];
this.layers.each(function(layerRecord){
+ if (layerRecord.get('layer').displayInLayerSwitcher) {
+ var c = {
+ title: layerRecord.get("title"),
+ name: (layerRecord.get("layer").params &&
+ layerRecord.get("layer").params.LAYERS) ||
+ layerRecord.get("name"),
+ visibility: layerRecord.get("layer").getVisibility(),
+ isBaseLayer: layerRecord.get("layer").isBaseLayer
+ };
- var c = {
- title: layerRecord.get("title"),
- name: (layerRecord.get("layer").params &&
- layerRecord.get("layer").params.LAYERS) ||
- layerRecord.get("name"),
- visibility: layerRecord.get("layer").getVisibility()
- };
-
- config.map.layers.push(c);
+ config.map.layers.push(c);
+ }
});
return config;
},
+ /** private: method[displayAppInfo]
+ * Display an informational dialog about the application.
+ */
displayAppInfo: function() {
var win = new Ext.Window({
title: "About GeoExplorer",
More information about the Commits
mailing list