Changeset 7001 for cows_wps


Ignore:
Timestamp:
13/06/10 20:20:13 (9 years ago)
Author:
astephen
Message:

bbox made to match openlayers in order of directions

Location:
cows_wps/trunk/cows_wps
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/process_handler/validate_arguments.py

    r6898 r7001  
    151151    """ 
    152152    Checks bbox is valid floats. 
     153    We use (west, south, east, north) because that is used in OpenLayers 
     154    and we should use only one ordering in the bounds. 
    153155    """ 
    154156    err_msg = "Invalid bounding box supplied: '%s'." % item 
     
    165167    # Must be physically valid 
    166168    phys_err = "Value of '%s' (%s) is out of range in bounding box supplied: '%s'."  
    167     directions = ("north", "west", "south", "east") 
    168     ranges = [(-90, 90), (-360, 360), (-90, 90), (-360, 360)] 
     169    directions = ("west", "south", "east", "north") 
     170    ranges = [(-360, 360), (-90, 90), (-360, 360), (-90, 90)] 
    169171    
    170172    for i in range(4): 
  • cows_wps/trunk/cows_wps/public/js/ui/init_bbox_input.js

    r6977 r7001  
    33*/ 
    44 
    5         var bboxSelect = null; 
     5        var bboxSelect = null; 
    66        var initial_extent = null; 
    77 
    8         function makeBoundsControl() { 
     8        function makeBoundsControl() { 
    99 
    10             var changeChk = document.getElementById('chk_changeBoundsControl'); 
     10            var changeChk = document.getElementById('chk_changeBoundsControl'); 
    1111 
    12             document.getElementById('bbox_hidden_input').value =""; 
    13             document.getElementById('bounds_control_container').innerHTML =""; 
    14             document.getElementById('map').innerHTML =""; 
    15             document.getElementById('bbox_show_val').innerHTML = ""; 
     12            document.getElementById('bbox_hidden_input').value =""; 
     13            document.getElementById('bounds_control_container').innerHTML =""; 
     14            document.getElementById('map').innerHTML =""; 
     15            document.getElementById('bbox_show_val').innerHTML = ""; 
    1616 
    17             if (bboxSelect !== null) { 
    18                 bboxSelect.dispose(); 
    19             } 
     17            if (bboxSelect !== null) { 
     18                bboxSelect.dispose(); 
     19            } 
    2020 
    21             var data = null; 
    22             var bboxHiddenInput = null; 
    23             var bboxShowValue = null; 
    24             var boundsMarkup = null; 
     21            var data = null; 
     22            var bboxHiddenInput = null; 
     23            var bboxShowValue = null; 
     24            var boundsMarkup = null; 
    2525 
    26             // have the bounds printed to the <span id="bbox_show_val"></span> 
    27             bboxShowValue = 'bbox_show_val'; 
    28             bboxHiddenInput = 'bbox_hidden_input'; 
    29             data = baseLayerData 
     26            // have the bounds printed to the <span id="bbox_show_val"></span> 
     27            bboxShowValue = 'bbox_show_val'; 
     28            bboxHiddenInput = 'bbox_hidden_input'; 
     29            data = baseLayerData 
    3030 
    31             bboxSelect = new BoundingBoxMapSelect('map', 'bounds_control_container', data, 
    32                               bboxHiddenInput, bboxShowValue, boundsMarkup); 
    33         } 
     31            bboxSelect = new BoundingBoxMapSelect('map', 'bounds_control_container', data, 
     32                              bboxHiddenInput, bboxShowValue, boundsMarkup); 
     33        } 
    3434 
    3535        function init() { 
     
    4242 
    4343                if (ext != null) { 
    44 /*                      $("#_bboxN").val(ext[0]); 
    45                         $("#_bboxW").val(ext[1]); 
    46                         $("#_bboxS").val(ext[2]); 
    47                         $("#_bboxE").val(ext[3]); 
    48 */ 
    49                         var new_bbox = new OpenLayers.Bounds(ext[1], ext[2], ext[3], ext[0]); 
     44                        var new_bbox = new OpenLayers.Bounds(ext[0], ext[1], ext[2], ext[3]); 
    5045                        $("#_bboxE").click();   
    5146                        $("#_bboxS").click(); 
     
    5550                        var bbox_visible = ext.toString(); 
    5651                        $("#bbox_show_val").html(bbox_visible); 
    57             var bbox_to_send = bbox_visible.replace(/,/g, "|"); 
     52                        var bbox_to_send = bbox_visible.replace(/,/g, "|"); 
    5853                        $("#bbox_hidden_input").val(bbox_to_send); 
    5954                } 
  • cows_wps/trunk/cows_wps/public/js/ui/validate.js

    r7000 r7001  
    5959*/ 
    6060function checkValidBBox(bbox) { 
    61         // Assume bbox defined as (north, west, south, east) 
    62         if (bbox[0] < bbox[2]) { 
    63                 return false; 
    64         } else if ((bbox[0] > 90) || (bbox[2] < -90)) { 
    65                 return false; 
    66         } else if ((bbox[1] < -360) || (bbox[1] > 360)) { 
    67                 return false; 
    68         } else if ((bbox[3] < -360) || (bbox[3] > 360)) { 
     61        // Assume bbox defined as (west, south, east, north) 
     62        if (bbox[3] < bbox[1]) { 
     63                return false; 
     64        } else if ((bbox[3] > 90) || (bbox[1] < -90)) { 
     65                return false; 
     66        } else if ((bbox[0] < -360) || (bbox[0] > 360)) { 
     67                return false; 
     68        } else if ((bbox[2] < -360) || (bbox[2] > 360)) { 
    6969                return false; 
    7070        } 
     
    8383*/ 
    8484function bboxesOverlap(bbox1, bbox2) { 
     85        // Assume bbox defined as (west, south, east, north) 
    8586        var bboxes = [bbox1, bbox2]; 
    8687        for (var i = 0; i < 2; i++) { 
     
    9495        if ((bbox1[2] >= bbox2[0]) || (bbox1[0] >= bbox2[2])) { 
    9596                return false; 
    96         } else if ((bbox1[3] >= bbox2[1]) || (bbox1[1] >= bbox2[3])) { 
     97        } else if ((bbox1[1] >= bbox2[3]) || (bbox1[1] >= bbox2[3])) { 
    9798                return false; 
    9899        } 
     
    132133function validateBoundingBoxInput(input, valid_bbox, msg) { 
    133134        // Takes in input which comes as 'bbox_hidden_input' string delmited by '|' 
    134         // which represents (west|east|south|north) 
     135        // which represents (west, south, east, north) 
    135136        // Checks domain is within spec_arg domain 
    136137        return true; 
  • cows_wps/trunk/cows_wps/renderer/form_renderer.py

    r7000 r7001  
    9999        return html 
    100100 
     101    def OLDrenderBBox(self, name, extent="90|-180|-90|180"): 
     102        """ 
     103        Renders a bounding box and N/W/S/E/ selectors. 
     104        """ 
     105        if extent == False: extent = "90|-180|-90|180" 
     106 
     107        (n, w, s, e) = extent.split("|") 
     108 
     109        html = """      <label for="_north">North:</label> <input type="text" id="_north" name="_north" value="%s" onChange="updateBBox('%s');" /><br> 
     110        <label for="_west">West:</label> <input type="text" id="_west" name="_west" value="%s" onChange="updateBBox('%s');" /><br> 
     111        <label for="_south">South:</label> <input type="text" id="_south" name="_south" value="%s" onChange="updateBBox('%s');" /><br> 
     112        <label for="_east">East:</label> <input type="text" id="_east" name="_east" value="%s" onChange="updateBBox('%s');" /><br> 
     113        <input type="hidden" id="%s" name="%s" value="%s" /> 
     114        """ % (n, name, w, name, s, name, e, name, name, name, extent) 
     115 
     116        return html 
     117 
    101118 
    102119    def renderBBox(self, name, extent): 
    103120        """ 
    104121        Renders a bounding box and N/W/S/E selectors. 
    105         ``extent`` is received as a string of "west|south|east|north". 
     122        ``extent`` is received as a string of "north|west|south|east". 
    106123        """ 
    107124        if extent == False: extent = "90|-180|-90|180" 
     
    117134            <script type="text/javascript"> 
    118135                var initial_extent = [%s, %s, %s, %s]; 
    119                 addValidator('bbox_hidden_input', 'bounding_box', '%s', 'Your selected spatial bounding box must overlap with the available extent of: (%s) as ("north|west|south|east").', false); 
     136                addValidator('%s', 'bounding_box', extent, 'Your selected spatial bounding box must overlap with the available extent of: (%s) as ("north|west|south|east").', false); 
    120137            </script> 
    121138        </div> 
    122         """ % (name, n, w, s, e, extent, extent) 
    123  
     139        """ % (name, n, w, s, e, name, extent) 
    124140        return html      
    125141 
Note: See TracChangeset for help on using the changeset viewer.