1 /* Copyright (c) 2006-2008 MetaCarta, Inc., published under the Clear BSD
2 * license. See http://svn.openlayers.org/trunk/openlayers/license.txt for the
3 * full text of the license. */
7 * @requires OpenLayers/Marker.js
11 * Class: OpenLayers.Marker.Box
14 * - <OpenLayers.Marker>
16 OpenLayers.Marker.Box = OpenLayers.Class(OpenLayers.Marker, {
20 * {<OpenLayers.Bounds>}
31 * Constructor: OpenLayers.Marker.Box
34 * bounds - {<OpenLayers.Bounds>}
35 * borderColor - {String}
38 initialize: function(bounds, borderColor, borderWidth) {
40 this.div = OpenLayers.Util.createDiv();
41 this.div.style.overflow = 'hidden';
42 this.events = new OpenLayers.Events(this, this.div, null);
43 this.setBorder(borderColor, borderWidth);
54 OpenLayers.Marker.prototype.destroy.apply(this, arguments);
59 * Allow the user to change the box's color and border width
62 * color - {String} Default is "red"
63 * width - {int} Default is 2
65 setBorder: function (color, width) {
72 this.div.style.border = width + "px solid " + color;
79 * px - {<OpenLayers.Pixel>}
80 * sz - {<OpenLayers.Size>}
83 * {DOMElement} A new DOM Image with this markerĀ“s icon set at the
86 draw: function(px, sz) {
87 OpenLayers.Util.modifyDOMElement(this.div, null, px, sz);
95 * {Boolean} Whether or not the marker is currently visible on screen.
100 var screenBounds = this.map.getExtent();
101 onScreen = screenBounds.containsBounds(this.bounds, true, true);
108 * Hide or show the icon
111 * display - {Boolean}
113 display: function(display) {
114 this.div.style.display = (display) ? "" : "none";
117 CLASS_NAME: "OpenLayers.Marker.Box"