OpenLayers OpenLayers

Changeset 1079

Show
Ignore:
Timestamp:
08/03/06 17:28:20 (2 years ago)
Author:
sderle
Message:

Made Layer.Boxes actually work.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/euzuro/layerswitcher/lib/OpenLayers.js

    r1021 r1079  
    5959        "OpenLayers/Icon.js", 
    6060        "OpenLayers/Marker.js", 
     61        "OpenLayers/Marker/Box.js", 
    6162        "OpenLayers/Popup.js", 
    6263        "OpenLayers/Tile.js", 
     
    7879        "OpenLayers/Layer/WMS/Untiled.js", 
    7980        "OpenLayers/Layer/GeoRSS.js", 
     81        "OpenLayers/Layer/Boxes.js", 
    8082        "OpenLayers/Popup/Anchored.js", 
    8183        "OpenLayers/Popup/AnchoredBubble.js", 
  • sandbox/euzuro/layerswitcher/lib/OpenLayers/Layer/Boxes.js

    r1077 r1079  
    99OpenLayers.Layer.Boxes.prototype =  
    1010    Object.extend( new OpenLayers.Layer.Markers(), { 
     11 
     12    initialize: function () { 
     13        OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments); 
     14    }, 
    1115     
    1216    /** Calculate the pixel location for the marker, create it, and 
     
    2327        var botright = this.map.getLayerPxFromLonLat( 
    2428                             new OpenLayers.LonLat(bounds.right, bounds.bottom)); 
    25         if (botleft == null || topright == null) { 
     29        if (botright == null || topleft == null) { 
    2630            marker.display(false); 
    2731        } else { 
  • sandbox/euzuro/layerswitcher/lib/OpenLayers/Marker/Box.js

    r1077 r1079  
    66*/ 
    77OpenLayers.Marker.Box = Class.create(); 
    8 OpenLayers.Marker.prototype = Object.extend( new OpenLayers.Marker(), { 
     8OpenLayers.Marker.Box.prototype = Object.extend( new OpenLayers.Marker(), { 
    99    /** @type OpenLayers.LonLat */ 
    1010    bounds: null, 
    11  
    12     borderColor: null, 
    13  
    14     borderWidth: null, 
    1511 
    1612    div: null, 
     
    2218    * @param {OpenLayers.LonLat lonlat 
    2319    */ 
    24     initialize: function(bounds) { 
    25         this.bounds = bounds; 
    26         this.div    = OpenLayers.Util.createDiv(); 
    27         this.events = new OpenLayers.Events(this, this.div, null); 
     20    initialize: function(bounds, borderColor, borderWidth) { 
     21        if (arguments.length > 0) { 
     22            this.bounds = bounds; 
     23            this.div    = OpenLayers.Util.createDiv(); 
     24            this.events = new OpenLayers.Events(this, this.div, null); 
     25            this.setBorder(borderColor, borderWidth); 
     26        } 
     27    }, 
     28 
     29    setBorder: function (color, width) { 
     30        if (!color) color = "red"; 
     31        if (!width) width = 2; 
     32        this.div.style.border = width + "px solid " + color; 
    2833    }, 
    2934     
     
    3742    draw: function(px, sz) { 
    3843        OpenLayers.Util.modifyDOMElement(this.div, null, px, sz); 
     44        return this.div; 
    3945    },  
    4046