[Commits] r2139 - in sandbox/bartvde/playground/geoext: examples lib lib/GeoExt/widgets/tree
commits at geoext.org
commits at geoext.org
Thu Apr 29 09:54:17 CEST 2010
Author: bartvde
Date: 2010-04-29 09:54:17 +0200 (Thu, 29 Apr 2010)
New Revision: 2139
Modified:
sandbox/bartvde/playground/geoext/examples/wms-tree.html
sandbox/bartvde/playground/geoext/examples/wms-tree.js
sandbox/bartvde/playground/geoext/lib/GeoExt.js
sandbox/bartvde/playground/geoext/lib/GeoExt/widgets/tree/WMSLoader.js
Log:
moving WMSLoader to GeoExt core
Modified: sandbox/bartvde/playground/geoext/examples/wms-tree.html
===================================================================
--- sandbox/bartvde/playground/geoext/examples/wms-tree.html 2010-04-29 06:59:37 UTC (rev 2138)
+++ sandbox/bartvde/playground/geoext/examples/wms-tree.html 2010-04-29 07:54:17 UTC (rev 2139)
@@ -1,27 +1,31 @@
<html>
<head>
- <title>WMSTree Example</title>
+ <title>WMSLoader Example</title>
+<!-- <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/adapter/ext/ext-base.js"></script>
+ <script type="text/javascript" src="http://extjs.cachefly.net/ext-2.2.1/ext-all.js"></script>
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/resources/css/ext-all.css" />
+ <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-2.2.1/examples/shared/examples.css" />-->
+
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.2.0/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.2.0/ext-all.js"></script>
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.0/resources/css/ext-all.css" />
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.0/examples/shared/examples.css" />
+
<script src="http://www.openlayers.org/api/2.9/OpenLayers.js"></script>
- <script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script>
- <script type="text/javascript" src="../../../../geoext/lib/overrides/override-ext-ajax.js"></script>
+ <script type="text/javascript" src="../lib/GeoExt.js"></script>
+ <script type="text/javascript" src="../lib/overrides/override-ext-ajax.js"></script>
- <!-- script resources for this ux -->
- <script type="text/javascript" src="../lib/GeoExt.ux/WMSLoader.js"></script>
+ <script type="text/javascript" src="wms-tree.js"></script>
- <script type="text/javascript" src="WMSTree.js"></script>
-
</head>
<body>
- <h1>Tree using a GeoExt.ux.WMSLoader</h1>
+ <h1>Tree using a GeoExt.tree.WMSLoader</h1>
<div id="desc">
- <p>This example shows how to use GeoExt.ux.WMSLoader to populate a tree
- with the hierarchical structure of a WMS GetCapabilities response.</p>
- <p>See <a href="WMSTree.js">WMSTree.js</a> for the source code.</p>
+ <p>This example shows how to use GeoExt.tree.WMSLoader to populate a tree
+ with the hierarchical structure of a WMS GetCapabilities response. The example
+ also shows how to create a click handler to add the layers to a map.</p>
+ <p>See <a href="wms-tree.js">wms-tree.js</a> for the source code.</p>
</div>
</body>
</html>
Modified: sandbox/bartvde/playground/geoext/examples/wms-tree.js
===================================================================
--- sandbox/bartvde/playground/geoext/examples/wms-tree.js 2010-04-29 06:59:37 UTC (rev 2138)
+++ sandbox/bartvde/playground/geoext/examples/wms-tree.js 2010-04-29 07:54:17 UTC (rev 2139)
@@ -8,7 +8,7 @@
{
region: 'west',
width: 250,
- loader: new GeoExt.ux.WMSLoader(
+ loader: new GeoExt.tree.WMSLoader(
{
url: 'http://demo.opengeo.org/geoserver/wms?',
layerOptions: {buffer: 0, singleTile: true, ratio: 1},
Modified: sandbox/bartvde/playground/geoext/lib/GeoExt/widgets/tree/WMSLoader.js
===================================================================
--- sandbox/bartvde/playground/geoext/lib/GeoExt/widgets/tree/WMSLoader.js 2010-04-29 06:59:37 UTC (rev 2138)
+++ sandbox/bartvde/playground/geoext/lib/GeoExt/widgets/tree/WMSLoader.js 2010-04-29 07:54:17 UTC (rev 2139)
@@ -1,18 +1,51 @@
-Ext.namespace("GeoExt.ux");
+/**
+ * Copyright (c) 2008-2010 The Open Source Geospatial Foundation
+ *
+ * Published under the BSD license.
+ * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
+ * of the license.
+ */
-GeoExt.ux.WMSLoader = function(config) {
+Ext.namespace("GeoExt.tree");
+
+/** api: (define)
+ * module = GeoExt.tree
+ * class = WMSLoader
+ * base_link = `Ext.util.Observable <http://www.extjs.com/deploy/dev/docs/?class=Ext.tree.TreeLoader>`_
+ */
+
+/** api: constructor
+ * .. class:: WMSLoader
+ *
+ * A loader that will load all layers of a Web Map Service (WMS).
+ */
+GeoExt.tree.WMSLoader = function(config) {
Ext.apply(this, config);
- GeoExt.ux.WMSLoader.superclass.constructor.call(this);
+ GeoExt.tree.WMSLoader.superclass.constructor.call(this);
};
-Ext.extend(GeoExt.ux.WMSLoader, Ext.tree.TreeLoader, {
+Ext.extend(GeoExt.tree.WMSLoader, Ext.tree.TreeLoader, {
+ /** private: property[requestMethod]
+ * ``String`` WMS GetCapabilities request needs to be done using HTTP GET
+ */
requestMethod: 'GET',
+ /** private: method[getParams]
+ * Private getParams override.
+ */
getParams: function(node) {
return {'service': 'WMS', 'request': 'GetCapabilities'};
},
+ /** private: method[processResponse]
+ * :param response: ``Object`` The XHR object
+ * :param node: ``Ext.tree.TreeNode``
+ * :param callback: ``Function``
+ * :param scope: ``Object``
+ *
+ * Private processResponse override.
+ */
processResponse : function(response, node, callback, scope){
var capabilities = new OpenLayers.Format.WMSCapabilities().read(
response.responseXML || response.responseText);
@@ -21,6 +54,14 @@
this.runCallback(callback, scope || node, [node]);
},
+ /** private: method[createWMSLayer]
+ * :param layer: ``Object`` The layer object from the WMS GetCapabilities
+ * parser
+ * :param url: ``String`` The online resource of the WMS
+ *
+ * Create a WMS layer which will be attached as an attribute to the
+ * node.
+ */
createWMSLayer: function(layer, url) {
return new OpenLayers.Layer.WMS( layer.title, url,
OpenLayers.Util.extend({formats: layer.formats[0], layers: layer.name}, this.layerParams),
@@ -30,6 +71,15 @@
}, this.layerOptions));
},
+ /** private: method[processLayer]
+ * :param layer: ``Object`` The layer object from the WMS GetCapabilities
+ * parser
+ * :param url: ``String`` The online resource of the WMS
+ * :param node: ``Ext.tree.TreeNode``
+ *
+ * Recursive function to create the tree nodes for the layer structure
+ * of a WMS GetCapabilities response.
+ */
processLayer: function(layer, url, node) {
Ext.each(layer.nestedLayers, function(el) {
var n = this.createNode({text: el.title || el.name,
Modified: sandbox/bartvde/playground/geoext/lib/GeoExt.js
===================================================================
--- sandbox/bartvde/playground/geoext/lib/GeoExt.js 2010-04-29 06:59:37 UTC (rev 2138)
+++ sandbox/bartvde/playground/geoext/lib/GeoExt.js 2010-04-29 07:54:17 UTC (rev 2139)
@@ -100,6 +100,7 @@
"GeoExt/widgets/tree/OverlayLayerContainer.js",
"GeoExt/widgets/tree/LayerParamNode.js",
"GeoExt/widgets/tree/LayerParamLoader.js",
+ "GeoExt/widgets/tree/WMSLoader.js",
"GeoExt/widgets/LayerOpacitySlider.js",
"GeoExt/widgets/LayerLegend.js",
"GeoExt/widgets/LegendImage.js",
More information about the Commits
mailing list