Changeset 2708


Ignore:
Timestamp:
04/07/07 22:05:23 (12 years ago)
Author:
spascoe
Message:

WMS works on test dataset. Lots of stuff is hard-coded for the moment.

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"> 
    31<html> 
    42<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"/> 
    86 
    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> 
    209 
    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"> 
     13var tabberOptions = {manualStartup: true}; 
     14</script> 
     15<script src="js/tabber.js"></script> 
     16 
     17<script type="text/javascript"> 
     18 
     19var app = null; 
     20 
     21function init() { 
     22  // 4th argument isn't used in DDP 
     23  app = new DDCVisApp('map', 'form', 'selectionForm', ''); 
     24} 
     25 
     26</script> 
     27 
    2528</head> 
    26 <body> 
     29<body onload="init()"> 
     30<h1>DDP Visualisation</h1> 
    2731 
    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> 
    2956 
    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 &lt;h2&gt; 
    73 Server info for &lt;% request.host %&gt; 
    74 &lt;/h2&gt; 
    75  
    76 &lt;p&gt; 
    77 The URL you called: &lt;% h.url_for() %&gt; 
    78 &lt;/p&gt; 
    79  
    80 &lt;p&gt; 
    81 The name you set: &lt;% c.name %&gt; 
    82 &lt;/p&gt; 
    83  
    84 &lt;p&gt;The server environment:&lt;br /&gt; 
    85 &lt;pre&gt;&lt;% c.pretty_environ %&gt;&lt;/pre&gt; 
    86 &lt;/p&gt; 
    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> 
    101108</body> 
    102109</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. 
    24 
    35    @author Stephen Pascoe 
    46*/ 
    5  
    6 /** Load a JavaScript file 
    7     @todo assumes <head> exists.  Could be fixed 
    8 */ 
    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 to 
    21              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 } 
    337 
    348 
     
    3610DDCVisApp.prototype = { 
    3711    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 
    4120        this.selFormDiv = $(selFormDiv); 
    4221        this.figureCounter = 1 
     
    4625        // the current OpenLayers code.  Instead calculate resolutions 
    4726        // directly. 
    48         var numZoomLevels = 10; 
    49         var maxResolution = 0.5625; 
     27        var numZoomLevels = 6; 
     28        var maxResolution = 0.03812; 
    5029        var resolutions = new Array(); 
    5130        for (var i=0; i < numZoomLevels; i++) { 
     
    5332        } 
    5433 
    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, 
    5935                                        controls: [] 
    6036                                }); 
     
    9571        this.updateDdcLayer(); 
    9672        this.coastLayer = null; 
    97         this._initCoast('coastline_01'); 
    98  
     73        // DDP will only use hires coastline 
     74        this._initCoast('coastline_02'); 
    9975 
    10076        this.map.addLayer(this.boxesLayer); 
    101         this.map.zoomToExtent(new OpenLayers.Bounds(-180,-90,180,90));   
     77        this.map.zoomToExtent(new OpenLayers.Bounds(-16.5, 47.0, 4.5, 61.5));    
    10278    }, 
    10379 
     
    11995 
    12096    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 
    123118    updateDdcLayer_cb: function(response) { 
    124119        var url = response.responseText; 
     
    136131        this.loadLegend(); 
    137132    }, 
    138  
     133    */ 
    139134    clearSubsel: function() { 
    140135        this.subselControl.deactivateSubsel(); 
     
    193188        this.selFormDiv.maxLat.value = b.top.toFixed(1); 
    194189 
    195         // Switch to higerres coasts if needed 
     190        // Switch to hires coasts if needed 
     191        /* DDP will only use hires coastline 
    196192        var coastLayer; 
    197193        if (this.map.getZoom() > 5) { 
     
    204200            this._initCoast(coastLayer); 
    205201        } 
    206     }, 
     202        */ 
     203    }, 
     204 
    207205    updateSelectionBox: function() { 
    208206        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  
    103103    setCenter: function(center, zoom, dragging) { 
    104104 
     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 
    105112        if (center == null) { 
    106113            center = this.getCenter(); 
     
    120127                                           center.lat + h_deg / 2); 
    121128 
    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); 
    124131        } 
    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); 
    127134        } 
    128135 
    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); 
    131138        } 
    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); 
    134141        } 
    135142 
  • TI05-delivery/ows_framework/branches/ows_framework-ddp/ows_server/ows_server/public/test_openlayers.html

    r2621 r2708  
    1919 
    2020            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', 
    2323                 CRS: 'CRS:84', format: 'image/png', version: '1.3.0', 
    24                  styles: '', time: '1935-01-15T00:00:00.0' 
     24                 styles: '', time: '1983-8-5T12:0:0.0Z' 
    2525                 }); 
    2626            map.addLayers([//ol_wms,  
Note: See TracChangeset for help on using the changeset viewer.