OpenLayers OpenLayers

Changeset 1369

Show
Ignore:
Timestamp:
08/25/06 14:17:06 (2 years ago)
Author:
crschmidt
Message:

Merge 2.0 branch to trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/build/docs.sh

    r1270 r1369  
    33rm ../doc/reference.html 
    44CLASSES="Map Layer Layer.HTTPRequest Layer.Grid Layer.WMS Layer.KaMap Layer.EventPane Layer.Google Layer.VirtualEarth Layer.Markers Layer.Text Layer.GeoRSS Layer.Boxes Icon Marker Marker.Box Tile Tile.Image Tile.WFS Control Control.LayerSwitcher Control.MouseDefaults Control.MouseToolbar Control.PanZoom Control.PanZoomBar Control.Permalink Control.Scale LonLat Size Pixel Bounds" 
    5 echo "<html><head><title>OpenLayers Class Reference Documentation</title><style type='text/css'> .type { background-color: #ddd } td { border: black solid 1px; padding: 3px;  } table { border-collapse: collapse; margin: 5px 10px; } .classref { margin-left: 20px; } 
    6 div.index { float:left;  width: 300px; } 
    7 </style></head><body>" >> ../doc/reference.html 
     5echo "<html> 
     6  <head> 
     7    <title>OpenLayers Class Reference Documentation</title> 
     8    <style type='text/css'>  
     9        .type { background-color: #ddd }  
     10        td { border: black solid 1px; padding: 3px;  }  
     11        table { border-collapse: collapse; margin: 5px 10px; }  
     12        .classref { margin-left: 20px; } 
     13        div.index { float:left;  width: 300px; } 
     14    </style> 
     15  </head> 
     16  <body>" >> ../doc/reference.html 
    817 
    918for i in $CLASSES; do 
     
    1524for i in $CLASSES; do 
    1625cat ../doc/$i.txt | \ 
    17 perl -pe 's!^(.*?) -- (.*?) -- (.*?)$!  <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g' | \ 
    18 perl -pe 's!^(  \* )?(.*?) -- (.*?)$!  <tr><td>$2</td><td>$3</td></tr>!g' | \ 
    19 perl -pe 's!^  \* (.*)$!  </table>\n\n<h3>$1</h3>\n  <table>!' | \ 
    20 perl -pe 's!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g' | \ 
    21 perl -pe 's!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!' | \ 
    22 perl -pe 's!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g' | \ 
    23 perl -pe 's!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g' | \ 
    24 perl -pe 's!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!' | \ 
    25 perl -pe 's!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \ 
     26perl -pe 's!^(.*?) -- (.*?) -- (.*?)$!  <tr><td>$1</td><td>$2</td><td>$3</td></tr>!g;  
     27  s!^(  \* )?(.*?) -- (.*?)$!  <tr><td>$2</td><td>$3</td></tr>!g; 
     28  s!^  \* (.*)$!  </table>\n\n<h3>$1</h3>\n  <table>!; 
     29  s!{OpenLayers.(.*?)\|(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">\2</a>!g; 
     30  s!{OpenLayers.(.*?)}!<a href="#OpenLayers.$1" title="OpenLayers.$1">OpenLayers.$1</a>!; 
     31  s!{([A-Za-z]+?)\|(.+?)}!<span class="type" title="$1">\2<\/span>!g; 
     32  s!{([A-Za-z]+?)}!<span class="type" title="$1">$1<\/span>!g; 
     33  s!^\* (.*)$!</table>\n<h2>$1</h2>\n<table>!; 
     34  s!^OpenLayers\.(.*)$!<h1><a name="OpenLayers.$1">OpenLayers.$1</a></h1><div class="classref">!' \ 
    2635>> ../doc/reference.html  
    2736echo '</table></div>' >> ../doc/reference.html 
    2837done 
    29 echo "</body></html>" >> ../doc/reference.html 
     38echo "  </body> 
     39</html>" >> ../doc/reference.html 
  • trunk/openlayers/doc/Control.Permalink.txt

    r1247 r1369  
    11OpenLayers.Control.Permalink 
    22 
    3 A small control which updates a "Permalink" to the map every time the viewport changes. This allows users to copy a link to a specfic map view. By default, it places itself in the lower right corner of the map,  
     3A small control which updates a "Permalink" to the map every time the viewport changes. This allows users to copy a link to a specfic map view. By default, it places itself in the lower right corner of the map. This control must be added to the map after a baselayer has been set.  
    44 
    55* Constructor 
  • trunk/openlayers/doc/Layer.GeoRSS.txt

    r1265 r1369  
    11OpenLayers.Layer.GeoRSS 
    22 
    3 GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. 
     3GeoRSS layer. Pass a name and location of a GeoRSS file on the web, and a marker will be added to the map for each item in the GeoRSS feed. Uses OpenLayers.loadURL to load the XML, parses the data, and adds markers to the map. The GeoRSS layer supports 1.0 and 2.0 in IE and Firefox, and supports 2.0 in Safari. (Ticket #111 explains the reason for this difference.) 
     4 
    45 
    56* Constructor 
  • trunk/openlayers/doc/Layer.WMS.txt

    r1261 r1369  
    11OpenLayers.Layer.WMS 
    22 
    3 The WMS layer allows one to connect to a WMS server to obtain images. 
     3The WMS layer allows one to connect to a WMS server to obtain images. Params are available as a hash on the layer object, however, all keys are upper-cased automatically for maximum compatibility with WMS servers, so a parameter which is set as 'layers' will be uppercased to LAYERS. Where 'layer' is your Javscript variable for the layer, layer.params.LAYERS is the value of the layers param as set by the constructor. 
     4 
     5If you wish to change params, you should use mergeNewParams, rather than accessing the parameters directly. 
    46 
    57* Constructor 
     
    1012  All other methods are inherited from {OpenLayers.Layer.Grid} 
    1113   
    12 * Parameters  
     14* Options  
    1315  isBaseLayer -- WMS layers default to being base layers unless one of their parameters is 'transparent':'true'. 
  • trunk/openlayers/examples/google.html

    r1243 r1369  
    2424 
    2525        function init(){ 
    26             map = new OpenLayers.Map( $('map') ); 
     26            map = new OpenLayers.Map( $('map') ,  
     27            { controls: [new OpenLayers.Control.MouseDefaults()] }); 
    2728 
    28             var normal = new OpenLayers.Layer.Google( "Google" ); 
     29            var normal = new OpenLayers.Layer.Google( "Google", // ); 
     30             { minZoomLevel: 3, maxZoomLevel: 8  }); 
    2931            var satellite = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP }); 
    3032            var hybrid = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_MAP }); 
    3133 
    3234 
    33             map.addLayers([normal, satellite, hybrid]); 
     35            map.addLayers([satellite, normal, hybrid]); 
    3436 
    3537            markers = new OpenLayers.Layer.Markers("markers"); 
     
    3840            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 
    3941            map.addControl( new OpenLayers.Control.LayerSwitcher() ); 
     42            map.addControl( new OpenLayers.Control.PanZoomBar() ); 
    4043 
    4144        } 
  • trunk/openlayers/examples/kamap.html

    r1244 r1369  
    1919 
    2020            var jpl_wms = new OpenLayers.Layer.KaMap( "Satellite", 
    21                     "/world/index.php", {g: "satellite", map: "world"}); 
     21                    "http://www.openlayers.org/world/index.php", {g: "satellite", map: "world"}); 
    2222            var dm_wms = new OpenLayers.Layer.WMS( "Canada", 
    2323                "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap", 
  • trunk/openlayers/examples/tiger.html

    r822 r1369  
    1515 
    1616            var ka_wms = new OpenLayers.Layer.KaMap( "TIGER (KaMap)",  
    17                 "http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' }, 'degrees', 72 ); 
     17                "http://boston.freemap.in/tile.php" , { map: 'tiger', layers: 'TIGER' }); 
    1818            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", 
    1919                "http://wms.jpl.nasa.gov/wms.cgi",  
    2020                {layers: "modis,global_mosaic"}); 
    2121            jpl_wms.setVisibility(false); 
     22            ka_wms.isBaseLayer = false; 
    2223            map.addLayers([jpl_wms,ka_wms]);  
    2324            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
  • trunk/openlayers/examples/urban.html

    r697 r1369  
    1212        <!-- 
    1313        function init(){ 
    14             var map = new OpenLayers.Map('map', {'maxResolution': 1.6, maxZoomLevel:20}); 
    15  
     14            var mapOptions = { maxResolution: 1.6, numZoomLevels: 21}; 
     15            var map = new OpenLayers.Map('map', mapOptions); 
     16             
    1617            var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
    1718                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} ); 
     
    1920            var ww = new OpenLayers.Layer.WorldWind( "Urban",  
    2021                "http://worldwind25.arc.nasa.gov/tile/tile.aspx?", .8, 9, 
    21                 {T:"104"}); 
    22             ww.setTileSize(new OpenLayers.Size(512,512)); 
     22                {T:"104"}, { tileSize: new OpenLayers.Size(512,512) }); 
    2323 
    2424 
  • trunk/openlayers/examples/ve.html

    r1242 r1369  
    1919        var lon = 5; 
    2020        var lat = 40; 
    21         var zoom = 5; 
     21        var zoom = 15; 
    2222        var map, velayer, layer; 
    2323 
    2424        function init(){ 
    25             map = new OpenLayers.Map( $('map') ); 
     25            map = new OpenLayers.Map( $('map') ,  
     26            {controls:[new OpenLayers.Control.MouseDefaults()]}); 
    2627 
    27             velayer = new OpenLayers.Layer.VirtualEarth( "VE");  
     28            velayer = new OpenLayers.Layer.VirtualEarth( "VE", 
     29            { minZoomLevel: 4, maxZoomLevel: 6 });  
    2830            map.addLayer(velayer); 
    2931             
     
    3133            map.addLayer(markers); 
    3234 
    33             map.setCenter(new OpenLayers.LonLat(lon, lat), 2); 
     35            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom); 
    3436            map.addControl( new OpenLayers.Control.LayerSwitcher() ); 
     37            map.addControl( new OpenLayers.Control.PanZoomBar() ); 
    3538        } 
    3639         
  • trunk/openlayers/examples/wmst.html

    r844 r1369  
    3636    <h1>OpenLayers Example</h1> 
    3737    <p>WMS-T example: update the times, and the radar image will change. Uses Layer.changeParams. Thanks to David Bitner for the inspiration, the original code, and the kick in the butt!</p> 
    38     <input type='text' id='time'  value="2005-08-29T13:00:00Z" onChange='ia_wms.changeParams({"time":this.value});' > 
     38    <input type='text' id='time'  value="2005-08-29T13:00:00Z" onChange='ia_wms.mergeNewParams({"time":this.value});' > 
    3939    <div id="map"></div> 
    4040  </body> 
  • trunk/openlayers/lib/OpenLayers/BaseTypes.js

    r1228 r1369  
    421421    */ 
    422422    add:function(x, y){ 
    423         return new OpenLayers.Box(this.left + x, this.bottom + y, 
    424                                   this.right + x, this.top + y); 
     423        return new OpenLayers.Bounds(this.left + x, this.bottom + y, 
     424                                     this.right + x, this.top + y); 
    425425    }, 
    426426 
  • trunk/openlayers/lib/OpenLayers/Control/LayerSwitcher.js

    r1206 r1369  
    120120            inputElem.value = layer.name; 
    121121            inputElem.checked = checked; 
     122            inputElem.defaultChecked = checked; 
    122123            inputElem.layer = layer; 
     124            inputElem.control = this; 
     125            Event.observe(inputElem, "mouseup",  
     126                          this.onInputClick.bindAsEventListener(inputElem)); 
    123127             
    124128            // create span 
     
    126130            labelSpan.innerHTML = layer.name; 
    127131            labelSpan.style.verticalAlign = (baseLayer) ? "bottom" : "auto"; 
    128             Event.observe(labelSpan,  
    129                           "click",  
    130                           this.onLabelClick.bindAsEventListener(inputElem)); 
    131  
     132            Event.observe(labelSpan, "click",  
     133                          this.onInputClick.bindAsEventListener(inputElem)); 
    132134            // create line break 
    133135            var br = document.createElement("br"); 
     
    159161     * @param {Event} e 
    160162     */ 
    161     onLabelClick: function(e) { 
    162         var clickedRadioButton = ((this.type == "radio") && (this.checked)); 
    163         if (!clickedRadioButton) { 
     163 
     164    onInputClick: function(e) { 
     165        if (this.type == "radio") { 
     166            this.checked = true; 
     167            this.layer.map.setBaseLayer(this.layer, true); 
     168            this.layer.map.events.triggerEvent("changebaselayer"); 
     169        } else { 
    164170            this.checked = !this.checked; 
    165         } 
     171            this.control.updateMap(); 
     172        } 
     173        Event.stop(e); 
    166174    }, 
    167175     
     
    190198            var input = this.baseLayerInputs[i];    
    191199            if (input.checked) { 
    192                 this.map.setBaseLayer(input.layer, true); 
     200                this.map.setBaseLayer(input.layer, false); 
    193201            } 
    194202        } 
     
    272280        Event.observe(this.div, "mouseup",  
    273281                      this.mouseUp.bindAsEventListener(this)); 
     282        Event.observe(this.div, "click", 
     283                      this.ignoreEvent); 
    274284        Event.observe(this.div, "mousedown", 
    275285                      this.mouseDown.bindAsEventListener(this)); 
     
    302312        this.baseLayersDiv = document.createElement("div"); 
    303313        this.baseLayersDiv.style.paddingLeft = "10px"; 
    304         Event.observe(this.baseLayersDiv, "click",  
     314        /*Event.observe(this.baseLayersDiv, "click",  
    305315                      this.onLayerClick.bindAsEventListener(this)); 
     316        */ 
    306317        this.layersDiv.appendChild(this.baseLayersDiv); 
    307318                      
     
    316327        this.dataLayersDiv = document.createElement("div"); 
    317328        this.dataLayersDiv.style.paddingLeft = "10px"; 
    318         Event.observe(this.dataLayersDiv, "click",  
     329        /*Event.observe(this.dataLayersDiv, "click",  
    319330                      this.onLayerClick.bindAsEventListener(this)); 
     331        */ 
    320332        this.layersDiv.appendChild(this.dataLayersDiv); 
    321333 
  • trunk/openlayers/lib/OpenLayers/Control/MouseDefaults.js

    r1248 r1369  
    6161        this.map.setCenter(newCenter, this.map.zoom + 1); 
    6262        Event.stop(evt); 
     63        return false; 
    6364    }, 
    6465 
     
    8182            this.zoomBox.style.filter = "alpha(opacity=50)"; // IE 
    8283            this.zoomBox.style.opacity = "0.50"; 
     84            this.zoomBox.style.fontSize = "1px"; 
    8385            this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; 
    8486            this.map.viewPortDiv.appendChild(this.zoomBox); 
     
    9698                var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); 
    9799                var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); 
    98                 this.zoomBox.style.width = deltaX+"px"; 
    99                 this.zoomBox.style.height = deltaY+"px"; 
     100                this.zoomBox.style.width = Math.max(1, deltaX) + "px"; 
     101                this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 
    100102                if (evt.xy.x < this.mouseDragStart.x) { 
    101103                    this.zoomBox.style.left = evt.xy.x+"px"; 
     
    125127        if (!Event.isLeftClick(evt)) return; 
    126128        if (this.zoomBox) { 
    127             var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );  
    128             var end = this.map.getLonLatFromViewPortPx( evt.xy ); 
    129             var top = Math.max(start.lat, end.lat); 
    130             var bottom = Math.min(start.lat, end.lat); 
    131             var left = Math.min(start.lon, end.lon); 
    132             var right = Math.max(start.lon, end.lon); 
    133             var bounds = new OpenLayers.Bounds(left, bottom, right, top); 
    134             var zoom = this.map.getZoomForExtent(bounds); 
    135             this.map.setCenter(new OpenLayers.LonLat( 
    136               (start.lon + end.lon) / 2, 
    137               (start.lat + end.lat) / 2 
    138              ), zoom); 
    139             this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 
    140             this.zoomBox = null; 
     129            this.zoomBoxEnd(evt);     
    141130        } else { 
    142131            if (this.performedDrag) { 
     
    172161    defaultWheelDown: function()  { 
    173162        this.map.zoomOut(); 
     163    }, 
     164 
     165    /** Zoombox function.  
     166     * 
     167     */ 
     168    zoomBoxEnd: function(evt) { 
     169        if (this.mouseDragStart != null) { 
     170            if (Math.abs(this.mouseDragStart.x - evt.xy.x) > 5 ||     
     171                Math.abs(this.mouseDragStart.y - evt.xy.y) > 5) {    
     172                var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );  
     173                var end = this.map.getLonLatFromViewPortPx( evt.xy ); 
     174                var top = Math.max(start.lat, end.lat); 
     175                var bottom = Math.min(start.lat, end.lat); 
     176                var left = Math.min(start.lon, end.lon); 
     177                var right = Math.max(start.lon, end.lon); 
     178                var bounds = new OpenLayers.Bounds(left, bottom, right, top); 
     179                var zoom = this.map.getZoomForExtent(bounds); 
     180                this.map.setCenter(new OpenLayers.LonLat( 
     181                  (start.lon + end.lon) / 2, 
     182                  (start.lat + end.lat) / 2 
     183                 ), zoom); 
     184            } else { 
     185                var end = this.map.getLonLatFromViewPortPx( evt.xy ); 
     186                this.map.setCenter(new OpenLayers.LonLat( 
     187                  (end.lon), 
     188                  (end.lat) 
     189                 ), this.map.getZoom() + 1); 
     190            }     
     191            this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 
     192            this.zoomBox = null; 
     193       }      
    174194    }, 
    175195 
     
    190210        var elem = Event.element(e); 
    191211        while(elem != null) { 
    192             if (elem == this.map.div) { 
     212            if (this.map && elem == this.map.div) { 
    193213                inMap = true; 
    194214                break; 
  • trunk/openlayers/lib/OpenLayers/Control/MouseToolbar.js

    r1206 r1369  
    77 *  
    88 * @requires OpenLayers/Control.js 
     9 * @requires OpenLayers/Control/MouseDefaults.js 
    910 */ 
    1011OpenLayers.Control.MouseToolbar = Class.create(); 
     
    1213OpenLayers.Control.MouseToolbar.Y = 300; 
    1314OpenLayers.Control.MouseToolbar.prototype =  
    14   Object.extend( new OpenLayers.Control(), { 
     15  Object.extend( new OpenLayers.Control(),  
     16    Object.extend( new OpenLayers.Control.MouseDefaults(), { 
    1517     
    1618    mode: null, 
     
    3638        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    3739        this.buttons = new Object(); 
     40        this.map.events.register( "click", this, this.defaultClick ); 
    3841        this.map.events.register( "dblclick", this, this.defaultDblClick ); 
    3942        this.map.events.register( "mousedown", this, this.defaultMouseDown ); 
     
    4750        this._addButton("pan", "panning-hand-off.png", "panning-hand-on.png", centered, sz, "Drag the map to pan."); 
    4851        centered = centered.add((this.direction == "vertical" ? 0 : sz.w), (this.direction == "vertical" ? sz.h : 0)); 
    49         this._addButton("measure", "measuring-stick-off.png", "measuring-stick-on.png", centered, sz, "Hold alt when clicking to show distance between selected points"); 
    5052        this.switchModeTo("pan"); 
    51         this.map.events.register("zoomend", this, function() { this.switchModeTo("pan"); }); 
    5253        return this.div; 
    5354         
     
    7071        btn.events.register("mousedown", this, this.buttonClick);  
    7172        btn.events.register("mouseup", this, Event.stop); 
     73        btn.events.register("click", this, Event.stop); 
    7274        btn.action = id; 
    7375        btn.title = title; 
     
    9496        var newCenter = this.map.getLonLatFromViewPortPx( evt.xy );  
    9597        this.map.setCenter(newCenter, this.map.zoom + 2); 
     98        Event.stop(evt); 
     99        return false; 
    96100    }, 
    97101 
     
    103107        this.mouseDragStart = evt.xy.clone(); 
    104108        this.performedDrag = false; 
     109        this.startViaKeyboard = false; 
    105110        if (evt.shiftKey && this.mode !="zoombox") { 
    106111            this.switchModeTo("zoombox"); 
     112            this.startViaKeyboard = true; 
    107113        } else if (evt.altKey && this.mode !="measure") { 
    108114            this.switchModeTo("measure"); 
     
    123129                this.zoomBox.style.filter = "alpha(opacity=50)"; // IE 
    124130                this.zoomBox.style.opacity = "0.50"; 
     131                this.zoomBox.style.fontSize = "1px"; 
    125132                this.zoomBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; 
    126133                this.map.viewPortDiv.appendChild(this.zoomBox); 
     134                this.performedDrag = true; 
    127135                break; 
    128136            case "measure": 
     
    145153                this.measureBox.style.width="4px"; 
    146154                this.measureBox.style.height="4px"; 
     155                this.measureBox.style.fontSize = "1px"; 
    147156                this.measureBox.style.backgroundColor="red"; 
    148157                this.measureBox.style.zIndex = this.map.Z_INDEX_BASE["Popup"] - 1; 
     
    176185    switchModeTo: function(mode) { 
    177186        if (mode != this.mode) { 
    178             if (this.mode) { 
     187            if (this.mode && this.buttons[this.mode]) { 
    179188                OpenLayers.Util.modifyAlphaImageDiv(this.buttons[this.mode], null, null, null, this.buttons[this.mode].imgLocation); 
    180189            } 
     
    189198            } 
    190199            this.mode = mode; 
    191             OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation); 
     200            if (this.buttons[mode]) { 
     201                OpenLayers.Util.modifyAlphaImageDiv(this.buttons[mode], null, null, null, this.buttons[mode].activeImgLocation); 
     202            } 
    192203        }  
    193204    },  
     
    206217                    var deltaX = Math.abs(this.mouseDragStart.x - evt.xy.x); 
    207218                    var deltaY = Math.abs(this.mouseDragStart.y - evt.xy.y); 
    208                     this.zoomBox.style.width = deltaX+"px"; 
    209                     this.zoomBox.style.height = deltaY+"px"; 
     219                    this.zoomBox.style.width = Math.max(1, deltaX) + "px"; 
     220                    this.zoomBox.style.height = Math.max(1, deltaY) + "px"; 
    210221                    if (evt.xy.x < this.mouseDragStart.x) { 
    211222                        this.zoomBox.style.left = evt.xy.x+"px"; 
     
    236247        switch (this.mode) { 
    237248            case "zoombox": 
    238                 var start = this.map.getLonLatFromViewPortPx( this.mouseDragStart );  
    239                 var end = this.map.getLonLatFromViewPortPx( evt.xy ); 
    240                 var top = Math.max(start.lat, end.lat); 
    241                 var bottom = Math.min(start.lat, end.lat); 
    242                 var left = Math.min(start.lon, end.lon); 
    243                 var right = Math.max(start.lon, end.lon); 
    244                 var bounds = new OpenLayers.Bounds(left, bottom, right, top); 
    245                 var zoom = this.map.getZoomForExtent(bounds); 
    246                 this.map.setCenter(new OpenLayers.LonLat( 
    247                   (start.lon + end.lon) / 2, 
    248                   (start.lat + end.lat) / 2 
    249                  ), zoom); 
    250                 this.map.viewPortDiv.removeChild(document.getElementById("zoomBox")); 
    251                 this.zoomBox = null; 
    252                 this.leaveMode(); 
     249                this.zoomBoxEnd(evt); 
     250                if (this.startViaKeyboard) this.leaveMode(); 
    253251                break; 
    254252            case "pan": 
     
    267265                this.defaultMouseUp(evt); 
    268266        } 
     267    }, 
     268    defaultClick: function (evt) { 
     269        if (this.performedDrag)  { 
     270            this.performedDrag = false; 
     271            return false; 
     272        } 
    269273    } 
    270 })
    271  
     274}))
     275 
  • trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js

    r1206 r1369  
    2626        this.position = new OpenLayers.Pixel(OpenLayers.Control.PanZoomBar.X, 
    2727                                             OpenLayers.Control.PanZoomBar.Y); 
    28  
    29         // put code here to catch "changebaselayer" event from map, because 
    30         //  we are going to have to redraw this thing each time, because  
    31         //  maxZoom will/might change. 
    32     }, 
    33  
     28    }, 
     29 
     30    /** 
     31     * @param {OpenLayers.Map} map 
     32     */ 
     33    setMap: function(map) { 
     34        OpenLayers.Control.PanZoom.prototype.setMap.apply(this, arguments); 
     35        this.map.events.register("changebaselayer", this, this.redraw); 
     36    }, 
     37 
     38    /** clear the div and start over. 
     39     *  
     40     */ 
     41    redraw: function() { 
     42        if (this.div != null) { 
     43            this.div.innerHTML = ""; 
     44        }   
     45        this.draw(); 
     46    }, 
     47     
    3448    /** 
    3549    * @param {OpenLayers.Pixel} px 
     
    3852        // initialize our internal div 
    3953        OpenLayers.Control.prototype.draw.apply(this, arguments); 
    40         px = this.position
     54        px = this.position.clone()
    4155 
    4256        // place the controls 
     
    6478         
    6579        var id = "OpenLayers_Control_PanZoomBar_Slider" + this.map.id; 
     80        var zoomsToEnd = this.map.getNumZoomLevels() - 1 - this.map.getZoom(); 
    6681        var slider = OpenLayers.Util.createAlphaImageDiv(id, 
    67                        centered.add(-1,  
    68                          (this.map.getMaxZoomLevel())*this.zoomStopHeight),  
     82                       centered.add(-1, zoomsToEnd * this.zoomStopHeight),  
    6983                       new OpenLayers.Size(20,9),  
    7084                       imgLocation+"slider.png", 
     
    8094         
    8195        sz = new OpenLayers.Size(); 
    82         sz.h = this.zoomStopHeight*(this.map.getMaxZoomLevel()+1); 
     96        sz.h = this.zoomStopHeight * this.map.getNumZoomLevels(); 
    8397        sz.w = this.zoomStopWidth; 
    8498        var div = null 
     
    116130 
    117131        centered = centered.add(0,  
    118             this.zoomStopHeight*(this.map.getMaxZoomLevel()+1)); 
     132            this.zoomStopHeight * this.map.getNumZoomLevels()); 
    119133        return centered;  
    120134    }, 
     
    137151        var top = Position.page(evt.object)[1]; 
    138152        var levels = Math.floor((y - top)/this.zoomStopHeight); 
    139         this.map.zoomTo(this.map.getMaxZoomLevel() - levels); 
     153        this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels); 
    140154        Event.stop(evt); 
    141155    }, 
     
    171185            } 
    172186            this.mouseDragStart = evt.xy.clone(); 
     187            Event.stop(evt); 
    173188        } 
    174         Event.stop(evt); 
    175189    }, 
    176190     
     
    184198        if (this.zoomStart) { 
    185199            this.div.style.cursor="default"; 
    186             this.map.events.remove("mousemove"); 
    187             this.map.events.remove("mouseup"); 
     200            this.map.events.unregister("mouseup", this, this.passEventToSlider); 
     201            this.map.events.unregister("mousemove", this, this.passEventToSlider); 
    188202            var deltaY = this.zoomStart.y - evt.xy.y 
    189203            this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); 
     
    199213    moveZoomBar:function() { 
    200214        var newTop =  
    201             (this.map.getMaxZoomLevel() - this.map.getZoom()) * this.zoomStopHeight 
    202             + this.startTop + 1; 
     215            ((this.map.getNumZoomLevels()-1) - this.map.getZoom()) *  
     216            this.zoomStopHeight + this.startTop + 1; 
    203217        this.slider.style.top = newTop + "px"; 
    204218    },     
  • trunk/openlayers/lib/OpenLayers/Feature/WFS.js

    r1206 r1369  
    4949        // must return an Object with 'id' and 'lonlat' values set 
    5050        var point = xmlNode.getElementsByTagName("Point"); 
    51         var text  = OpenLayers.Util.getXmlNodeValue(point[0]); 
     51        var text  = OpenLayers.Util.getXmlNodeValue(point[0].getElementsByTagName("coordinates")[0]); 
    5252        var floats = text.split(","); 
    53  
    5453        return {lonlat: new OpenLayers.LonLat(parseFloat(floats[0]), 
    5554                                              parseFloat(floats[1])), 
  • trunk/openlayers/lib/OpenLayers/Layer.js

    r1259 r1369  
    5252 
    5353    /** @type int */ 
    54     minZoomLevel: null, 
    55      
    56     /** @type int */ 
    57     maxZoomLevel: null, 
     54    numZoomLevels: null, 
    5855    
    5956    /** @type float */ 
     
    149146    }, 
    150147     
     148    /** 
     149     *  
     150     */ 
     151    onMapResize: function() { 
     152        //this function can be implemented by subclasses   
     153    }, 
    151154 
    152155    /** 
     
    164167     *   they have their map variable set.  
    165168     *  
     169     *  Here we take care to bring over any of the necessary default properties 
     170     *   from the map.  
     171     *  
    166172     * @param {OpenLayers.Map} map 
    167173     */ 
     
    170176         
    171177        var properties = new Array( 
    172           'projection', 'minExtent', 'maxExtent', 
    173           'minScale', 'maxScale', 
     178          'projection', 'units', 
     179          'scales', 'resolutions', 
     180          'maxScale', 'minScale',  
    174181          'maxResolution', 'minResolution',  
    175           'minZoomLevel', 'maxZoomLevel', 'units', 
    176           'scales', 'resolutions' 
    177            
     182          'minExtent', 'maxExtent', 
     183          'numZoomLevels' 
    178184        ); 
     185        if (this.map.maxZoomLevel && !this.numZoomLevels) { 
     186            this.numZoomLevels = this.map.maxZoomLevel + 1; 
     187        } 
    179188        for(var i=0; i < properties.length; i++) { 
    180189            if (this[properties[i]] == null) { 
     
    221230  /********************************************************/ 
    222231     
     232    /**  
     233     * @param {Boolean} isBaseLayer  
     234     */ 
     235    setIsBaseLayer: function(isBaseLayer) { 
     236        this.isBaseLayer = isBaseLayer; 
     237        if (this.map != null) { 
     238            this.map.events.triggerEvent("changelayer"); 
     239        } 
     240    }, 
     241     
    223242    /** 
    224243     * @type String 
     
    243262     
    244263    /** 
    245      * @returns The minimum zoom level that can be reached in this layer 
     264     * @returns The total number of zoom levels this layer can reach 
    246265     * @type int 
    247266     */ 
    248     getMinZoomLevel: function() { 
    249         return this.minZoomLevel; 
    250     }, 
    251  
    252     /** 
    253      * @returns The maximum zoom level that can be reached in this layer 
    254      * @type int 
    255      */ 
    256     getMaxZoomLevel: function() { 
    257         return this.maxZoomLevel; 
     267    getNumZoomLevels: function() { 
     268        return this.numZoomLevels; 
    258269    }, 
    259270 
     
    273284    getResolution: function() { 
    274285        var viewSize = this.map.getSize(); 
    275         var extent = this.map.getExtent(); 
     286        var extent = this.getExtent(); 
    276287        return Math.max( extent.getWidth()  / viewSize.w, 
    277288                         extent.getHeight() / viewSize.h ); 
     
    317328    getLonLatFromViewPortPx: function (viewPortPx) { 
    318329        var size = this.map.getSize(); 
    319         var center = this.map.getCenter();        //map center lon/lat 
     330        var center = this.map.getCenter(); 
    320331        var res  = this.map.getResolution(); 
    321332     
  • trunk/openlayers/lib/OpenLayers/Layer/EventPane.js

    r1337 r1369  
    3838            if (this.pane == null) { 
    3939                this.pane = OpenLayers.Util.createDiv(); 
    40                 this.pane.style.width = "100%"; 
    41                 this.pane.style.height = "100%"; 
    42                 this.pane.style.backgroundColor = "transparent"; 
    4340            } 
    4441        } 
     
    5350    setMap: function(map) { 
    5451        OpenLayers.Layer.prototype.setMap.apply(this, arguments); 
    55  
     52         
    5653        this.pane.style.zIndex = parseInt(this.div.style.zIndex) + 1; 
    5754        this.pane.style.display = this.div.style.display; 
     55        this.pane.style.width="100%"; 
     56        this.pane.style.height="100%"; 
     57        if (/MSIE/.test(navigator.userAgent)) { 
     58          this.pane.style.background = "url("+OpenLayers.Util.getImagesLocation()+"blank.gif)"; 
     59        } 
     60 
    5861        if (this.isFixed) { 
    5962            this.map.viewPortDiv.appendChild(this.pane);