OpenLayers OpenLayers

Changeset 3177

Show
Ignore:
Timestamp:
05/24/07 10:43:07 (2 years ago)
Author:
crschmidt
Message:

Pullup trunk for RC4.
Fixes:
#694 Safari 1.3.2 doesn't work with OL 2.4
#695 GeoRSS serializer is broken
#696 events need to fall through the overview map extent rectangle
#697 Vector example to show how to use styles
#698 add close box option to AnchoredBubble
#701 SVG render does not always clear features when map extent changes
#703 OpenLayers.Layer.Vector do not properly destroy its features
#706 Full CSS support fails when Control.OverviewMap is loaded
#708 change WKT format to deal in features instead of geometries
#710 Install instructions unclear
#711 OpenLayers.Layer.Image requires OpenLayers.Tile.Image
#715 layer.js needs sanity check
#718 WMS.Untiled Clone doesn't work
#719 SVG renderer does not always redraw LineStrings and Polygons
#720 remove console.log() from OpenLayers.Format.WKT

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/openlayers/2.4/doc/authors.txt

    r2948 r3177  
    22Howard Butler 
    33Bertil Chaupis                                                                
     4John Cole 
    45Jeff Dege 
    56Schuyler Erle 
  • branches/openlayers/2.4/examples/georss-serialize.html

    r2978 r3177  
    33    <style type="text/css"> 
    44        #map { 
    5             width: 512px
     5            width: 45%
    66            height: 350px; 
    77            border: 1px solid gray; 
     
    4343  <body onload="init()"> 
    4444    <h1>OpenLayers Draw Point Example</h1> 
    45     <div style="float:right"> 
    46     <textarea id="gml" cols="80" rows="30"></textarea> 
     45    <div style="float:right;width:50%"> 
     46    <textarea id="gml" style="width:100%" rows="30"></textarea> 
    4747    </div> 
    4848    <div id="map"></div> 
  • branches/openlayers/2.4/examples/popups.html

    r1704 r3177  
    4848                                         new OpenLayers.LonLat(5,40), 
    4949                                         new OpenLayers.Size(200,200), 
    50                                          "example popup"); 
     50                                         "example popup", true); 
    5151         
    5252            map.addPopup(popup); 
     
    7070         
    7171        function mousedown(evt) { 
     72             // check to see if the popup was hidden by the close box 
     73             // if so, then destroy it before continuing 
     74            if (popup != null) { 
     75                if (!popup.visible()) { 
     76                    markers.map.removePopup(popup); 
     77                    popup.destroy(); 
     78                    popup = null; 
     79                } 
     80            } 
    7281            if (popup == null) { 
    73                 popup = feature.createPopup(); 
     82                popup = feature.createPopup(true); 
    7483                popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>"); 
    7584                popup.setBackgroundColor("yellow"); 
  • branches/openlayers/2.4/examples/vector-features.html

    r3088 r3177  
    1818                    "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} ); 
    1919            map.addLayer(layer); 
     20             
     21            var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']); 
     22            style_blue.strokeColor = "blue";  
     23            style_blue.fillColor = "blue";  
     24            var style_green = { 
     25                strokeColor: "#00FF00", 
     26                strokeOpacity: 1, 
     27                strokeWidth: 3, 
     28                pointRadius: 6, 
     29                pointerEvents: "visiblePainted" 
     30            }; 
     31             
    2032            var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry"); 
    2133             
    2234            // create a point feature 
    2335            var point = new OpenLayers.Geometry.Point(-111.04, 45.68); 
    24             var pointFeature = new OpenLayers.Feature.Vector(point); 
     36            var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue); 
    2537             
    2638            // create a line feature from a list of points 
     
    3345            } 
    3446            var lineFeature = new OpenLayers.Feature.Vector( 
    35                 new OpenLayers.Geometry.LineString(pointList)); 
     47                new OpenLayers.Geometry.LineString(pointList),null,style_green); 
    3648             
    3749            // create a polygon feature from a linear ring of points 
     
    6072  <body onload="init()"> 
    6173    <div id="map"></div> 
     74    <p>This example shows drawing simple vector features -- point, line, polygon 
     75       in different styles, created 'manually', by constructing the entire style 
     76       object, via 'copy', extending the default style object, and by  
     77       inheriting the default style from the layer.</p> 
    6278  </body> 
    6379</html> 
  • branches/openlayers/2.4/examples/wkt.html

    r3088 r3177  
    7979         
    8080        function displayWKT(feature) { 
    81             var str = wkt.write(feature.geometry); 
     81            var str = wkt.write(feature); 
    8282            // not a good idea in general, just for this demo 
    8383            str = str.replace(/,/g, ', '); 
     
    8787        function parseWKT() { 
    8888            var element = document.getElementById('wkt'); 
    89             var collection = wkt.read(element.value); 
     89            var features = wkt.read(element.value); 
    9090            var bounds; 
    91             if(collection) { 
    92                 if(collection.constructor != Array) { 
    93                     collection = [collection]; 
     91            if(features) { 
     92                if(features.constructor != Array) { 
     93                    features = [features]; 
    9494                } 
    95                 var features = []; 
    96                 for(var i=0; i<collection.length; ++i) { 
    97                     features.push(new OpenLayers.Feature.Vector(collection[i])); 
     95                for(var i=0; i<features.length; ++i) { 
    9896                    if (!bounds) { 
    99                         bounds = collection[i].getBounds(); 
     97                        bounds = features[i].geometry.getBounds(); 
     98                    } else { 
     99                        bounds.extend(features[i].geometry.getBounds()); 
    100100                    } 
    101                     bounds.extend(collection[i].getBounds()); 
    102101                     
    103102                } 
  • branches/openlayers/2.4/lib/OpenLayers/BaseTypes.js

    r2943 r3177  
    3232            //  
    3333            // to be revisited in 3.0 
    34             //  
    35             if (arguments[i].hasOwnProperty('toString')) { 
     34            // 
     35            if((arguments[i].hasOwnProperty && arguments[i].hasOwnProperty('toString')) || 
     36               (!arguments[i].hasOwnProperty && arguments[i].toString)) { 
    3637                proto.toString = arguments[i].toString; 
    3738            } 
  • branches/openlayers/2.4/lib/OpenLayers/Control/OverviewMap.js

    r3112 r3177  
    181181            OpenLayers.Event.stop(e); 
    182182        }); 
    183         this.rectEvents = new OpenLayers.Events(this, this.extentRectangle); 
     183        this.rectEvents = new OpenLayers.Events(this, this.extentRectangle, 
     184                                                null, true); 
    184185        this.rectEvents.register('mouseout', this, this.rectMouseOut); 
    185186        this.rectEvents.register('mousedown', this, this.rectMouseDown); 
  • branches/openlayers/2.4/lib/OpenLayers/Feature.js

    r2894 r3177  
    122122 
    123123    /** 
     124     * @param {Boolean} closeBox create popup with closebox or not 
    124125     * @returns A Popup Object created from the 'lonlat', 'popupSize', 
    125126     *          and 'popupContentHTML' properties set in this.data. It uses 
     
    133134     * @type OpenLayers.Popup.AnchoredBubble 
    134135     */ 
    135     createPopup: function() { 
     136    createPopup: function(closeBox) { 
    136137 
    137138        if (this.lonlat != null) { 
     
    144145                                                    this.data.popupSize, 
    145146                                                    this.data.popupContentHTML, 
    146                                                     anchor);  
     147                                                    anchor, closeBox);  
    147148        }         
    148149        return this.popup; 
  • branches/openlayers/2.4/lib/OpenLayers/Format/GeoRSS.js

    r2978 r3177  
    9898        if (points) { 
    9999            for (var i = 0; i < points.length; i++) { 
    100                 path += points[i].lat + " " + points[i].lon + " "; 
     100                path += points[i].y + " " + points[i].x + " "; 
    101101            } 
    102102        } else { 
    103            path += geometry.lat + " " + geometry.lon + " "; 
     103           path += geometry.y + " " + geometry.x + " "; 
    104104        } 
    105105        return document.createTextNode(path); 
  • branches/openlayers/2.4/lib/OpenLayers/Format/WKT.js

    r2978 r3177  
    2626 
    2727    /** 
    28      * Deserialize a WKT string and return an OpenLayers.Geometry or an array 
    29      * of OpenLayers.Geometry.  Supports WKT for POINT, MULTIPOINT, LINESTRING, 
    30      * MULTILINESTRING, POLYGON, MULTIPOLYGON, and GEOMETRYCOLLECTION. 
     28     * Deserialize a WKT string and return an OpenLayers.Feature.Vector or an 
     29     * array of OpenLayers.Feature.Vector.  Supports WKT for POINT, MULTIPOINT, 
     30     * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and 
     31     * GEOMETRYCOLLECTION. 
    3132     * @param {String} wkt A WKT string 
    32      * @returns {OpenLayers.Geometry|Array} A geometry or array of geometries 
    33      *                                      for GEOMETRYCOLLECTION WKT. 
     33     * @returns {OpenLayers.Feature.Vector|Array} A feature or array of 
     34     *                                            features for 
     35     *                                            GEOMETRYCOLLECTION WKT. 
    3436     */ 
    3537    read: function(wkt) { 
    36         var geometry, type, str; 
     38        var features, type, str; 
    3739        var matches = this.regExes.typeStr.exec(wkt); 
    3840        if(matches) { 
     
    4042            str = matches[2]; 
    4143            if(this.parse[type]) { 
    42                 geometry = this.parse[type].apply(this, [str]); 
    43             } 
    44         } 
    45         return geometry; 
    46     }, 
    47  
    48     /** 
    49      * Serialize a geometry or array of geometries into a WKT string. 
    50      * @param {OpenLayers.Geometry|Array} geom A geometry or array of geometries 
     44                features = this.parse[type].apply(this, [str]); 
     45            } 
     46        } 
     47        return features; 
     48    }, 
     49 
     50    /** 
     51     * Serialize a feature or array of features into a WKT string. 
     52     * @param {OpenLayers.Feature.Vector|Array} features A feature or array of 
     53     *                                                   features 
    5154     * @returns {String} The WKT string representation of the input geometries 
    5255     */ 
    53     write: function(geom) { 
     56    write: function(features) { 
    5457        var collection, geometry, type, data, isCollection; 
    55         if(geom.constructor == Array) { 
    56             collection = geom
     58        if(features.constructor == Array) { 
     59            collection = features
    5760            isCollection = true; 
    5861        } else { 
    59             collection = [geom]; 
     62            collection = [features]; 
    6063            isCollection = false; 
    6164        } 
     
    6871                pieces.push(','); 
    6972            } 
    70             geometry = collection[i]
     73            geometry = collection[i].geometry
    7174            type = geometry.CLASS_NAME.split('.')[2].toLowerCase(); 
    7275            if(!this.extract[type]) { 
     
    179182    parse: { 
    180183        /** 
    181          * Return point geometry given a point WKT fragment. 
     184         * Return point feature given a point WKT fragment. 
    182185         * @param {String} str A WKT fragment representing the point 
    183          * @returns {OpenLayers.Geometry.Point} A point geometry 
     186         * @returns {OpenLayers.Feature.Vector} A point feature 
     187         * @private 
    184188         */ 
    185189        'point': function(str) { 
    186190            var coords = str.trim().split(this.regExes.spaces); 
    187             return new OpenLayers.Geometry.Point(coords[0], coords[1]); 
    188         }, 
    189  
    190         /** 
    191          * Return a multipoint geometry given a multipoint WKT fragment. 
     191            return new OpenLayers.Feature.Vector( 
     192                new OpenLayers.Geometry.Point(coords[0], coords[1]) 
     193            ); 
     194        }, 
     195 
     196        /** 
     197         * Return a multipoint feature given a multipoint WKT fragment. 
    192198         * @param {String} A WKT fragment representing the multipoint 
    193          * @returns {OpenLayers.Geometry.MultiPoint} A multipoint geometry 
     199         * @returns {OpenLayers.Feature.Vector} A multipoint feature 
     200         * @private 
    194201         */ 
    195202        'multipoint': function(str) { 
     
    197204            var components = []; 
    198205            for(var i=0; i<points.length; ++i) { 
    199                 components.push(this.parse.point.apply(this, [points[i]])); 
    200             } 
    201             return new OpenLayers.Geometry.MultiPoint(components); 
     206                components.push(this.parse.point.apply(this, [points[i]]).geometry); 
     207            } 
     208            return new OpenLayers.Feature.Vector( 
     209                new OpenLayers.Geometry.MultiPoint(components) 
     210            ); 
    202211        }, 
    203212         
    204213        /** 
    205          * Return a linestring geometry given a linestring WKT fragment. 
     214         * Return a linestring feature given a linestring WKT fragment. 
    206215         * @param {String} A WKT fragment representing the linestring 
    207          * @returns {OpenLayers.Geometry.LineString} A linestring geometry 
     216         * @returns {OpenLayers.Feature.Vector} A linestring feature 
     217         * @private 
    208218         */ 
    209219        'linestring': function(str) { 
     
    211221            var components = []; 
    212222            for(var i=0; i<points.length; ++i) { 
    213                 components.push(this.parse.point.apply(this, [points[i]])); 
    214             } 
    215             return new OpenLayers.Geometry.LineString(components); 
    216         }, 
    217  
    218         /** 
    219          * Return a multilinestring geometry given a multilinestring WKT fragment. 
     223                components.push(this.parse.point.apply(this, [points[i]]).geometry); 
     224            } 
     225            return new OpenLayers.Feature.Vector( 
     226                new OpenLayers.Geometry.LineString(components) 
     227            ); 
     228        }, 
     229 
     230        /** 
     231         * Return a multilinestring feature given a multilinestring WKT fragment. 
    220232         * @param {String} A WKT fragment representing the multilinestring 
    221          * @returns {OpenLayers.Geometry.LineString} A multilinestring geometry 
     233         * @returns {OpenLayers.Feature.Vector} A multilinestring feature 
     234         * @private 
    222235         */ 
    223236        'multilinestring': function(str) { 
     
    227240            for(var i=0; i<lines.length; ++i) { 
    228241                line = lines[i].replace(this.regExes.trimParens, '$1'); 
    229                 components.push(this.parse.linestring.apply(this, [line])); 
    230             } 
    231             return new OpenLayers.Geometry.MultiLineString(components); 
     242                components.push(this.parse.linestring.apply(this, [line]).geometry); 
     243            } 
     244            return new OpenLayers.Feature.Vector( 
     245                new OpenLayers.Geometry.MultiLineString(components) 
     246            ); 
    232247        }, 
    233248         
    234249        /** 
    235          * Return a polygon geometry given a polygon WKT fragment. 
     250         * Return a polygon feature given a polygon WKT fragment. 
    236251         * @param {String} A WKT fragment representing the polygon 
    237          * @returns {OpenLayers.Geometry.Polygon} A polygon geometry 
     252         * @returns {OpenLayers.Feature.Vector} A polygon feature 
     253         * @private 
    238254         */ 
    239255        'polygon': function(str) { 
     
    243259            for(var i=0; i<rings.length; ++i) { 
    244260                ring = rings[i].replace(this.regExes.trimParens, '$1'); 
    245                 linestring = this.parse.linestring.apply(this, [ring])
    246                 linearring = new OpenLayers.Geometry.LinearRing(linestring.components); 
     261                linestring = this.parse.linestring.apply(this, [ring]).geometry
     262                linearring = new OpenLayers.Geometry.LinearRing(linestring.components) 
    247263                components.push(linearring); 
    248264            } 
    249             return new OpenLayers.Geometry.Polygon(components); 
    250         }, 
    251  
    252         /** 
    253          * Return a multipolygon geometry given a multipolygon WKT fragment. 
     265            return new OpenLayers.Feature.Vector( 
     266                new OpenLayers.Geometry.Polygon(components) 
     267            ); 
     268        }, 
     269 
     270        /** 
     271         * Return a multipolygon feature given a multipolygon WKT fragment. 
    254272         * @param {String} A WKT fragment representing the multipolygon 
    255          * @returns {OpenLayers.Geometry.MultiPolygon} A multipolygon geometry 
     273         * @returns {OpenLayers.Feature.Vector} A multipolygon feature 
     274         * @private 
    256275         */ 
    257276        'multipolygon': function(str) { 
     
    261280            for(var i=0; i<polygons.length; ++i) { 
    262281                polygon = polygons[i].replace(this.regExes.trimParens, '$1'); 
    263                 components.push(this.parse.polygon.apply(this, [polygon])); 
    264             } 
    265             return new OpenLayers.Geometry.MultiPolygon(components); 
    266         }, 
    267  
    268         /** 
    269          * Return an array of geometries given a geometrycollection WKT fragment. 
     282                components.push(this.parse.polygon.apply(this, [polygon]).geometry); 
     283            } 
     284            return new OpenLayers.Feature.Vector( 
     285                new OpenLayers.Geometry.MultiPolygon(components) 
     286            ); 
     287        }, 
     288 
     289        /** 
     290         * Return an array of features given a geometrycollection WKT fragment. 
    270291         * @param {String} A WKT fragment representing the geometrycollection 
    271          * @returns {Array} An array of OpenLayers.Geometry 
     292         * @returns {Array} An array of OpenLayers.Feature.Vector 
     293         * @private 
    272294         */ 
    273295        'geometrycollection': function(str) { 
  • branches/openlayers/2.4/lib/OpenLayers/Geometry.js

    r3088 r3177  
    66 * @class 
    77 * @requires OpenLayers/Format/WKT.js 
     8 * @requires OpenLayers/Feature/Vector.js 
    89 */ 
    910OpenLayers.Geometry = OpenLayers.Class.create(); 
     
    151152     */ 
    152153    toString: function() { 
    153        return OpenLayers.Format.WKT.prototype.write(this); 
     154        return OpenLayers.Format.WKT.prototype.write( 
     155            new OpenLayers.Feature.Vector(this) 
     156        ); 
    154157    }, 
    155158 
  • branches/openlayers/2.4/lib/OpenLayers/Layer.js

    r3112 r3177  
    609609            var size = this.map.getSize(); 
    610610            var center = this.map.getCenter(); 
    611             var res  = this.map.getResolution(); 
    612          
    613             var delta_x = viewPortPx.x - (size.w / 2); 
    614             var delta_y = viewPortPx.y - (size.h / 2); 
    615              
    616             lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , 
    617                                          center.lat - delta_y * res);  
     611            if (center) { 
     612                var res  = this.map.getResolution(); 
     613         
     614                var delta_x = viewPortPx.x - (size.w / 2); 
     615                var delta_y = viewPortPx.y - (size.h / 2); 
     616             
     617                lonlat = new OpenLayers.LonLat(center.lon + delta_x * res , 
     618                                             center.lat - delta_y * res);  
     619            } // else { DEBUG STATEMENT } 
    618620        } 
    619621        return lonlat; 
  • branches/openlayers/2.4/lib/OpenLayers/Layer/Image.js

    r3088 r3177  
    1212 *  
    1313 * @requires OpenLayers/Layer.js 
     14 * @requires OpenLayers/Tile/Image.js 
    1415 */ 
    1516OpenLayers.Layer.Image = OpenLayers.Class.create(); 
  • branches/openlayers/2.4/lib/OpenLayers/Layer/Vector.js

    r3112 r3177  
    9898        OpenLayers.Layer.prototype.destroy.apply(this, arguments);   
    9999 
    100         // HACK HACK -- I believe we should be iterating and  
    101         //              calling feature[i].destroy() here.  
     100        this.destroyFeatures(); 
    102101        this.features = null; 
    103102        this.selectedFeatures = null; 
     
    248247            this.features = OpenLayers.Util.removeItem(this.features, feature); 
    249248 
    250             this.renderer.eraseGeometry(feature.geometry); 
    251              
     249            if (feature.geometry) { 
     250                this.renderer.eraseGeometry(feature.geometry); 
     251            } 
     252                     
    252253            //in the case that this feature is one of the selected features,  
    253254            // remove it from that array as well. 
  • branches/openlayers/2.4/lib/OpenLayers/Layer/WMS/Untiled.js

    r2979 r3177  
    9393 
    9494        // copy/set any non-init, non-simple values here 
    95  
     95         
     96        obj.tile = null; 
     97         
    9698        return obj; 
    9799    },     
  • branches/openlayers/2.4/lib/OpenLayers/Map.js

    r2958 r3177  
    200200        // only append link stylesheet if the theme property is set 
    201201        if(this.theme) { 
    202             var cssNode = document.createElement('link'); 
    203             cssNode.setAttribute('rel', 'stylesheet'); 
    204             cssNode.setAttribute('type', 'text/css'); 
    205             cssNode.setAttribute('href', this.theme); 
    206             document.getElementsByTagName('head')[0].appendChild(cssNode); 
     202            // check existing links for equivalent url 
     203            var addNode = true; 
     204            var nodes = document.getElementsByTagName('link'); 
     205            for(var i=0; i<nodes.length; ++i) { 
     206                if(OpenLayers.Util.isEquivalentUrl(nodes.item(i).href, 
     207                                                   this.theme)) { 
     208                    addNode = false; 
     209                    break; 
     210                } 
     211            } 
     212            // only add a new node if one with an equivalent url hasn't already 
     213            // been added 
     214            if(addNode) { 
     215                var cssNode = document.createElement('link'); 
     216                cssNode.setAttribute('rel', 'stylesheet'); 
     217                cssNode.setAttribute('type', 'text/css'); 
     218                cssNode.setAttribute('href', this.theme); 
     219                document.getElementsByTagName('head')[0].appendChild(cssNode); 
     220            } 
    207221        } 
    208222 
  • branches/openlayers/2.4/lib/OpenLayers/Popup.js

    r3088 r3177  
    4646    /** @type DOMElement */ 
    4747    contentDiv:null, 
     48     
     49    /** @type DOMElement */ 
     50    groupDiv:null, 
    4851 
    4952    /** @type int */ 
     
    8588                                             null, null, null, "hidden"); 
    8689        this.div.className = 'olPopup'; 
     90         
     91        this.groupDiv = OpenLayers.Util.createDiv(null, null, null,  
     92                                                    null, "relative", null, 
     93                                                    "hidden"); 
    8794 
    8895        var id = this.div.id + "_contentDiv"; 
     
    9198                                                    "hidden"); 
    9299        this.contentDiv.className = 'olPopupContent';                                             
    93         this.div.appendChild(this.contentDiv); 
     100        this.groupDiv.appendChild(this.contentDiv); 
     101        this.div.appendChild(this.groupDiv); 
    94102 
    95103        if (closeBox == true) { 
     
    103111            closeImg.style.right = this.padding + "px"; 
    104112            closeImg.style.top = this.padding + "px"; 
    105             this.div.appendChild(closeImg); 
     113            this.groupDiv.appendChild(closeImg); 
    106114 
    107115            var closePopup = function(e) { 
  • branches/openlayers/2.4/lib/OpenLayers/Popup/AnchoredBubble.js

    r2094 r3177  
    140140            OpenLayers.Rico.Corner.round(this.div, options); 
    141141        } else { 
    142             OpenLayers.Rico.Corner.reRound(this.contentDiv, options); 
     142            OpenLayers.Rico.Corner.reRound(this.groupDiv, options); 
    143143            //set the popup color and opacity 
    144144            this.setBackgroundColor();  
  • branches/openlayers/2.4/lib/OpenLayers/Renderer/SVG.js

    r3088 r3177  
    283283            node.setAttributeNS(null, "r", radius); 
    284284        } else { 
    285             node.setAttributeNS(null, "cx", ""); 
    286             node.setAttributeNS(null, "cy", ""); 
    287             node.setAttributeNS(null, "r", 0); 
     285            this.root.removeChild(node); 
    288286        }     
    289287             
     
    435433        for(var i = 0; i < components.length; i++) { 
    436434            var component = this.getShortString(components[i]); 
    437             if (!component) { return false; } 
    438             strings.push(component); 
     435            if (component) { 
     436                strings.push(component); 
     437            } 
    439438        } 
    440439        return strings.join(","); 
  • branches/openlayers/2.4/readme.txt

    r1424 r3177  
    2121 
    2222You can use OpenLayers as-is by copying build/OpenLayers.js and the 
    23 entire lib/ directory up to your webserver, putting them in the same 
    24 directory. To include the OpenLayers library in your web page, use: 
     23entire theme/ and img/ directories up to your webserver, putting them  
     24in the same directory. The files can be in subdirectories on your website, or right in the root of the site, as in these examples. To include the OpenLayers library in your web page from the root of the site, use: 
    2525 
    26   <script type="text/javascript" src="OpenLayers.js" /> 
     26  <script type="text/javascript" src="/OpenLayers.js" /> 
     27 
     28As an example, using bash (with the release files in ~/openlayers ): 
     29$ cd /var/www/html 
     30$ cp ~/openlayers/build/OpenLayers.js ./ 
     31$ cp -R ~/openlayers/theme ./ 
     32$ cp -R ~/openlayers/img ./ 
    2733 
    2834If you want to use the multiple-file version of OpenLayers (for, say, 
     
    3137the following to your web page instead: 
    3238 
    33   <script type="text/javascript" src="lib/OpenLayers.js" /> 
     39  <script type="text/javascript" src="/lib/OpenLayers.js" /> 
     40 
     41As an example, using bash (with the release files in ~/openlayers ): 
     42$ cd /var/www/html 
     43$ cp -R ~/openlayers/lib ./ 
     44$ cp -R ~/openlayers/theme ./ 
     45$ cp -R ~/openlayers/img ./ 
     46 
    3447 
    3548------------------------------------ 
  • branches/openlayers/2.4/tests/Format/test_WKT.html

    r2978 r3177  
    66    var points = [];  
    77    for(var i=0; i<12; ++i) {  
    8         points.push(new OpenLayers.Geometry.Point(Math.random() * 100,  
    9                                                   Math.random() * 100));  
     8        points.push(new OpenLayers.Feature.Vector( 
     9            new OpenLayers.Geometry.Point(Math.random() * 100, 
     10                                          Math.random() * 100)) 
     11        );  
    1012    }  
    11     var multipoint = new OpenLayers.Geometry.MultiPoint([  
    12         points[0], points[1], points[2]  
    13     ]);  
     13    var multipoint = new OpenLayers.Feature.Vector( 
     14        new OpenLayers.Geometry.MultiPoint([  
     15            points[0].geometry, points[1].geometry, points[2].geometry 
     16        ]) 
     17    );  
    1418      
    1519    var linestrings = [  
    16         new OpenLayers.Geometry.LineString([points[0], points[1], points[2]]),  
    17         new OpenLayers.Geometry.LineString([points[3], points[4], points[5]])  
     20        new OpenLayers.Feature.Vector( 
     21            new OpenLayers.Geometry.LineString([points[0].geometry, points[1].geometry, points[2].geometry]) 
     22        ),  
     23        new OpenLayers.Feature.Vector( 
     24            new OpenLayers.Geometry.LineString([points[3].geometry, points[4].geometry, points[5].geometry]) 
     25        ) 
    1826    ];  
    1927      
    20     var multilinestring = new OpenLayers.Geometry.MultiLineString([  
    21         linestrings[0], linestrings[1]  
    22     ]);  
     28    var multilinestring = new OpenLayers.Feature.Vector( 
     29        new OpenLayers.Geometry.MultiLineString([  
     30            linestrings[0].geometry, linestrings[1].geometry 
     31        ]) 
     32    );  
    2333  
    2434    var rings = [  
    25         new OpenLayers.Geometry.LinearRing([points[0], points[1], points[2]]),  
    26         new OpenLayers.Geometry.LinearRing([points[3], points[4], points[5]]),  
    27         new OpenLayers.Geometry.LinearRing([points[6], points[7], points[8]]),  
    28         new OpenLayers.Geometry.LinearRing([points[9], points[10], points[11]])  
     35        new OpenLayers.Geometry.LinearRing([points[0].geometry, points[1].geometry, points[2].geometry]),  
     36        new OpenLayers.Geometry.LinearRing([points[3].geometry, points[4].geometry, points[5].geometry]),  
     37        new OpenLayers.Geometry.LinearRing([points[6].geometry, points[7].geometry, points[8].geometry]),  
     38        new OpenLayers.Geometry.LinearRing([points[9].geometry, points[10].geometry, points[11].geometry])  
    2939    ];  
    3040  
    3141    var polygons = [  
    32         new OpenLayers.Geometry.Polygon([rings[0], rings[1]]),  
    33         new OpenLayers.Geometry.Polygon([rings[2], rings[3]])  
     42        new OpenLayers.Feature.Vector( 
     43            new OpenLayers.Geometry.Polygon([rings[0], rings[1]]) 
     44        ),  
     45        new OpenLayers.Feature.Vector( 
     46            new OpenLayers.Geometry.Polygon([rings[2], rings[3]]) 
     47        ) 
    3448    ];  
    3549      
    36     var multipolygon = new OpenLayers.Geometry.MultiPolygon([  
    37         polygons[0], polygons[1]  
    38     ]);  
     50    var multipolygon = new OpenLayers.Feature.Vector( 
     51        new OpenLayers.Geometry.MultiPolygon([  
     52            polygons[0].geometry, polygons[1].geometry  
     53        ]) 
     54    );  
    3955      
    4056    var collection = [points[0], linestrings[0]];  
     
    5470        t.plan(7);  
    5571        var format = new OpenLayers.Format.WKT();  
    56           
     72 
    5773        // test a point  
    5874        t.eq(format.write(points[0]),  
    59              "POINT(" + points[0].x + " " + points[0].y + ")",  
     75             "POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")",  
    6076             "format correctly writes Point WKT");  
    6177  
    6278        // test a multipoint  
    6379        t.eq(format.write(multipoint),  
    64              "MULTIPOINT(" + points[0].x + " " + points[0].y + "," +  
    65                              points[1].x + " " + points[1].y + "," +  
    66                              points[2].x + " " + points[2].y + ")",  
     80             "MULTIPOINT(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     81                             points[1].geometry.x + " " + points[1].geometry.y + "," +  
     82                             points[2].geometry.x + " " + points[2].geometry.y + ")",  
    6783             "format correctly writes MultiPoint WKT");  
    6884  
    6985        // test a linestring  
    7086        t.eq(format.write(linestrings[0]),  
    71              "LINESTRING(" + points[0].x + " " + points[0].y + "," +  
    72                              points[1].x + " " + points[1].y + "," +  
    73                              points[2].x + " " + points[2].y + ")",  
     87             "LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     88                             points[1].geometry.x + " " + points[1].geometry.y + "," +  
     89                             points[2].geometry.x + " " + points[2].geometry.y + ")",  
    7490             "format correctly writes LineString WKT");  
    7591  
    7692        // test a multilinestring  
    7793        t.eq(format.write(multilinestring),  
    78              "MULTILINESTRING((" + points[0].x + " " + points[0].y + "," +  
    79                                    points[1].x + " " + points[1].y + "," +  
    80                                    points[2].x + " " + points[2].y + ")," +  
    81                              "(" + points[3].x + " " + points[3].y + "," +  
    82                                    points[4].x + " " + points[4].y + "," +  
    83                                    points[5].x + " " + points[5].y + "))",  
     94             "MULTILINESTRING((" + points[0].geometry.x + " " + points[0].geometry.y + "," +  
     95                                   points[1].geometry.x + " " + points[1].geometry.y + "," +  
     96                                   points[2].geometry.x + " " + points[2].geometry<