- Timestamp:
- 09/08/10 09:43:31 (21 months ago)
- Location:
- framework/server/trunk/docs
- Files:
-
- 2 modified
- 1 moved
-
_static/layout.js (moved) (moved from framework/server/trunk/docs/_static/mapfishapp_layout.js) (6 diffs)
-
_static/query.png (modified) (previous)
-
quickstart.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
framework/server/trunk/docs/_static/layout.js
r3569 r3635 5 5 * @include OpenLayers/Layer/XYZ.js 6 6 * @include OpenLayers/Tile/Image.js 7 * @include OpenLayers/Protocol/HTTP.js 8 * @include OpenLayers/Request/XMLHttpRequest.js 7 9 * @include OpenLayers/Control/Navigation.js 8 10 * @include OpenLayers/Control/ZoomBox.js 9 11 * @include OpenLayers/Control/NavigationHistory.js 12 * @include OpenLayers/Control/GetFeature.js 13 * @include OpenLayers/Format/GeoJSON.js 10 14 * @include GeoExt/data/LayerStore.js 11 15 * @include GeoExt/widgets/MapPanel.js … … 14 18 * @include GeoExt/widgets/tips/ZoomSliderTip.js 15 19 * @include GeoExt/widgets/tree/LayerContainer.js 20 * @include GeoExt/widgets/Popup.js 16 21 */ 17 22 18 Ext.namespace(" mapfishapp");19 20 mapfishapp.layout = (function() {23 Ext.namespace("App"); 24 25 App.layout = (function() { 21 26 /* 22 27 * Private … … 40 45 20037508, 20037508.34), 41 46 allOverlays: false, 47 theme: null, 42 48 controls: [] 43 49 }); … … 109 115 })); 110 116 actions.push(new GeoExt.Action({ 111 iconCls: "info",117 text: "Query", 112 118 map: map, 113 119 toggleGroup: "tools", 114 120 allowDepress: false, 115 tooltip: "Query", 116 control: new mapfish.Searcher.Map({ 117 url: "countries", 118 protocol: { 121 control: new OpenLayers.Control.GetFeature({ 122 protocol: new OpenLayers.Protocol.HTTP({ 123 url: "countries", 119 124 params: { 120 125 epsg: "900913", 121 126 attrs: "pays,continent" 127 }, 128 format: new OpenLayers.Format.GeoJSON() 129 }), 130 eventListeners: { 131 featureselected: function(e) { 132 var f = e.feature; 133 var html = "<p>Country: "+f.attributes.pays+"</p>" + 134 "<p>Continent: "+f.attributes.continent+"</p>"; 135 f.geometry.transform( 136 map.displayProjection, map.projection); 137 if (!this._popup) { 138 this._popup = new GeoExt.Popup({ 139 html: html, 140 map: map, 141 closeAction: 'hide', 142 unpinnable: false 143 }); 144 } 145 else { 146 this._popup.body.update(html); 147 this._popup.doLayout(); 148 } 149 this._popup.feature = f; 150 this._popup.show(); 122 151 } 123 }, 124 displayDefaultPopup: true 152 } 125 153 }) 126 154 })); … … 152 180 */ 153 181 init: function() { 154 Ext.QuickTips.init();155 182 156 183 var map = createMap(); … … 187 214 width: 150, 188 215 xtype: "treepanel", 216 loader: new Ext.tree.TreeLoader({ 217 applyLoader: false 218 }), 189 219 root: { 190 220 nodeType: "gx_layercontainer", -
framework/server/trunk/docs/quickstart.txt
r3569 r3635 168 168 169 169 3. configure a route to the ``countries`` controller, this is done by adding 170 the following statementafter the "CUSTOM ROUTES HERE" comment in the170 the following lines after the "CUSTOM ROUTES HERE" comment in the 171 171 ``mapfishapp/config/routing.py`` file:: 172 172 173 map.connect("/countries/count", controller="countries", action="count") 173 174 map.resource("country", "countries") 174 175 … … 196 197 the user. 197 198 198 Edit the ``mapfishapp/public/app/ js/mapfishapp_layout.js`` file, look up the199 Edit the ``mapfishapp/public/app/lib/App/layout.js`` file, look up the 199 200 ``createTbarItems()`` function, and insert a new ``GeoExt.Action`` to the array 200 201 returned by the function by adding the following code to the function (If 201 unsure, see this :download:`file <_static/ mapfishapp_layout.js>`):202 unsure, see this :download:`file <_static/layout.js>`): 202 203 203 204 .. code-block:: javascript 204 205 205 206 actions.push(new GeoExt.Action({ 206 iconCls: "info",207 text: "Query", 207 208 map: map, 208 209 toggleGroup: "tools", 209 210 allowDepress: false, 210 tooltip: "Query", 211 control: new mapfish.Searcher.Map({ 212 url: "countries", 213 protocol: { 214 params: { 215 epsg: "900913", 216 attrs: "pays,continent", 217 no_geom: true 218 } 219 }, 220 displayDefaultPopup: true 211 control: new OpenLayers.Control.GetFeature({ 212 protocol: new OpenLayers.Protocol.HTTP({ 213 url: "countries", 214 params: { 215 epsg: "900913", 216 attrs: "pays,continent" 217 }, 218 format: new OpenLayers.Format.GeoJSON() 219 }), 220 eventListeners: { 221 featureselected: function(e) { 222 var f = e.feature; 223 var html = "<p>Country: "+f.attributes.pays+"</p>" + 224 "<p>Continent: "+f.attributes.continent+"</p>"; 225 f.geometry.transform( 226 map.displayProjection, map.projection); 227 if (!this._popup) { 228 this._popup = new GeoExt.Popup({ 229 html: html, 230 map: map, 231 closeAction: 'hide', 232 unpinnable: false 233 }); 234 } 235 else { 236 this._popup.body.update(html); 237 this._popup.doLayout(); 238 } 239 this._popup.feature = f; 240 this._popup.show(); 241 } 242 } 221 243 }) 222 244 })); 223 245 224 In the above code a ``GeoExt.Action`` configured with ``mapfish.Searcher.Map`` 225 is added to the array of actions. The ``mapfish.Searcher.Map`` object is 226 connected to the ``countries`` web service through the ``url`` option. In this 227 example the ``mapfish.Searcher.Map`` object displays a default popup containing 228 the name of the clicked country, and the name of is continent. 246 In the above code a ``GeoExt.Action`` configured with an 247 ``OpenLayers.Control.GetFeature`` is added to the array of actions. The 248 ``OpenLayers.Control.GetFeature`` object is connected to the ``countries`` web 249 service through an ``OpenLayers.Protocol.HTTP`` object. In this example a 250 ``GeoExt.Popup`` containing the name of the clicked country, and the name of 251 the continent, is displayed. 229 252 230 253 .. image:: _static/query.png
