Changeset 2768 for TI05-delivery


Ignore:
Timestamp:
07/08/07 11:51:08 (12 years ago)
Author:
domlowe
Message:

Visual changes to map box for ticket:836.

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server/public
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/js/OLMapBox.js

    r2759 r2768  
    1010OLMapBoxApp = OpenLayers.Class.create(); 
    1111OLMapBoxApp.prototype = { 
    12     initialize: function(div, selFormDiv) { 
    13         this.selFormDiv = $(selFormDiv); 
     12    initialize: function(mapDivId, selectionFormId, mapWidth, numZoomLevels) { 
     13 
     14        this.selectionForm = $(selectionFormId); 
     15        console.log(this.getSelectionFormBounds()); 
     16 
     17        this.globalBounds = new OpenLayers.Bounds(-180,-90,180,90); 
    1418 
    1519        // This is taken from Layer.js with slight alterations.  One 
     
    1721        // the current OpenLayers code.  Instead calculate resolutions 
    1822        // directly. 
    19         var numZoomLevels = 10; 
    20         var maxResolution = 0.5625; 
     23        var maxResolution = 360.0 / mapWidth; 
    2124        var resolutions = new Array(); 
    2225        for (var i=0; i < numZoomLevels; i++) { 
     
    2427        } 
    2528 
    26         this.map = new DDCVisMap(div, { //maxResolution: 0.5625, 
    27                                         //minResolution: 0.0088, 
    28                                         //numZoomLevels: 12, 
    29                                         resolutions: resolutions, 
    30                                         controls: [] 
    31                                 }); 
     29        this.map = new DDCVisMap(mapDivId, { resolutions: resolutions, 
     30                                             controls: [] 
     31                                           }); 
    3232 
    3333        this.boxesLayer = new OpenLayers.Layer.Boxes("Sub-selection"); 
    34         this.subselControl = new SubSelectionMouseToolbar(new OpenLayers.Pixel(5,240), 
     34        this.subselControl = new SubSelectionMouseToolbar(new OpenLayers.Pixel(mapWidth-40,10), 
    3535                                                   'vertical', this.boxesLayer); 
    36  
    3736        this.map.events.register('moveend', this, this.updateSelectionForm); 
    3837        this.map.events.register('zoomend', this, this.updateSelectionForm); 
    39         for (var i=0; i < this.selFormDiv.elements.length; i++) { 
    40             this.selFormDiv.elements[i].onchange = this.updateSelectionBox.bindAsEventListener(this);   } 
     38 
     39 
     40        for (var i=0; i < this.selectionForm.elements.length; i++) { 
     41            this.selectionForm.elements[i].onchange = this.updateSelectionBox.bindAsEventListener(this);        } 
    4142 
    4243        this.map.addControl(new OpenLayers.Control.PanZoomBar()); 
     
    5354        this.map.addLayer(this.ddcLayer); 
    5455        this.map.addLayer(this.boxesLayer); 
    55         this.map.zoomToExtent(new OpenLayers.Bounds(-180,-90,180,90));   
     56 
     57        // Set the selection box if the form bounds aren't global. 
     58        var bounds = this.getSelectionFormBounds(); 
     59        if (bounds.equals(this.globalBounds)) { 
     60            this.map.zoomToExtent(this.globalBounds);    
     61        } 
     62        else { 
     63            this.updateSelectionBox(null, bounds); 
     64        } 
     65 
     66        // Enter selection mode 
     67        this.subselControl.switchModeTo('zoombox'); 
     68 
    5669    }, 
    5770 
    5871    clearSubsel: function() { 
    5972        this.subselControl.deactivateSubsel(); 
     73        this.map.zoomToExtent(new OpenLayers.Bounds(-180,-90,180,90)); 
    6074        this.updateSelectionForm(); 
     75    }, 
     76 
     77    getSelectionFormBounds: function() { 
     78        return new OpenLayers.Bounds( 
     79            Number(this.selectionForm.bboxW.value), 
     80            Number(this.selectionForm.bboxS.value), 
     81            Number(this.selectionForm.bboxE.value), 
     82            Number(this.selectionForm.bboxN.value)); 
    6183    }, 
    6284 
    6385    updateSelectionForm: function() { 
    6486        var b = this.subselControl.getActiveBounds(); 
    65         this.selFormDiv.bboxW.value = b.left.toFixed(1); 
    66         this.selFormDiv.bboxS.value = b.bottom.toFixed(1); 
    67         this.selFormDiv.bboxE.value = b.right.toFixed(1); 
    68         this.selFormDiv.bboxN.value = b.top.toFixed(1); 
     87        this.selectionForm.bboxW.value = b.left.toFixed(1); 
     88        this.selectionForm.bboxS.value = b.bottom.toFixed(1); 
     89        this.selectionForm.bboxE.value = b.right.toFixed(1); 
     90        this.selectionForm.bboxN.value = b.top.toFixed(1); 
    6991    }, 
    70     updateSelectionBox: function() { 
     92    updateSelectionBox: function(evt, new_b) { 
     93        if (!new_b) { 
     94            new_b = this.getSelectionFormBounds(); 
     95        } 
    7196        var old_b = this.subselControl.getActiveBounds(); 
    72         var new_b = new OpenLayers.Bounds( 
    73             Number(this.selFormDiv.bboxW.value), 
    74             Number(this.selFormDiv.bboxS.value), 
    75             Number(this.selFormDiv.bboxE.value), 
    76             Number(this.selFormDiv.bboxN.value)); 
    7797         
    7898        // Validation.  negative tests required to catch NaN 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/public/layout/ndg2.css

    r2760 r2768  
    112112.cellhead { font-size: 100%; font-weight: bold;}  
    113113 
    114 #map {width:400px; height:300px; border: 1px solid black;} 
     114#map {width:440px; height:220px; border: 1px solid black;} 
    115115/* .map {width:300px;height:250px;border:0;padding:0;margin:0;overflow:hidden;}*/ 
    116116/* NumSim */ 
Note: See TracChangeset for help on using the changeset viewer.