OpenLayers OpenLayers

Changeset 5969

Show
Ignore:
Timestamp:
02/01/08 18:41:51 (1 year ago)
Author:
tschaub
Message:

merge r5689:HEAD from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/tschaub/fractional/doc/authors.txt

    r5415 r5969  
    1111Pierre Giraud 
    1212Andreas Hocevar 
     13Ian Johnson 
    1314Eric Lemoine 
    1415Philip Lindsay 
     16Martijn van Oosterhout 
    1517Corey Puffault 
    1618Gregers Rygg 
  • sandbox/tschaub/fractional/examples/georss-flickr.html

    r5429 r5969  
    2929            // create a property style that reads the externalGraphic url from 
    3030            // the thumbail attribute of the rss item 
    31             style = new OpenLayers.Style({ 
    32                 externalGraphic: "${thumbnail}", 
    33                 pointRadius: 20}); 
     31            style = new OpenLayers.Style({externalGraphic: "${thumbnail}"}); 
    3432             
    3533            // create a rule with a point symbolizer that will make the thumbnail 
     
    4240            rule.value2regex("*"); 
    4341             
    44             style.addRules([rule]); 
     42            // If the above rule does not apply, use a smaller pointRadius. 
     43            var elseRule = new OpenLayers.Rule({ 
     44                    symbolizer: {"Point": {pointRadius: 20}}}); 
     45             
     46            style.addRules([rule, elseRule]); 
    4547             
    4648            markerLayer = new OpenLayers.Layer.Vector("", {style: style}); 
  • sandbox/tschaub/fractional/examples/panel.html

    r5362 r5969  
    7070             
    7171             
    72             zb = new OpenLayers.Control.ZoomBox(); 
     72            zb = new OpenLayers.Control.ZoomBox( 
     73                {title:"Zoom box: Selecting it you can zoom on an area by clicking and dragging."}); 
    7374            var panel = new OpenLayers.Control.Panel({defaultControl: zb}); 
    7475            panel.addControls([ 
    75                 new OpenLayers.Control.MouseDefaults(), 
     76                new OpenLayers.Control.MouseDefaults( 
     77                    {title:'You can use the default mouse configuration'}),  
    7678                zb, 
    77                 new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path), 
    78                 new OpenLayers.Control.ZoomToMaxExtent() 
     79                new OpenLayers.Control.DrawFeature(vlayer, OpenLayers.Handler.Path, 
     80                    {title:'Draw a feature'}), 
     81                new OpenLayers.Control.ZoomToMaxExtent({title:"Zoom to the max extent"})  
    7982            ]); 
    8083            map.addControl(panel); 
  • sandbox/tschaub/fractional/examples/proxy.cgi

    r4371 r5969  
    1818allowedHosts = ['www.openlayers.org', 'openlayers.org',  
    1919                'labs.metacarta.com', 'world.freemap.in',  
    20                 'prototype.openmnnd.org', 'geo.openplans.org'] 
     20                'prototype.openmnnd.org', 'geo.openplans.org', 
     21                'www.openstreetmap.org'] 
    2122 
    2223method = os.environ["REQUEST_METHOD"] 
  • sandbox/tschaub/fractional/examples/sld.html

    r5530 r5969  
    6666            hover = new OpenLayers.Control.SelectFeature(gmlLayers[2], { 
    6767                    selectStyle: waterStyle["Hover Styler"], 
    68                     hover: true, 
    69                     select: select 
     68                    hover: true 
    7069                }); 
    7170            map.addControl(hover); 
    7271            hover.activate(); 
    73         } 
    74  
    75         // replaces OpenLayers.Control.Select.select 
    76         var select = function(feature) { 
    77             // store layer style 
    78             var style = feature.layer.style; 
    79             // set temporary layer style for hover rendering 
    80             feature.layer.style = hover.selectStyle; 
    81             OpenLayers.Control.SelectFeature.prototype.select.apply(hover, arguments); 
    82             // restore layer style 
    83             feature.layer.style = style; 
    8472        } 
    8573         
  • sandbox/tschaub/fractional/examples/tasmania/sld-tasmania.xml

    r5520 r5969  
    5151            </sld:Stroke> 
    5252          </sld:PolygonSymbolizer> 
     53        </sld:Rule> 
     54        <sld:Rule> 
     55          <sld:Name>testRuleNameElse</sld:Name> 
     56          <sld:Title>title</sld:Title> 
     57          <sld:Abstract>Abstract</sld:Abstract> 
     58          <ogc:ElseFilter/> 
    5359        </sld:Rule> 
    5460      </sld:FeatureTypeStyle> 
     
    114120          </sld:PolygonSymbolizer> 
    115121        </sld:Rule> 
    116  
     122        <sld:Rule> 
     123          <sld:Name>testRuleNameHoverElse</sld:Name> 
     124          <sld:Title>title</sld:Title> 
     125          <sld:Abstract>Abstract</sld:Abstract> 
     126          <ogc:ElseFilter/> 
     127        </sld:Rule> 
    117128      </sld:FeatureTypeStyle> 
    118129    </sld:UserStyle> 
  • sandbox/tschaub/fractional/examples/vector-features.html

    r5362 r5969  
    3838            var style_green = { 
    3939                strokeColor: "#00FF00", 
    40                 strokeOpacity: 1, 
    4140                strokeWidth: 3, 
    4241                pointRadius: 6, 
  • sandbox/tschaub/fractional/examples/wfs-t.html

    r5362 r5969  
    7777 
    7878  <div id="docs"> 
    79     This is an example of using a WFS layer type. 
     79    This is an example of using a WFS layer type. Note that it requires a  
     80    working GeoServer install, which the OpenLayers project does not maintain; 
     81    however, if you're interested, you should be able to point this against 
     82    a default GeoServer setup without too much trouble. 
    8083   </div> 
    8184 
  • sandbox/tschaub/fractional/examples/wms-untiled.html

    r5362 r5969  
    1717        function init(){ 
    1818            map = new OpenLayers.Map( 'map' ); 
    19             layer = new OpenLayers.Layer.WMS.Untiled( "OpenLayers WMS", 
    20                     "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 
     19            layer = new OpenLayers.Layer.WMS( 
     20                "OpenLayers WMS", 
     21                "http://labs.metacarta.com/wms/vmap0", 
     22                {layers: 'basic'}, 
     23                {singleTile: true} 
     24            ); 
    2125            map.addLayer(layer); 
    2226 
     
    3135    <div id="tags"> 
    3236    </div> 
    33    <p id="shortdesc"> 
    34         Shows an example of the Untiled wms layer, which requests a single image for the entire map view</a>. 
    35     </p> 
    36  
     37        <p id="shortdesc"> 
     38            Shows an example of an "untiled" WMS layer, which requests a single 
     39            image for the entire map view. 
     40        </p> 
    3741    <div id="map"></div> 
    38  
    39     <div id="docs"> 
    40         An untiled map will only request a single image at a time. 
    41     </div> 
     42        <div id="docs"> 
     43            An untiled layer will only request a single image at a time. 
     44            This is equivalent to using the deprecated 
     45            OpenLayers.Layer.WMS.Untiled class, which will be removed at 3.0. 
     46        </div> 
    4247  </body> 
    4348</html> 
  • sandbox/tschaub/fractional/lib/OpenLayers.js

    r5614 r5969  
    4444                if (src) { 
    4545                    var index = src.lastIndexOf(scriptName);  
     46                    // set path length for src up to a query string 
     47                    var pathLength = src.lastIndexOf('?'); 
     48                    if (pathLength < 0) { 
     49                        pathLength = src.length; 
     50                    } 
    4651                    // is it found, at the end of the URL? 
    47                     if ((index > -1) && (index + scriptName.length == src.length)) {   
    48                         scriptLocation = src.slice(0, -scriptName.length); 
     52                    if ((index > -1) && (index + scriptName.length == pathLength)) { 
     53                        scriptLocation = src.slice(0, pathLength - scriptName.length); 
    4954                        break; 
    5055                    } 
     
    118123            "OpenLayers/Handler.js", 
    119124            "OpenLayers/Handler/Click.js", 
     125            "OpenLayers/Handler/Hover.js", 
    120126            "OpenLayers/Handler/Point.js", 
    121127            "OpenLayers/Handler/Path.js", 
     
    129135            "OpenLayers/Control.js", 
    130136            "OpenLayers/Control/Attribution.js", 
     137            "OpenLayers/Control/Button.js", 
    131138            "OpenLayers/Control/ZoomBox.js", 
    132139            "OpenLayers/Control/ZoomToMaxExtent.js", 
     
    165172            "OpenLayers/Renderer/VML.js", 
    166173            "OpenLayers/Layer/Vector.js", 
     174            "OpenLayers/Layer/PointTrack.js", 
    167175            "OpenLayers/Layer/GML.js", 
    168176            "OpenLayers/Style.js", 
     
    178186            "OpenLayers/Format/WFS.js", 
    179187            "OpenLayers/Format/WKT.js", 
     188            "OpenLayers/Format/OSM.js", 
    180189            "OpenLayers/Format/SLD.js", 
    181190            "OpenLayers/Format/Text.js", 
    182191            "OpenLayers/Format/JSON.js", 
    183192            "OpenLayers/Format/GeoJSON.js", 
     193            "OpenLayers/Format/WMC.js", 
     194            "OpenLayers/Format/WMC/v1.js", 
     195            "OpenLayers/Format/WMC/v1_0_0.js", 
     196            "OpenLayers/Format/WMC/v1_1_0.js", 
    184197            "OpenLayers/Layer/WFS.js", 
    185198            "OpenLayers/Control/MouseToolbar.js", 
  • sandbox/tschaub/fractional/lib/OpenLayers/Ajax.js

    r5644 r5969  
    6161 
    6262    if (OpenLayers.ProxyHost && OpenLayers.String.startsWith(uri, "http")) { 
    63         uri = OpenLayers.ProxyHost + escape(uri); 
     63        uri = OpenLayers.ProxyHost + encodeURIComponent(uri); 
    6464    } 
    6565 
     
    431431            return this.transport.status || 0; 
    432432        } catch (e) { 
    433             return 0 
     433            return 0; 
    434434        } 
    435435    }, 
     
    487487            return this.transport.getResponseHeader(name); 
    488488        } catch (e) { 
    489             return null 
     489            return null; 
    490490        } 
    491491    }, 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control.js

    r5614 r5969  
    8585     */ 
    8686    displayClass: "", 
     87     
     88    /** 
     89    * Property: title   
     90    * {string}  This property is used for showing a tooltip over the   
     91    * Control.   
     92    */  
     93    title: "", 
    8794 
    8895    /**  
     
    173180            this.div = OpenLayers.Util.createDiv(this.id); 
    174181            this.div.className = this.displayClass; 
     182            if (this.title != "") { 
     183                this.div.title = this.title; 
     184            } 
    175185        } 
    176186        if (px != null) { 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/ArgParser.js

    r5614 r5969  
    1 /* Cpyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 
     1/* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD 
    22 * license.  See http://svn.openlayers.org/trunk/openlayers/license.txt for the 
    33 * full text of the license. */ 
     
    8787 
    8888            var args = OpenLayers.Util.getParameters(); 
     89            // Be careful to set layer first, to not trigger unnecessary layer loads 
     90            if (args.layers) { 
     91                this.layers = args.layers; 
     92     
     93                // when we add a new layer, set its visibility  
     94                this.map.events.register('addlayer', this,  
     95                                         this.configureLayers); 
     96                this.configureLayers(); 
     97            } 
    8998            if (args.lat && args.lon) { 
    9099                this.center = new OpenLayers.LonLat(parseFloat(args.lon), 
     
    98107                                         this.setCenter); 
    99108                this.setCenter(); 
    100             } 
    101      
    102             if (args.layers) { 
    103                 this.layers = args.layers; 
    104      
    105                 // when we add a new layer, set its visibility  
    106                 this.map.events.register('addlayer', this,  
    107                                          this.configureLayers); 
    108                 this.configureLayers(); 
    109109            } 
    110110        } 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/ModifyFeature.js

    r5623 r5969  
    262262            this.vertices = []; 
    263263            this.dragControl.deactivate(); 
    264             if(this.feature) { 
     264            if(this.feature && this.feature.geometry) { 
    265265                this.selectControl.unselect.apply(this.selectControl, 
    266266                                                  [this.feature]); 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/MousePosition.js

    r5614 r5969  
    131131        } 
    132132         
     133        var newHtml = this.formatOutput(lonLat); 
     134 
     135        if (newHtml != this.element.innerHTML) { 
     136            this.element.innerHTML = newHtml; 
     137        } 
     138    }, 
     139 
     140    /** 
     141     * Method: formatOutput 
     142     * Override to provide custom display output 
     143     * 
     144     * Parameters: 
     145     * lonLat - {<OpenLayers.LonLat>} Location to display 
     146     */ 
     147    formatOutput: function(lonLat) { 
    133148        var digits = parseInt(this.numdigits); 
    134149        var newHtml = 
     
    138153            lonLat.lat.toFixed(digits) + 
    139154            this.suffix; 
    140  
    141         if (newHtml != this.element.innerHTML) { 
    142             this.element.innerHTML = newHtml; 
    143         } 
    144     }, 
     155        return newHtml; 
     156     }, 
    145157 
    146158    /**  
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/Navigation.js

    r5695 r5969  
    5555    }, 
    5656 
     57    /** 
     58     * Method: destroy 
     59     * The destroy method is used to perform any clean up before the control 
     60     * is dereferenced.  Typically this is where event listeners are removed 
     61     * to prevent memory leaks. 
     62     */ 
     63    destroy: function() { 
     64        OpenLayers.Control.prototype.destroy.apply(this,arguments); 
     65        this.deactivate(); 
     66        this.dragPan.destroy(); 
     67        this.wheelHandler.destroy(); 
     68        this.clickHandler.destroy(); 
     69        this.zoomBox.destroy(); 
     70    }, 
     71     
    5772    /** 
    5873     * Method: activate 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/Panel.js

    r5631 r5969  
    173173            var textNode = document.createTextNode(" "); 
    174174            controls[i].panel_div = element; 
     175            if (controls[i].title != "") { 
     176                controls[i].panel_div.title = controls[i].title; 
     177            } 
    175178            OpenLayers.Event.observe(controls[i].panel_div, "click",  
    176179                OpenLayers.Function.bind(this.onClick, this, controls[i])); 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/SelectFeature.js

    r5614 r5969  
    128128    /** 
    129129     * Method: unselectAll 
    130      * Unselect all selected features. 
    131      */ 
    132     unselectAll: function() { 
     130     * Unselect all selected features.  To unselect all except for a single 
     131     *     feature, set the options.except property to the feature. 
     132     * 
     133     * Parameters: 
     134     * options - {Object} Optional configuration object. 
     135     */ 
     136    unselectAll: function(options) { 
    133137        // we'll want an option to supress notification here 
    134         while (this.layer.selectedFeatures.length > 0) { 
    135             this.unselect(this.layer.selectedFeatures[0]); 
     138        var feature; 
     139        for(var i=this.layer.selectedFeatures.length-1; i>=0; --i) { 
     140            feature = this.layer.selectedFeatures[i]; 
     141            if(!options || options.except != feature) { 
     142                this.unselect(feature); 
     143            } 
    136144        } 
    137145    }, 
     
    146154     */ 
    147155    clickFeature: function(feature) { 
    148         if(this.hover) { 
    149             return; 
    150         } 
    151         var selected = (OpenLayers.Util.indexOf(this.layer.selectedFeatures, 
    152                                                 feature) > -1); 
    153         if(!this.multiple && !this.handler.evt[this.multipleKey]) { 
    154             // perhaps an "except" argument 
    155             this.unselectAll(); 
    156         } 
    157         if(selected) { 
    158             if(this.toggle || this.handler.evt[this.toggleKey]) { 
    159                 // notify here 
    160                 this.unselect(feature); 
     156        if(!this.hover) { 
     157            var selected = (OpenLayers.Util.indexOf(this.layer.selectedFeatures, 
     158                                                    feature) > -1); 
     159            if(selected) { 
     160                if(this.toggleSelect()) { 
     161                    this.unselect(feature); 
     162                } else if(!this.multipleSelect()) { 
     163                    this.unselectAll({except: feature}); 
     164                } 
    161165            } else { 
    162                 // don't notify here - could be removed if unselectAll is modified 
     166                if(!this.multipleSelect()) { 
     167                    this.unselectAll({except: feature}); 
     168                } 
    163169                this.select(feature); 
    164170            } 
    165         } else { 
    166             this.select(feature); 
    167         } 
     171        } 
     172    }, 
     173 
     174    /** 
     175     * Method: multipleSelect 
     176     * Allow for multiple selected features based on <multiple> property and 
     177     *     <multipleKey> event modifier. 
     178     * 
     179     * Returns: 
     180     * {Boolean} Allow for multiple selected features. 
     181     */ 
     182    multipleSelect: function() { 
     183        return this.multiple || this.handler.evt[this.multipleKey]; 
     184    }, 
     185     
     186    /** 
     187     * Method: toggleSelect 
     188     * Event should toggle the selected state of a feature based on <toggle> 
     189     *     property and <toggleKey> event modifier. 
     190     * 
     191     * Returns: 
     192     * {Boolean} Toggle the selected state of a feature. 
     193     */ 
     194    toggleSelect: function() { 
     195        return this.toggle || this.handler.evt[this.toggleKey]; 
    168196    }, 
    169197 
     
    221249    select: function(feature) { 
    222250        // Store feature style for restoration later 
    223         if(feature.originalStyle == null) { 
     251        if(feature.originalStyle != feature.style) { 
    224252            feature.originalStyle = feature.style; 
    225253        } 
    226254        this.layer.selectedFeatures.push(feature); 
    227         feature.style = this.selectStyle; 
     255 
     256        var selectStyle = this.selectStyle; 
     257 
     258        if (feature.style.CLASS_NAME == "OpenLayers.Style") { 
     259            feature.style = feature.style.createStyle(feature); 
     260        } else { 
     261            feature.style = OpenLayers.Util.extend({}, feature.style); 
     262        } 
     263        if (selectStyle.CLASS_NAME == "OpenLayers.Style") { 
     264            selectStyle = selectStyle.createStyle(feature); 
     265        } 
     266        OpenLayers.Util.extend(feature.style, selectStyle); 
     267 
    228268        this.layer.drawFeature(feature); 
    229269        this.onSelect(feature); 
  • sandbox/tschaub/fractional/lib/OpenLayers/Control/ZoomBox.js

    r5614 r5969  
    2222 
    2323    /** 
     24     * Property: out 
     25     * {Boolean} Should the control be used for zooming out? 
     26     */ 
     27    out: false, 
     28 
     29    /** 
    2430     * Method: draw 
    2531     */     
     
    3743    zoomBox: function (position) { 
    3844        if (position instanceof OpenLayers.Bounds) { 
    39             var minXY = this.map.getLonLatFromPixel( 
     45            if (!this.out) { 
     46                var minXY = this.map.getLonLatFromPixel( 
    4047                            new OpenLayers.Pixel(position.left, position.bottom)); 
    41             var maxXY = this.map.getLonLatFromPixel( 
     48                var maxXY = this.map.getLonLatFromPixel( 
    4249                            new OpenLayers.Pixel(position.right, position.top)); 
    43             var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, 
     50                var bounds = new OpenLayers.Bounds(minXY.lon, minXY.lat, 
    4451                                               maxXY.lon, maxXY.lat); 
     52            } else { 
     53                var pixWidth = Math.abs(position.right-position.left); 
     54                var pixHeight = Math.abs(position.top-position.bottom); 
     55                var zoomFactor = Math.min((this.map.size.h / pixHeight), 
     56                    (this.map.size.w / pixWidth)); 
     57                var extent = map.getExtent(); 
     58                var center = this.map.getLonLatFromPixel( 
     59                    position.getCenterPixel()); 
     60                var xmin = center.lon - (extent.getWidth()/2)*zoomFactor; 
     61                var xmax = center.lon + (extent.getWidth()/2)*zoomFactor; 
     62                var ymin = center.lat - (extent.getHeight()/2)*zoomFactor; 
     63                var ymax = center.lat + (extent.getHeight()/2)*zoomFactor; 
     64                var bounds = new OpenLayers.Bounds(xmin, ymin, xmax, ymax); 
     65            } 
    4566            this.map.zoomToExtent(bounds); 
    4667        } else { // it's a pixel 
    47             this.map.setCenter(this.map.getLonLatFromPixel(position), 
     68            if (!this.out) { 
     69                this.map.setCenter(this.map.getLonLatFromPixel(position), 
    4870                               this.map.getZoom() + 1); 
     71            } else { 
     72                this.map.setCenter(this.map.getLonLatFromPixel(position), 
     73                               this.map.getZoom() - 1); 
     74            } 
    4975        } 
    5076    }, 
  • sandbox/tschaub/fractional/lib/OpenLayers/Feature/Vector.js

    r5625 r5969  
    280280 *  - hoverPointUnit: "%", 
    281281 *  - pointerEvents: "visiblePainted" 
     282 *  - cursor: "" 
    282283 * 
    283284 * Other style properties that have no default values: 
     
    307308        hoverPointRadius: 1, 
    308309        hoverPointUnit: "%", 
    309         pointerEvents: "visiblePainted" 
     310        pointerEvents: "visiblePainted", 
     311        cursor: "" 
    310312    }, 
    311313    'select': { 
     
    342344        hoverPointRadius: 1, 
    343345        hoverPointUnit: "%", 
    344         pointerEvents: "visiblePainted" 
     346        pointerEvents: "visiblePainted", 
     347        cursor: "" 
    345348    } 
    346349};     
  • sandbox/tschaub/fractional/lib/OpenLayers/Format/GeoRSS.js

    r5614 r5969  
    156156        } 
    157157         
    158         if (this.internalProjection && this.externalProjection) { 
     158        if (geometry && this.internalProjection && this.externalProjection) { 
    159159            geometry.transform(this.externalProjection,  
    160160                               this.internalProjection); 
  • sandbox/tschaub/fractional/lib/OpenLayers/Format/SLD.js

    r5553 r5969  
    107107        } 
    108108         
     109        options = options || {}; 
    109110        OpenLayers.Util.applyDefaults(options, { 
    110111            withNamedLayer: false, 
     
    207208            var rule = this.parseFilter(filter[0]); 
    208209        } else { 
    209             // rule applies to all features 
     210            // rule applies to all features (no filter or ElseFilter) 
    210211            var rule = new OpenLayers.Rule(); 
    211212        } 
     
    219220        ); 
    220221        if (minScale && min