Changeset 2708
- Timestamp:
- 04/07/07 22:05:23 (14 years ago)
- Location:
- TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public/index.html
r2476 r2708 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"2 "http://www.w3.org/TR/html4/loose.dtd">3 1 <html> 4 2 <head> 5 <title>Pylons Default Page</title>6 <style>7 body { background-color: #fff; color: #333; } 3 <title>IPCC Data Distribution Centre Visualisation</title> 4 <link type="text/css" rel="stylesheet" href="style.css"/> 5 <link type="text/css" rel="stylesheet" href="tabber.css"/> 8 6 9 body, p { 10 font-family: verdana, arial, helvetica, sans-serif; 11 font-size: 12px; 12 line-height: 18px; 13 } 14 pre { 15 background-color: #eee; 16 padding: 10px; 17 font-size: 11px; 18 line-height: 13px; 19 } 7 <script src="js/OpenLayers.js"></script> 8 <script src="js/openlayers-x.js"></script> 20 9 21 a { color: #000; } 22 a:visited { color: #666; } 23 a:hover { color: #fff; background-color:#000; } 24 </style> 10 <script src="js/prototype.js"></script> 11 <script src="js/ddc-vis.js"></script> 12 <script type="text/javascript"> 13 var tabberOptions = {manualStartup: true}; 14 </script> 15 <script src="js/tabber.js"></script> 16 17 <script type="text/javascript"> 18 19 var app = null; 20 21 function init() { 22 // 4th argument isn't used in DDP 23 app = new DDCVisApp('map', 'form', 'selectionForm', ''); 24 } 25 26 </script> 27 25 28 </head> 26 <body> 29 <body onload="init()"> 30 <h1>DDP Visualisation</h1> 27 31 28 <h1>Welcome to your Pylons Web Application</h1> 32 <table> 33 <tr><td> 34 <div id="mapBox"> 35 <div id="map"></div> 36 <!-- <div id="legend"></div> --> 37 </div> 38 </td> 39 <td valign="top"> 40 <div id="selectionDiv"> 41 <form id="selectionForm"> 42 <table> 43 <tr><td colspan="2" align="center">Max Lat.<br/><input type="text" name="maxLat" size="6"/></td></tr> 44 <tr> 45 <td>Min Lon.<br/><input type="text" name="minLon" size="6"/></td> 46 <td>Max Lon.<br/><input type="text" name="maxLon" size="6"/></td> 47 </tr> 48 <tr><td colspan="2" align="center">Min Lat.<br/><input type="text" name="minLat" size="6"/></td></tr> 49 </table> 50 <input type="button" value="Clear selection" onclick="app.clearSubsel()"/><br/> 51 <!-- <input type="button" value="Make Figure" onclick="app.makeFigure()"/> --> 52 </form> 53 </div> 54 </td></tr> 55 </table> 29 56 30 <h2>Weren't expecting to see this page?</h2> 31 32 <p>The <tt>ows_server/public/</tt> directory is searched for static files 33 <i>before</i> your controllers are run. Remove this file (<tt>ows_server/public/index.html</tt>) 34 and edit the routes in <tt>ows_server/config/routing.py</tt> to point the 35 <a href="/">root path</a> to a 'hello' controller we'll create below: 36 <pre> map.connect('', controller='hello', action='index')</pre> 37 </p> 38 39 <h2>Getting Started</h2> 40 <p>You're now ready to start creating your own web application. To create a 'hello' controller, 41 run the following command in your project's root directory: 42 <pre> 43 ows_server$ paster controller hello 44 </pre> 45 46 This generates the following the following code in <tt>ows_server/controllers/hello.py</tt>: 47 <pre> 48 from ows_server.lib.base import * 49 50 class HelloController(BaseController): 51 def index(self): 52 # Return a rendered template 53 # return render_response('/some/template.html') 54 # or, Return a response object 55 return Response('Hello World') 56 </pre> 57 </p> 58 <p>This controller simply prints out 'Hello World' to the browser. Pylons' default routes 59 automatically set up this controller to respond at the <a href="/hello">/hello</a> URL. 60 With the additional route described above, this controller will also respond at the 61 <a href="/">root path</a>. 62 </p> 63 64 <h3>Using a template</h3> 65 <p>To call a template and do something a little more complex, this following example 66 shows how to print out some request information from a Myghty template. 67 </p> 68 <p>Create a <tt>serverinfo.myt</tt> file in your project's <tt>ows_server/templates/</tt> 69 directory with the following contents: 70 </p> 71 <pre> 72 <h2> 73 Server info for <% request.host %> 74 </h2> 75 76 <p> 77 The URL you called: <% h.url_for() %> 78 </p> 79 80 <p> 81 The name you set: <% c.name %> 82 </p> 83 84 <p>The server environment:<br /> 85 <pre><% c.pretty_environ %></pre> 86 </p> 87 </pre> 88 89 Then add the following to your 'hello' controller class: 90 <pre> 91 def serverinfo(self): 92 import cgi 93 import pprint 94 c.pretty_environ = cgi.escape(pprint.pformat(request.environ)) 95 c.name = 'The Black Knight' 96 return render_response('/serverinfo.myt') 97 </pre> 98 99 You can now view the page at: <tt><a href="/hello/serverinfo">/hello/serverinfo</a></tt> 100 </p> 57 <div id="form"> 58 <form> 59 Field: 60 <select name="field"> 61 <option name="field" value="csolr">csolr</option> 62 <option name="field" value="m1s1i207">m1s1i207</option> 63 <option name="field" value="m1s1i208">m1s1i208</option> 64 <option name="field" value="m1s1i209">m1s1i209</option> 65 <option name="field" value="m1s1i235">m1s1i235</option> 66 <option name="field" value="m1s3i463">m1s3i463</option> 67 <option name="field" value="olr">olr</option> 68 <option name="field" value="ps">ps</option> 69 <option name="field" value="snowdepth">snowdepth</option> 70 <option name="field" value="temp">temp</option> 71 <option name="field" value="x-wind">x-wind</option> 72 <option name="field" value="y-wind">y-wind</option> 73 </select> 74 Date: 75 <select name="date"> 76 <option name="date" value="1983-8-1T12:0:0.0Z">1983-8-1</option> 77 <option name="date" value="1983-8-2T12:0:0.0Z">1983-8-2</option> 78 <option name="date" value="1983-8-3T12:0:0.0Z">1983-8-3</option> 79 <option name="date" value="1983-8-4T12:0:0.0Z">1983-8-4</option> 80 <option name="date" value="1983-8-5T12:0:0.0Z">1983-8-5</option> 81 <option name="date" value="1983-8-6T12:0:0.0Z">1983-8-6</option> 82 <option name="date" value="1983-8-7T12:0:0.0Z">1983-8-7</option> 83 <option name="date" value="1983-8-8T12:0:0.0Z">1983-8-8</option> 84 <option name="date" value="1983-8-9T12:0:0.0Z">1983-8-9</option> 85 <option name="date" value="1983-8-10T12:0:0.0Z">1983-8-10</option> 86 <option name="date" value="1983-8-11T12:0:0.0Z">1983-8-11</option> 87 <option name="date" value="1983-8-12T12:0:0.0Z">1983-8-12</option> 88 <option name="date" value="1983-8-13T12:0:0.0Z">1983-8-13</option> 89 <option name="date" value="1983-8-14T12:0:0.0Z">1983-8-14</option> 90 <option name="date" value="1983-8-15T12:0:0.0Z">1983-8-15</option> 91 <option name="date" value="1983-8-16T12:0:0.0Z">1983-8-16</option> 92 <option name="date" value="1983-8-17T12:0:0.0Z">1983-8-17</option> 93 <option name="date" value="1983-8-18T12:0:0.0Z">1983-8-18</option> 94 <option name="date" value="1983-8-19T12:0:0.0Z">1983-8-19</option> 95 <option name="date" value="1983-8-20T12:0:0.0Z">1983-8-20</option> 96 <option name="date" value="1983-8-21T12:0:0.0Z">1983-8-21</option> 97 <option name="date" value="1983-8-22T12:0:0.0Z">1983-8-22</option> 98 <option name="date" value="1983-8-23T12:0:0.0Z">1983-8-23</option> 99 <option name="date" value="1983-8-24T12:0:0.0Z">1983-8-24</option> 100 <option name="date" value="1983-8-25T12:0:0.0Z">1983-8-25</option> 101 <option name="date" value="1983-8-26T12:0:0.0Z">1983-8-26</option> 102 <option name="date" value="1983-8-27T12:0:0.0Z">1983-8-27</option> 103 <option name="date" value="1983-8-28T12:0:0.0Z">1983-8-28</option> 104 <option name="date" value="1983-8-29T12:0:0.0Z">1983-8-29</option> 105 <option name="date" value="1983-8-30T12:0:0.0Z">1983-8-30</option> 106 </select> 107 </div> 101 108 </body> 102 109 </html> -
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public/js/ddc-vis.js
r2688 r2708 1 /** Top-level javascript file for the IPCC DDC visualisation application. 1 /** Top-level javascript file for the DDP visualisation application 2 3 Addapted from the IPCC DDC visualisation application. 2 4 3 5 @author Stephen Pascoe 4 6 */ 5 6 /** Load a JavaScript file7 @todo assumes <head> exists. Could be fixed8 */9 function loadScript(scriptPath, onload) {10 var head = document.getElementsByTagName('head')[0];11 script = document.createElement('script');12 script.type = 'text/javascript';13 script.src = scriptPath;14 script.onload = onload;15 script.onload = function() { console.log("loaded "+scriptPath); };16 head.appendChild(script);17 }18 /** Ensures a list of scripts are loaded in order.19 20 @warning this will not work if a script uses a different loading method to21 load sub-scripts. E.g. openlayers :-(.22 */23 function loadScripts(scripts) {24 var onload = function(i) {25 return function() {26 if (i<scripts.length) {27 loadScript(scripts[i], onload(i+1));28 }29 };30 }31 onload(0)();32 }33 7 34 8 … … 36 10 DDCVisApp.prototype = { 37 11 initialize: function(div, formDiv, selFormDiv, controlUri) { 38 this.control = new DdcVisControl(controlUri, formDiv); 39 this.control.onchange = this.updateDdcLayer.bindAsEventListener(this); 40 12 // Control not used in DDP demp 13 //this.control = new DdcVisControl(controlUri, formDiv); 14 //this.control.onchange = this.updateDdcLayer.bindAsEventListener(this); 15 16 // DDP-specific form wiring 17 this.formElement = $(formDiv).getElementsByTagName('form')[0] 18 this.formElement.onchange = this.updateDdcLayer.bindAsEventListener(this); 19 41 20 this.selFormDiv = $(selFormDiv); 42 21 this.figureCounter = 1 … … 46 25 // the current OpenLayers code. Instead calculate resolutions 47 26 // directly. 48 var numZoomLevels = 10;49 var maxResolution = 0. 5625;27 var numZoomLevels = 6; 28 var maxResolution = 0.03812; 50 29 var resolutions = new Array(); 51 30 for (var i=0; i < numZoomLevels; i++) { … … 53 32 } 54 33 55 this.map = new DDCVisMap(div, { //maxResolution: 0.5625, 56 //minResolution: 0.0088, 57 //numZoomLevels: 12, 58 resolutions: resolutions, 34 this.map = new DDCVisMap(div, { resolutions: resolutions, 59 35 controls: [] 60 36 }); … … 95 71 this.updateDdcLayer(); 96 72 this.coastLayer = null; 97 this._initCoast('coastline_01');98 73 // DDP will only use hires coastline 74 this._initCoast('coastline_02'); 99 75 100 76 this.map.addLayer(this.boxesLayer); 101 this.map.zoomToExtent(new OpenLayers.Bounds(-1 80,-90,180,90));77 this.map.zoomToExtent(new OpenLayers.Bounds(-16.5, 47.0, 4.5, 61.5)); 102 78 }, 103 79 … … 119 95 120 96 updateDdcLayer: function() { 121 this.control.agetWmsUri(this, this.updateDdcLayer_cb); 122 }, 97 //this.control.agetWmsUri(this, this.updateDdcLayer_cb); 98 99 field = this.formElement.field.value; 100 date = this.formElement.date.value; 101 102 if (this.ddcLayer) { 103 this.map.removeLayer(this.ddcLayer); 104 } 105 this.ddcLayer = new OpenLayers.Layer.WMS("DDP demo layer", 106 document.location+'wms?', 107 {format: 'image/png', 108 version: '1.3.0', CRS: 'CRS:84', 109 layers: field, 110 time: date 111 }); 112 this.ddcLayer.setZIndex(300); 113 this.map.addLayer(this.ddcLayer); 114 115 //this.loadLegend(); 116 }, 117 /* Not used in DDP demo 123 118 updateDdcLayer_cb: function(response) { 124 119 var url = response.responseText; … … 136 131 this.loadLegend(); 137 132 }, 138 133 */ 139 134 clearSubsel: function() { 140 135 this.subselControl.deactivateSubsel(); … … 193 188 this.selFormDiv.maxLat.value = b.top.toFixed(1); 194 189 195 // Switch to higerres coasts if needed 190 // Switch to hires coasts if needed 191 /* DDP will only use hires coastline 196 192 var coastLayer; 197 193 if (this.map.getZoom() > 5) { … … 204 200 this._initCoast(coastLayer); 205 201 } 206 }, 202 */ 203 }, 204 207 205 updateSelectionBox: function() { 208 206 var old_b = this.subselControl.getActiveBounds(); -
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public/js/openlayers-x.js
r2688 r2708 103 103 setCenter: function(center, zoom, dragging) { 104 104 105 //*TODO: turn these constants into configurable options 106 var min_lon = -16.5; //-180; 107 var max_lon = 4.5; //180; 108 var min_lat = 47.0; //-90; 109 var max_lat = 61.5; //90; 110 111 105 112 if (center == null) { 106 113 center = this.getCenter(); … … 120 127 center.lat + h_deg / 2); 121 128 122 if (bounds.left < -180.0) {123 center.lon = center.lon + ( -180.0- bounds.left);129 if (bounds.left < min_lon) { 130 center.lon = center.lon + (min_lon - bounds.left); 124 131 } 125 else if (bounds.right > 180.0) {126 center.lon = center.lon - (bounds.right - 180.0);132 else if (bounds.right > max_lon) { 133 center.lon = center.lon - (bounds.right - max_lon); 127 134 } 128 135 129 if (bounds.bottom < -90.0) {130 center.lat = center.lat + ( -90.0- bounds.bottom);136 if (bounds.bottom < min_lat) { 137 center.lat = center.lat + (min_lat - bounds.bottom); 131 138 } 132 else if (bounds.top > 90.0) {133 center.lat = center.lat - (bounds.top - 90.0);139 else if (bounds.top > max_lat) { 140 center.lat = center.lat - (bounds.top - max_lat); 134 141 } 135 142 -
TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public/test_openlayers.html
r2621 r2708 19 19 20 20 var csml_wms = new OpenLayers.Layer.WMS( "Test CSML layer", 21 "http:// saturn.badc.rl.ac.uk:8080/clim_10/wms?",22 {layers: ' SlRBzxwq',21 "http://localhost:8440/wms?", 22 {layers: 'temp', 23 23 CRS: 'CRS:84', format: 'image/png', version: '1.3.0', 24 styles: '', time: '19 35-01-15T00:00:00.0'24 styles: '', time: '1983-8-5T12:0:0.0Z' 25 25 }); 26 26 map.addLayers([//ol_wms,
Note: See TracChangeset
for help on using the changeset viewer.