OpenLayers OpenLayers

Changeset 7052

Show
Ignore:
Timestamp:
05/02/08 10:59:54 (8 months ago)
Author:
elemoine
Message:

svn merge -r 6890:HEAD trunk/openlayers

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/vector-behavior/examples/attribution.html

    r7028 r7052  
    1212        </style> 
    1313        <script src="../lib/OpenLayers.js"></script> 
     14 
    1415        <script type="text/javascript"> 
    1516            var map; 
     
    2122                    {'attribution': 'Provided by <a href="http://labs.metacarta.com/">MetaCarta</a>'}); 
    2223 
    23             var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", 
    24                 "http://t1.hypercube.telascience.org/cgi-bin/landsat7",  
    25                 {layers: "landsat7"},{attribution:"Provided by Telascience"}); 
     24                var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic", 
     25                    "http://t1.hypercube.telascience.org/cgi-bin/landsat7",  
     26                    {layers: "landsat7"},{attribution:"Provided by Telascience"}); 
    2627 
    27                 map.addLayers([ol_wms, jpl_wms]); 
     28                var vector = new OpenLayers.Layer.Vector("Simple Geometry", 
     29                              {attribution:"Vector Attibution in 2nd arg"}); 
     30 
     31                map.addLayers([ol_wms, jpl_wms, vector]); 
     32 
    2833                map.addControl(new OpenLayers.Control.LayerSwitcher()); 
    2934                map.addControl(new OpenLayers.Control.Attribution()); 
     
    3742 
    3843        <div id="tags"> 
     44            copyright watermark logo attribution 
    3945        </div> 
    4046 
     
    4854            This is an example of how to add an attribution block to the OpenLayers window.  In order to use an 
    4955            attribution block, an attribution parameter must be set in each layer that requires attribution. In 
    50             addition, an attribution control must be added to the map. 
     56            addition, an attribution control must be added to the map, though one is added to all OpenLayers Maps by default.  
     57            Be aware that this is a layer *option*: the options hash goes in 
     58            different places depending on the layer type you are using.   
    5159        </div> 
    5260    </body> 
  • sandbox/vector-behavior/examples/click.html

    r7028 r7052  
    3131                    this.handler = new OpenLayers.Handler.Click( 
    3232                        this, { 
    33                             'click': this.trigger, 
     33                            'click': this.trigger 
    3434                        }, this.handlerOptions 
    3535                    ); 
     
    4040                    alert("You clicked near " + lonlat.lat + " N, " + 
    4141                                              + lonlat.lon + " E"); 
    42                 }, 
     42                } 
    4343 
    4444            }); 
  • sandbox/vector-behavior/lib/OpenLayers/Ajax.js

    r6673 r7052  
    4444 * Parameters: 
    4545 * uri - {String} URI of source doc 
    46  * params - {String} Params on get (doesnt seem to work) 
     46 * params - {String} or {Object} GET params. Either a string in the form 
     47 *     "?hello=world&foo=bar" (do not forget the leading question mark) 
     48 *     or an object in the form {'hello': 'world', 'foo': 'bar} 
    4749 * caller - {Object} object which gets callbacks 
    4850 * onComplete - {Function} Optional callback for success.  The callback 
  • sandbox/vector-behavior/lib/OpenLayers/Format/SLD.js

    r7028 r7052  
    66 * @requires OpenLayers/Format/XML.js 
    77 * @requires OpenLayers/Style.js 
     8 * @requires OpenLayers/Rule.js 
    89 * @requires OpenLayers/Filter/FeatureId.js 
    910 * @requires OpenLayers/Filter/Logical.js 
  • sandbox/vector-behavior/lib/OpenLayers/Format/SLD/v1.js

    r6818 r7052  
    44 
    55/** 
     6 * @requires OpenLayers/Rule.js 
     7 * @requires OpenLayers/Filter.js 
     8 * @requires OpenLayers/Filter/FeatureId.js 
     9 * @requires OpenLayers/Filter/Logical.js 
     10 * @requires OpenLayers/Filter/Comparison.js 
    611 * @requires OpenLayers/Format/SLD.js 
    712 */ 
  • sandbox/vector-behavior/lib/OpenLayers/Layer/GeoRSS.js

    r7028 r7052  
    191191             
    192192            if (title || description) { 
     193                // we have supplemental data, store them. 
     194                data.title = title; 
     195                data.description = description; 
     196             
    193197                var contentHTML = '<div class="olLayerGeoRSSClose">[x]</div>';  
    194198                contentHTML += '<div class="olLayerGeoRSSTitle">'; 
  • sandbox/vector-behavior/lib/OpenLayers/Layer/Text.js

    r7028 r7052  
    172172            // FIXME: At the moment, we only use this if we have an  
    173173            // externalGraphic, because icon has no setOffset API Method.   
    174             if (feature.style.graphicXOffset  
    175                 && feature.style.graphicYOffset) { 
     174            if (feature.style.graphicXOffset !== null 
     175                && feature.style.graphicYOffset !== null) { 
    176176                iconOffset = new OpenLayers.Pixel( 
    177177                    feature.style.graphicXOffset,  
  • sandbox/vector-behavior/lib/OpenLayers/Layer/Vector.js

    r7028 r7052  
    1313 * Class: OpenLayers.Layer.Vector 
    1414 * Instances of OpenLayers.Layer.Vector are used to render vector data from 
    15  * a variety of sources. Create a new image layer with the 
    16  * <OpenLayers.Layer.Vector> constructor. 
     15 *     a variety of sources. Create a new vector layer with the 
     16 *     <OpenLayers.Layer.Vector> constructor. 
    1717 * 
    1818 * Inherits from: 
     
    152152     * Parameters: 
    153153     * name - {String} A name for the layer 
    154      * options - {Object} options Object with non-default properties to set on 
     154     * options - {Object} Optional object with non-default properties to set on 
    155155     *           the layer. 
    156156     * 
     
    535535    }, 
    536536 
     537    /**  
     538     * APIMethod: getDataExtent 
     539     * Calculates the max extent which includes all of the features. 
     540     *  
     541     * Returns: 
     542     * {<OpenLayers.Bounds>} 
     543     */ 
     544    getDataExtent: function () { 
     545        var maxExtent = null; 
     546        if( this.features && (this.features.length > 0)){ 
     547            var maxExtent = this.features[0].geometry.getBounds(); 
     548            for(var i=0; i < this.features.length; i++){ 
     549                maxExtent.extend(this.features[i].geometry.getBounds()); 
     550            } 
     551        } 
     552 
     553        return maxExtent; 
     554    }, 
     555 
    537556    CLASS_NAME: "OpenLayers.Layer.Vector" 
    538557}); 
  • sandbox/vector-behavior/lib/OpenLayers/Popup/Anchored.js

    r7028 r7052  
    1919    /**  
    2020     * Parameter: relativePosition 
    21      * {String} Relative position of the popup ("lr", "ll", "tr", or "tl"). 
     21     * {String} Relative position of the popup ("br", "tr", "tl" or "bl"). 
    2222     */ 
    2323    relativePosition: null, 
     
    127127     *  
    128128     * Returns: 
    129      * {String} The relative position ("br" "tr" "tl "bl") at which the popup 
     129     * {String} The relative position ("br" "tr" "tl" "bl") at which the popup 
    130130     *     should be placed. 
    131131     */ 
  • sandbox/vector-behavior/lib/OpenLayers/Rule.js

    r6833 r7052  
    6666     * Property: symbolizer 
    6767     * {Object} Symbolizer or hash of symbolizers for this rule. If hash of 
    68      * symbolizers, keys are one or more of ["Point", "Line", "Polygon"] 
     68     * symbolizers, keys are one or more of ["Point", "Line", "Polygon"]. The 
     69     * latter if useful if it is required to style e.g. vertices of a line 
     70     * with a point symbolizer. Note, however, that this is not implemented 
     71     * yet in OpenLayers, but it is the way how symbolizers are defined in 
     72     * SLD. 
    6973     */ 
    7074    symbolizer: null, 
  • sandbox/vector-behavior/lib/OpenLayers/Util.js

    r7028 r7052  
    198198 * Creates a new div and optionally set some standard attributes. 
    199199 * Null may be passed to each parameter if you do not wish to 
    200  * set a particular attribute.d 
    201  *  
    202  * Note: zIndex is NOT set 
     200 * set a particular attribute. 
     201 * Note - zIndex is NOT set on the resulting div. 
    203202 *  
    204203 * Parameters: 
     
    417416                                               opacity) { 
    418417 
    419     OpenLayers.Util.modifyDOMElement(div, id, px, sz,  
    420                                      null, null, null, opacity); 
     418    OpenLayers.Util.modifyDOMElement(div, id, px, sz, position, 
     419                                     null, null, opacity); 
    421420 
    422421    var img = div.childNodes[0]; 
  • sandbox/vector-behavior/tests/Layer/GeoRSS.html

    r7028 r7052  
    1717 
    1818    function test_Layer_GeoRSS_constructor (t) { 
    19         t.plan( 5 ); 
     19        t.plan( 7 ); 
    2020        layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt ); 
    2121        t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" ); 
     
    2626            t.eq( layer.markers.length, 40, "marker length is correct" ); 
    2727            var ll = new OpenLayers.LonLat(-71.142197, 42.405696); 
     28            var theTitle = "Knitting Room"; 
     29            var theDescription = 'This little shop is jammed full. Yarn, yarn everywhere. They make the most of every possible nook and cranny. I like this place also because they have a lot of different kinds of knitting needles in all different sizes. Also, the people who work here are younger and hipper than in the other stores I go to. I reccomend buying supplies here and then knitting your way through a good documentary at the Capitol Theater across the street.<br/>Address: 2 lake St, Arlington, MA <br/>Tags: knitting, yarn, pins and needles, handspun, hand dyed, novelty yarn, fancy, simple, young, hip, friendly, needles, addy, cute hats<br /><br /><a href="http://platial.com/place/90306">Map this on Platial</a><br /> <a href="http://platial.com/place_grab/90306">Grab this on Platial</a> '; 
    2830            t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" ); 
    2931            t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." ); 
     32            t.eq( layer.features[0].data.title, theTitle); 
     33            t.eq( layer.features[0].data.description, theDescription); 
    3034        } ); 
    3135    } 
  • sandbox/vector-behavior/tests/Layer/Vector.html

    r7028 r7052  
    1717     
    1818    function test_Layer_Vector_addFeatures(t) { 
    19         t.plan(4); 
     19        t.plan(8); 
    2020     
    2121        var layer = new OpenLayers.Layer.Vector(name); 
     
    2626        layer.preFeatureInsert = function(feature) { 
    2727            t.ok(feature == pointFeature, "OpenLayers.Layer.Vector.addFeatures calls preFeatureInsert with the right arg"); 
    28         } 
     28        }; 
    2929        layer.onFeatureInsert = function(feature) { 
    3030            t.ok(feature == pointFeature, "OpenLayers.Layer.Vector.addFeatures calls onFeatureInsert with the right arg"); 
    31         } 
     31        }; 
     32        layer.events.register('beforefeatureadded', null, function(obj) { 
     33            t.ok(pointFeature == obj.feature, "OpenLayers.Layer.Vector.addFeatures triggers beforefeatureadded with correct feature passed to callback"); 
     34        }); 
     35        layer.events.register('featureadded', null, function(obj) { 
     36            t.ok(pointFeature == obj.feature, "OpenLayers.Layer.Vector.addFeatures triggers featureadded with correct feature passed to callback"); 
     37        }); 
     38        layer.events.register('featuresadded', null, function(obj) { 
     39            t.ok(pointFeature == obj.features[0], "OpenLayers.Layer.Vector.addFeatures triggers featuresadded with correct features passed to callback"); 
     40        }); 
    3241 
    3342        layer.addFeatures([pointFeature]); 
     
    3847        layer.preFeatureInsert = function(feature) { 
    3948            t.fail("OpenLayers.Layer.Vector.addFeatures calls preFeatureInsert while it must not"); 
    40         } 
     49        }; 
    4150        layer.onFeatureInsert = function(feature) { 
    4251            t.fail("OpenLayers.Layer.Vector.addFeatures calls onFeatureInsert while it must not"); 
    43         } 
     52        }; 
     53        layer.events.register('beforefeatureadded', null, function(obj) { 
     54            t.fail("OpenLayers.Layer.Vector.addFeatures triggers beforefeatureadded while it must not"); 
     55        }); 
     56        layer.events.register('featureadded', null, function(obj) { 
     57            t.fail("OpenLayers.Layer.Vector.addFeatures triggers featureadded while it must not"); 
     58        }); 
     59        layer.events.register('featuresadded', null, function(obj) { 
     60            t.fail("OpenLayers.Layer.Vector.addFeatures triggers featuresadded while it must not"); 
     61        }); 
    4462 
    4563        layer.addFeatures([pointFeature], {silent: true}); 
     64 
     65        var extent = layer.getDataExtent(); 
     66        t.eq(extent.toBBOX(), "-111.04,45.68,-111.04,45.68", "extent from getDataExtent is correct"); 
    4667    } 
    4768 
  • sandbox/vector-behavior/tests/Style.html

    r6818 r7052  
    128128     
    129129    function test_Style_context(t) { 
    130         t.plan(1); 
     130        t.plan(2); 
    131131        var rule = new OpenLayers.Rule({ 
    132132            symbolizer: {"Point": {externalGraphic: "${img1}"}}, 
     
    146146        var styleHash = style.createSymbolizer(feature); 
    147147        t.eq(styleHash.externalGraphic, "myImage.png", "correctly evaluated rule and calculated property styles from a custom context"); 
    148     } 
    149      
     148         
     149        // same as above, but without rule (#1526) 
     150        style = new OpenLayers.Style( 
     151            {externalGraphic: "${getExternalGraphic}"}, 
     152            {context: { 
     153                getExternalGraphic: function(feature) { 
     154                    return "foo" + feature.attributes.size + ".png"; 
     155                } 
     156            }}); 
     157        t.eq(style.createSymbolizer(feature).externalGraphic, "foo10.png", "correctly evaluated symbolizer without rule"); 
     158    }; 
     159         
    150160    function test_Style_findPropertyStyles(t) { 
    151161        t.plan(4);