OpenLayers OpenLayers

Changeset 5339

Show
Ignore:
Timestamp:
12/04/07 07:46:24 (1 year ago)
Author:
pgiraud
Message:

merge from r5119 to trunk HEAD (with some conflicts resolved)
next step would be to merge with ahocevar sandbox

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/camptocamp/text/apidoc_config/Menu.txt

    r4223 r5339  
    5151   Group: Control  { 
    5252 
    53       File: Control  (no auto-title, OpenLayers/Control.js) 
     53      File: Control  (OpenLayers/Control.js) 
    5454      File: ArgParser  (no auto-title, OpenLayers/Control/ArgParser.js) 
    55       File: ZoomToMaxExtent  (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js) 
    56       File: OverviewMap  (no auto-title, OpenLayers/Control/OverviewMap.js) 
     55      File: Attribution  (no auto-title, OpenLayers/Control/Attribution.js) 
    5756      File: DragFeature  (no auto-title, OpenLayers/Control/DragFeature.js) 
    5857      File: DragPan  (no auto-title, OpenLayers/Control/DragPan.js) 
     
    6160      File: KeyboardDefaults  (no auto-title, OpenLayers/Control/KeyboardDefaults.js) 
    6261      File: LayerSwitcher  (no auto-title, OpenLayers/Control/LayerSwitcher.js) 
     62      File: ModifyFeature  (no auto-title, OpenLayers/Control/ModifyFeature.js) 
    6363      File: MouseDefaults  (no auto-title, OpenLayers/Control/MouseDefaults.js) 
    6464      File: MousePosition  (no auto-title, OpenLayers/Control/MousePosition.js) 
     
    6666      File: Navigation  (no auto-title, OpenLayers/Control/Navigation.js) 
    6767      File: NavToolbar  (no auto-title, OpenLayers/Control/NavToolbar.js) 
     68      File: OverviewMap  (no auto-title, OpenLayers/Control/OverviewMap.js) 
    6869      File: Panel  (no auto-title, OpenLayers/Control/Panel.js) 
     70      File: PanZoom  (no auto-title, OpenLayers/Control/PanZoom.js) 
    6971      File: PanZoomBar  (no auto-title, OpenLayers/Control/PanZoomBar.js) 
    7072      File: Permalink  (no auto-title, OpenLayers/Control/Permalink.js) 
     
    7274      File: SelectFeature  (no auto-title, OpenLayers/Control/SelectFeature.js) 
    7375      File: ZoomBox  (no auto-title, OpenLayers/Control/ZoomBox.js) 
    74       File: PanZoom  (OpenLayers/Control/PanZoom.js) 
     76      File: ZoomToMaxExtent  (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js) 
    7577      }  # Group: Control 
    7678 
     
    7981   Group: Feature  { 
    8082 
    81       File: Feature  (no auto-title, OpenLayers/Feature.js) 
     83      File: Feature  (OpenLayers/Feature.js) 
     84      File: Vector  (no auto-title, OpenLayers/Feature/Vector.js) 
    8285      File: WFS  (no auto-title, OpenLayers/Feature/WFS.js) 
    83       File: Vector  (no auto-title, OpenLayers/Feature/Vector.js) 
    8486      }  # Group: Feature 
    8587 
  • sandbox/camptocamp/text/doc/authors.txt

    r3785 r5339  
    44John Cole 
    55Jeff Dege 
     6Roald de Wit 
    67Schuyler Erle 
    78Christian López Espínola 
  • sandbox/camptocamp/text/doc_config/Menu.txt

    r4223 r5339  
    5353      File: Control  (OpenLayers/Control.js) 
    5454      File: ArgParser  (no auto-title, OpenLayers/Control/ArgParser.js) 
    55       File: ZoomToMaxExtent  (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js) 
    56       File: OverviewMap  (no auto-title, OpenLayers/Control/OverviewMap.js) 
     55      File: Attribution  (no auto-title, OpenLayers/Control/Attribution.js) 
    5756      File: DragFeature  (no auto-title, OpenLayers/Control/DragFeature.js) 
    5857      File: DragPan  (no auto-title, OpenLayers/Control/DragPan.js) 
     
    6160      File: KeyboardDefaults  (no auto-title, OpenLayers/Control/KeyboardDefaults.js) 
    6261      File: LayerSwitcher  (no auto-title, OpenLayers/Control/LayerSwitcher.js) 
     62      File: ModifyFeature  (no auto-title, OpenLayers/Control/ModifyFeature.js) 
    6363      File: MouseDefaults  (no auto-title, OpenLayers/Control/MouseDefaults.js) 
    6464      File: MousePosition  (no auto-title, OpenLayers/Control/MousePosition.js) 
     
    6666      File: Navigation  (no auto-title, OpenLayers/Control/Navigation.js) 
    6767      File: NavToolbar  (no auto-title, OpenLayers/Control/NavToolbar.js) 
     68      File: OverviewMap  (no auto-title, OpenLayers/Control/OverviewMap.js) 
    6869      File: Panel  (no auto-title, OpenLayers/Control/Panel.js) 
     70      File: PanZoom  (no auto-title, OpenLayers/Control/PanZoom.js) 
    6971      File: PanZoomBar  (no auto-title, OpenLayers/Control/PanZoomBar.js) 
    7072      File: Permalink  (no auto-title, OpenLayers/Control/Permalink.js) 
     
    7274      File: SelectFeature  (no auto-title, OpenLayers/Control/SelectFeature.js) 
    7375      File: ZoomBox  (no auto-title, OpenLayers/Control/ZoomBox.js) 
    74       File: PanZoom  (no auto-title, OpenLayers/Control/PanZoom.js) 
     76      File: ZoomToMaxExtent  (no auto-title, OpenLayers/Control/ZoomToMaxExtent.js) 
    7577      }  # Group: Control 
    7678 
     
    8082 
    8183      File: Feature  (OpenLayers/Feature.js) 
     84      File: Vector  (no auto-title, OpenLayers/Feature/Vector.js) 
    8285      File: WFS  (no auto-title, OpenLayers/Feature/WFS.js) 
    83       File: Vector  (no auto-title, OpenLayers/Feature/Vector.js) 
    8486      }  # Group: Feature 
    8587 
  • sandbox/camptocamp/text/examples/controls.html

    r5119 r5339  
    1414            map = new OpenLayers.Map('map', { controls: [] }); 
    1515 
    16             map.addControl(new OpenLayers.Control.PanZoomBar()); 
     16            map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true})); 
    1717            map.addControl(new OpenLayers.Control.MouseToolbar()); 
    1818            map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); 
  • sandbox/camptocamp/text/examples/modify-feature.html

    r4272 r5339  
    5454                polygon: new OpenLayers.Control.DrawFeature(vectors, 
    5555                            OpenLayers.Handler.Polygon), 
     56                regular: new OpenLayers.Control.DrawFeature(vectors, 
     57                            OpenLayers.Handler.RegularPolygon, 
     58                            {handlerOptions: {sides: 5}}), 
    5659                modify: new OpenLayers.Control.ModifyFeature(vectors, 
    5760                                                             modifyOptions) 
     
    6669        } 
    6770         
     71        function update() { 
     72            var rotate = document.getElementById("rotate").checked; 
     73            controls.modify.rotate = rotate; 
     74            var resize = document.getElementById("resize").checked; 
     75            controls.modify.resize = resize; 
     76            var drag = document.getElementById("drag").checked; 
     77            controls.modify.drag = drag; 
     78            var sides = parseInt(document.getElementById("sides").value); 
     79            sides = Math.max(3, isNaN(sides) ? 0 : sides); 
     80            controls.regular.handler.sides = sides; 
     81            var irregular =  document.getElementById("irregular").checked; 
     82            controls.regular.handler.irregular = irregular; 
     83        } 
    6884 
    6985        function toggleControl(element) { 
     
    103119            </li> 
    104120            <li> 
     121                <input type="radio" name="type" value="regular" id="regularToggle" onclick="toggleControl(this);" /> 
     122                <label for="regularToggle">draw regular polygon</label> 
     123                <label for="sides"> - sides</label> 
     124                <input id="sides" type="text" size="2" maxlength="2" 
     125                       name="sides" value="5" onchange="update()" /> 
     126                <ul> 
     127                    <li> 
     128                        <input id="irregular" type="checkbox" 
     129                               name="irregular" onchange="update()" /> 
     130                        <label for="irregular">irregular</label> 
     131                    </li> 
     132                </ul> 
     133            </li> 
     134            <li> 
    105135                <input type="radio" name="type" value="modify" id="modifyToggle" 
    106136                       onclick="toggleControl(this);" /> 
    107137                <label for="modifyToggle">modify feature</label> 
     138                <ul> 
     139                    <li> 
     140                        <input id="rotate" type="checkbox" 
     141                               name="rotate" onchange="update()" /> 
     142                        <label for="rotate">allow rotation</label> 
     143                    </li> 
     144                    <li> 
     145                        <input id="resize" type="checkbox" 
     146                               name="resize" onchange="update()" /> 
     147                        <label for="resize">allow resizing</label> 
     148                    </li> 
     149                    <li> 
     150                        <input id="drag" type="checkbox" 
     151                               name="drag" onchange="update()" /> 
     152                        <label for="drag">allow dragging</label> 
     153                    </li> 
     154                </ul> 
    108155            </li> 
    109156        </ul> 
  • sandbox/camptocamp/text/examples/popups.html

    r4308 r5339  
    88        } 
    99    </style> 
     10    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 
    1011    <script src="../lib/OpenLayers.js"></script> 
    11     <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 
    1212    <script type="text/javascript"> 
    1313        var map, layer, popup; 
  • sandbox/camptocamp/text/examples/regular-polygons.html

    r4222 r5339  
    6767             
    6868            document.getElementById('noneToggle').checked = true; 
     69             document.getElementById('irregularToggle').checked = false; 
    6970        } 
    7071        function setOptions(options) { 
     
    147148                    </td> 
    148149                </tr> 
     150                <tr> 
     151                    <td> 
     152                        irregular 
     153                    </td> 
     154                    <td> 
     155                        <input id="irregularToggle" name="irregular" 
     156                               type="checkbox" 
     157                               onchange="setOptions({irregular: this.checked})") /> 
     158                    </td> 
     159                </tr> 
    149160            </tbody> 
    150161        </table> 
     
    157168        will toggle to non-snapping mode. 
    158169    </p> 
     170    <p> 
     171         The <i>irregular</i> option allows drawing of irregular polygons.  With this option, the fixed radius option is ignored. 
    159172  </body> 
    160173</html> 
  • sandbox/camptocamp/text/examples/select-feature.html

    r4222 r5339  
    11<html xmlns="http://www.w3.org/1999/xhtml"> 
    22  <head> 
     3    <title>Select Feature</title> 
    34    <style type="text/css"> 
    45        #map { 
     
    1415    <script type="text/javascript"> 
    1516        var map, drawControls, select; 
     17        OpenLayers.Feature.Vector.style['default']['strokeWidth'] = '2'; 
    1618        function init(){ 
    1719            map = new OpenLayers.Map('map'); 
    18             var wmsLayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",  
    19                 "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'});  
     20            var wmsLayer = new OpenLayers.Layer.WMS( 
     21                "OpenLayers WMS",  
     22                "http://labs.metacarta.com/wms/vmap0", 
     23                {layers: 'basic'} 
     24            );  
    2025 
    21             var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer"); 
    22  
    23             map.addLayers([wmsLayer, polygonLayer]); 
     26            var vectors = new OpenLayers.Layer.Vector("Vector Layer"); 
     27            map.addLayers([wmsLayer, vectors]); 
    2428            map.addControl(new OpenLayers.Control.LayerSwitcher()); 
    2529            map.addControl(new OpenLayers.Control.MousePosition()); 
    2630             
    2731            drawControls = { 
    28                 polygon: new OpenLayers.Control.DrawFeature(polygonLayer, 
    29                             OpenLayers.Handler.Polygon), 
    30                 select: new OpenLayers.Control.SelectFeature(polygonLayer), 
    31                 hover: new OpenLayers.Control.SelectFeature(polygonLayer, 
    32                                                             {hover: true}) 
     32                point: new OpenLayers.Control.DrawFeature( 
     33                    vectors, OpenLayers.Handler.Point 
     34                ), 
     35                line: new OpenLayers.Control.DrawFeature( 
     36                    vectors, OpenLayers.Handler.Path 
     37                ), 
     38                polygon: new OpenLayers.Control.DrawFeature( 
     39                    vectors, OpenLayers.Handler.Polygon 
     40                ), 
     41                select: new OpenLayers.Control.SelectFeature(vectors), 
     42                hover: new OpenLayers.Control.SelectFeature( 
     43                    vectors, {hover: true} 
     44                ) 
    3345            }; 
    3446             
     
    5365  </head> 
    5466  <body onload="init()"> 
    55     <h1>OpenLayers Draw Feature Example</h1
     67    <h3>OpenLayers Select Feature Example</h3
    5668    <div id="map"></div> 
    5769    <ul id="controlToggle"> 
     
    6072                   onclick="toggleControl(this);" checked="checked" /> 
    6173            <label for="noneToggle">navigate</label> 
     74        </li> 
     75        <li> 
     76            <input type="radio" name="type" value="point" id="pointToggle" 
     77                   onclick="toggleControl(this);" /> 
     78            <label for="pointToggle">draw point</label> 
     79        </li> 
     80        <li> 
     81            <input type="radio" name="type" value="line" id="lineToggle" 
     82                   onclick="toggleControl(this);" /> 
     83            <label for="lineToggle">draw line</label> 
    6284        </li> 
    6385        <li> 
     
    6991            <input type="radio" name="type" value="select" id="selectToggle" 
    7092                   onclick="toggleControl(this);" /> 
    71             <label for="selectToggle">select polygon on click</label> 
     93            <label for="selectToggle">select feature on click</label> 
    7294        </li> 
    7395        <li> 
    7496            <input type="radio" name="type" value="hover" id="hoverToggle" 
    7597                   onclick="toggleControl(this);" /> 
    76             <label for="hoverToggle">select polygon on hover</label> 
     98            <label for="hoverToggle">select feature on hover</label> 
    7799        </li> 
    78100    </ul>         
  • sandbox/camptocamp/text/examples/spherical-mercator.html

    r5119 r5339  
    77            border: 1px solid gray; 
    88        } 
     9        .olControlAttribution { bottom: 0px!important } 
    910    </style> 
    1011 
    1112    <script src='http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js'></script> 
    12     <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 
     13    <script src='http://maps.google.com/maps?file=api&amp;v=2.82&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script> 
    1314    <script src="http://api.maps.yahoo.com/ajaxymap?v=3.0&appid=euzuro-openlayers"></script> 
    1415 
     
    8182                { 
    8283                    type: 'png', getURL: osm_getTileURL, 
    83                     displayOutsideMaxExtent: true 
     84                    displayOutsideMaxExtent: true, 
     85                    attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>' 
    8486                } 
    8587            ); 
  • sandbox/camptocamp/text/lib/OpenLayers/BaseTypes.js

    r5119 r5339  
    8888        } 
    8989        return camelizedString; 
     90    }, 
     91 
     92    /** 
     93     * APIFunction: OpenLayers.String.format 
     94     * Given a string with tokens in the form ${token}, return a string 
     95     *     with tokens replaced with properties from the given context 
     96     *     object.  Represent a literal "${" by doubling it, e.g. "${${". 
     97     * 
     98     * Parameters: 
     99     * template - {String} A string with tokens to be replaced.  A template 
     100     *     has the form "literal ${token}" where the token will be replaced 
     101     *     by the value of context["token"]. 
     102     * context - {Object} An optional object with properties corresponding 
     103     *     to the tokens in the format string.  If no context is sent, the 
     104     *     window object will be used. 
     105     * 
     106     * Returns: 
     107     * {String} A string with tokens replaced from the context object. 
     108     */ 
     109    format: function(template, context) { 
     110        if(!context) { 
     111            context = window; 
     112        } 
     113        var tokens = template.split("${"); 
     114        var item, last; 
     115        for(var i=1; i<tokens.length; i++) { 
     116            item = tokens[i]; 
     117            last = item.indexOf("}");  
     118            if(last > 0) {  
     119                tokens[i] = context[item.substring(0, last)] + 
     120                            item.substring(++last);  
     121            } else { 
     122                tokens[i] = "${" + item; 
     123            } 
     124        } 
     125        return tokens.join(""); 
    90126    } 
     127 
    91128}; 
    92129 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/Attribution.js

    r4985 r5339  
    7878    }, 
    7979 
    80     /** @final @type String */ 
    8180    CLASS_NAME: "OpenLayers.Control.Attribution" 
    8281}); 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/EditingToolbar.js

    r5002 r5339  
    4545     * Method: draw 
    4646     * calls the default draw, and then activates mouse defaults. 
     47     * 
     48     * Returns: 
     49     * {DOMElement} 
    4750     */ 
    4851    draw: function() { 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/ModifyFeature.js

    r5119 r5339  
    8787     */ 
    8888    virtualStyle: null, 
    89      
     89 
     90    /** 
     91     * APIProperty: rotate 
     92     * {Boolean} Allow rotation of feature instead of vertex modification. 
     93     */ 
     94    rotate: false, 
     95 
     96    /** 
     97     * APIProperty: resize 
     98     * {Boolean} Allow resizing of feature instead of vertex modification. 
     99     */ 
     100    resize: false, 
     101 
     102    /** 
     103     * Property: radiusHandle 
     104     * {<OpenLayers.Feature.Vector>} A handle for rotating/resizing a feature. 
     105     */ 
     106    radiusHandle: null, 
     107 
     108    /** 
     109     * APIProperty: drag 
     110     * {Boolean} Allow dragging of feature with a drag handle. 
     111     */ 
     112    drag: false, 
     113     
     114    /** 
     115     * Property: dragHandle 
     116     * {<OpenLayers.Feature.Vector>} A handle for dragging a feature. 
     117     */ 
     118    dragHandle: null, 
     119 
    90120    /** 
    91121     * APIProperty: onModificationStart  
     
    251281    unselectFeature: function(feature) { 
    252282        this.layer.removeFeatures(this.vertices); 
    253         this.layer.removeFeatures(this.virtualVertices); 
    254283        this.vertices = []; 
     284        this.layer.destroyFeatures(this.virtualVertices); 
    255285        this.virtualVertices = []; 
     286        if(this.dragHandle) { 
     287            this.layer.destroyFeatures([this.dragHandle]); 
     288            delete this.dragHandle; 
     289        } 
     290        if(this.radiusHandle) { 
     291            this.layer.destroyFeatures([this.radiusHandle]); 
     292            delete this.radiusHandle; 
     293        } 
    256294        this.feature = null; 
    257295        this.dragControl.deactivate(); 
     
    275313    dragStart: function(feature, pixel) { 
    276314        // only change behavior if the feature is not in the vertices array 
    277         if(feature != this.feature && 
    278            OpenLayers.Util.indexOf(this.vertices, feature) == -1 && 
    279            OpenLayers.Util.indexOf(this.virtualVertices, feature) == -1) { 
     315        if(feature != this.feature && !feature.geometry.parent && 
     316           feature != this.dragHandle && feature != this.radiusHandle) { 
    280317            if(this.feature) { 
    281318                // unselect the currently selected feature 
     
    316353     */ 
    317354    dragVertex: function(vertex) { 
     355        /** 
     356         * Five cases: 
     357         * 1) dragging a simple point 
     358         * 2) dragging a virtual vertex 
     359         * 3) dragging a drag handle 
     360         * 4) dragging a radius handle 
     361         * 5) dragging a real vertex 
     362         */ 
    318363        if(this.feature.geometry.CLASS_NAME == "OpenLayers.Geometry.Point") { 
     364            // dragging a simple point 
    319365            if(this.feature != vertex) { 
    320366                this.feature = vertex; 
    321367            } 
    322368        } else { 
    323             if(OpenLayers.Util.indexOf(this.virtualVertices, vertex) != -1) { 
     369            if(vertex._index) { 
     370                // dragging a virtual vertex 
    324371                vertex.geometry.parent.addComponent(vertex.geometry, 
    325372                                                    vertex._index); 
    326373                delete vertex._index; 
    327374                OpenLayers.Util.removeItem(this.virtualVertices, vertex); 
    328                 this.layer.removeFeatures(vertex); 
    329             } 
    330         } 
    331         this.layer.drawFeature(this.feature, this.selectControl.selectStyle); 
    332         this.layer.removeFeatures(this.virtualVertices); 
     375            } else if(vertex == this.dragHandle) { 
     376                // dragging a drag handle 
     377                this.layer.removeFeatures(this.vertices); 
     378                this.vertices = []; 
     379                if(this.radiusHandle) { 
     380                    this.layer.destroyFeatures([this.radiusHandle]); 
     381                    this.radiusHandle = null; 
     382                } 
     383            } 
     384            // dragging a radius handle - no special treatment 
     385            // dragging a real vertex - no special treatment 
     386            this.layer.destroyFeatures(this.virtualVertices); 
     387            this.virtualVertices = []; 
     388            this.layer.drawFeature(this.feature, this.selectControl.selectStyle); 
     389        } 
    333390        // keep the vertex on top so it gets the mouseout after dragging 
    334391        // this should be removed in favor of an option to draw under or 
     
    361418            this.virtualVertices = []; 
    362419        } 
     420        if(this.dragHandle) { 
     421            this.layer.destroyFeatures([this.dragHandle]); 
     422            this.dragHandle = null; 
     423        } 
     424        if(this.radiusHandle) { 
     425            this.layer.destroyFeatures([this.radiusHandle]); 
     426            this.radiusHandle = null; 
     427        } 
    363428        if(this.feature && 
    364429           this.feature.geometry.CLASS_NAME != "OpenLayers.Geometry.Point") { 
    365             this.collectVertices(this.feature.geometry); 
    366             this.layer.addFeatures(this.vertices); 
    367             this.layer.addFeatures(this.virtualVertices); 
     430            if(this.drag) { 
     431                this.collectDragHandle(); 
     432            } 
     433            if(this.rotate || this.resize) { 
     434                this.collectRadiusHandle(); 
     435            } else { 
     436                this.collectVertices(); 
     437            } 
    368438        } 
    369439    }, 
     
    386456            if(vertex && 
    387457               OpenLayers.Util.indexOf(this.vertices, vertex) != -1 && 
    388                !this.dragControl.dragHandler.dragging) { 
     458               !this.dragControl.dragHandler.dragging && 
     459               vertex.geometry.parent) { 
    389460                // remove the vertex 
    390461                vertex.geometry.parent.removeComponent(vertex.geometry); 
     
    443514                } 
    444515            } 
    445         }        
    446         collectComponentVertices(this.feature.geometry); 
     516        } 
     517        collectComponentVertices.call(this, this.feature.geometry); 
     518        this.layer.addFeatures(this.vertices); 
     519        this.layer.addFeatures(this.virtualVertices); 
     520    }, 
     521 
     522    /** 
     523     * Method: collectDragHandle 
     524     * Collect the drag handle for the selected geometry. 
     525     */ 
     526    collectDragHandle: function() { 
     527        var geometry = this.feature.geometry; 
     528        var center = geometry.getBounds().getCenterLonLat(); 
     529        var originGeometry = new OpenLayers.Geometry.Point( 
     530            center.lon, center.lat 
     531        ); 
     532        var origin = new OpenLayers.Feature.Vector(originGeometry); 
     533        originGeometry.move = function(x, y) { 
     534            OpenLayers.Geometry.Point.prototype.move.call(this, x, y); 
     535            geometry.move(x, y); 
     536        } 
     537        this.dragHandle = origin; 
     538        this.layer.addFeatures([this.dragHandle]); 
     539    }, 
     540 
     541    /** 
     542     * Method: collectRadiusHandle 
     543     * Collect the radius handle for the selected geometry. 
     544     */ 
     545    collectRadiusHandle: function() { 
     546        var geometry = this.feature.geometry; 
     547        var bounds = geometry.getBounds(); 
     548        var center = bounds.getCenterLonLat(); 
     549        var originGeometry = new OpenLayers.Geometry.Point( 
     550            center.lon, center.lat 
     551        ); 
     552        var radiusGeometry = new OpenLayers.Geometry.Point( 
     553            bounds.right, bounds.bottom 
     554        ); 
     555        var radius = new OpenLayers.Feature.Vector(radiusGeometry); 
     556        var resize = this.resize; 
     557        var rotate = this.rotate; 
     558        radiusGeometry.move = function(x, y) { 
     559            OpenLayers.Geometry.Point.prototype.move.call(this, x, y); 
     560            var dx1 = this.x - originGeometry.x; 
     561            var dy1 = this.y - originGeometry.y; 
     562            var dx0 = dx1 - x; 
     563            var dy0 = dy1 - y; 
     564            if(rotate) { 
     565                var a0 = Math.atan2(dy0, dx0); 
     566                var a1 = Math.atan2(dy1, dx1); 
     567                var angle = a1 - a0; 
     568                angle *= 180 / Math.PI; 
     569                geometry.rotate(angle, originGeometry); 
     570            } 
     571            if(resize) { 
     572                var l0 = Math.sqrt((dx0 * dx0) + (dy0 * dy0)); 
     573                var l1 = Math.sqrt((dx1 * dx1) + (dy1 * dy1)); 
     574                geometry.resize(l1 / l0, originGeometry); 
     575            } 
     576        } 
     577        this.radiusHandle = radius; 
     578        this.layer.addFeatures([this.radiusHandle]); 
    447579    }, 
    448580 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/PanZoomBar.js

    r5028 r5339  
    4848    divEvents: null, 
    4949 
     50    /**  
     51     * Property: zoomWorldIcon 
     52     * {Boolean} 
     53     */ 
     54    zoomWorldIcon: false, 
     55 
    5056    /** 
    5157     * Constructor: <OpenLayers.Control.PanZoomBar> 
     
    116122        var sz = new OpenLayers.Size(18,18); 
    117123        var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y); 
     124        var wposition = sz.w; 
     125 
     126        if (this.zoomWorldIcon) { 
     127            centered = new OpenLayers.Pixel(px.x+sz.w, px.y); 
     128        } 
    118129 
    119130        this._addButton("panup", "north-mini.png", centered, sz); 
    120131        px.y = centered.y+sz.h; 
    121132        this._addButton("panleft", "west-mini.png", px, sz); 
    122         this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz); 
     133        if (this.zoomWorldIcon) { 
     134            this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 
     135             
     136            wposition *= 2; 
     137        } 
     138        this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 
    123139        this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 
    124140        this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/Scale.js

    r5002 r5339  
    3636     *  
    3737     * Returns: 
    38      * {DOMElemen
     38     * {DOMElement
    3939     */     
    4040    draw: function() { 
  • sandbox/camptocamp/text/lib/OpenLayers/Control/SelectFeature.js

    r5122 r5339  
    219219    }, 
    220220 
    221     /** @final @type String */ 
    222221    CLASS_NAME: "OpenLayers.Control.SelectFeature" 
    223222}); 
  • sandbox/camptocamp/text/lib/OpenLayers/Events.js

    r5002 r5339  
    296296     
    297297        //actually remove the event listener from browser 
    298         if (element.removeEventListener) { 
    299             element.removeEventListener(name, observer, useCapture); 
    300         } else if (element && element.detachEvent) { 
    301             element.detachEvent('on' + name, observer); 
     298        if (foundEntry) { 
     299            if (element.removeEventListener) { 
     300                element.removeEventListener(name, observer, useCapture); 
     301            } else if (element && element.detachEvent) { 
     302                element.detachEvent('on' + name, observer); 
     303            } 
    302304        } 
    303305        return foundEntry; 
  • sandbox/camptocamp/text/lib/OpenLayers/Format/GML.js

    r5028 r5339  
    7373     
    7474    /** 
     75     * APIProperty: xy 
     76     * {Boolean} Order of the GML coordinate true:(x,y) or false:(y,x) 
     77     * Changing is not recommended, a new Format should be instantiated. 
     78     */  
     79    xy: true, 
     80     
     81    /** 
    7582     * Constructor: OpenLayers.Format.GML 
    7683     * Create a new parser for GML. 
    …<