Index: theme/default/style.css =================================================================== --- theme/default/style.css (revision 9574) +++ theme/default/style.css (working copy) @@ -28,6 +28,30 @@ position: absolute; display: block; } +.olControlCrosshair { + right: 50%; + bottom: 50%; + width: 0px; + height: 0px; + position: absolute; + display: block; +} +.olControlCrosshair div.CHHB { + left: -10px; + top: 0px; + width:21px; + border-top: 1px solid black; + position: absolute; + display: block; +} +.olControlCrosshair div.CHVB { + left: 0px; + top: -10px; + height:21px; + border-left: 1px solid black; + position: absolute; + display: block; +} .olControlScale { right: 3px; bottom: 3em; Index: lib/OpenLayers/Control/Crosshair.js =================================================================== --- lib/OpenLayers/Control/Crosshair.js (revision 0) +++ lib/OpenLayers/Control/Crosshair.js (revision 0) @@ -0,0 +1,77 @@ + +/** + * @requires OpenLayers/Control.js + */ + +/** + * Class: OpenLayers.Control.Crosshair + * The crosshair control adds a crosshair to the very center of the map + * for easily zooming in to the desired point. + * + * Inherits from: + * - + */ +OpenLayers.Control.Crosshair = + OpenLayers.Class(OpenLayers.Control, { + + /** + * Constructor: OpenLayers.Control.Crosshair + * + * Parameters: + * options - {Object} Options for control. + */ + initialize: function(options) { + OpenLayers.Control.prototype.initialize.apply(this, arguments); + }, + + /** + * Method: destroy + * Destroy control. + */ + destroy: function() { + this.map.events.un({ + "removelayer": this.updateCrosshair, + "addlayer": this.updateCrosshair, + "changelayer": this.updateCrosshair, + "changebaselayer": this.updateCrosshair, + scope: this + }); + + OpenLayers.Control.prototype.destroy.apply(this, arguments); + }, + + /** + * Method: draw + * Initialize control. + * + * Returns: + * {DOMElement} A reference to the DIV DOMElement containing the control + */ + draw: function() { + OpenLayers.Control.prototype.draw.apply(this, arguments); + + this.map.events.on({ + 'changebaselayer': this.updateCrosshair, + 'changelayer': this.updateCrosshair, + 'addlayer': this.updateCrosshair, + 'removelayer': this.updateCrosshair, + scope: this + }); + this.updateCrosshair(); + + return this.div; + }, + + /** + * Method: updateCrosshair + * Update Crosshair. + */ + updateCrosshair: function() { + var attributions = []; + if (this.map && this.map.layers) { + this.div.innerHTML = "
"; + } + }, + + CLASS_NAME: "OpenLayers.Control.Crosshair" +}); Index: lib/OpenLayers.js =================================================================== --- lib/OpenLayers.js (revision 9574) +++ lib/OpenLayers.js (working copy) @@ -166,6 +166,7 @@ "OpenLayers/Control/NavigationHistory.js", "OpenLayers/Control/Measure.js", "OpenLayers/Control/WMSGetFeatureInfo.js", + "OpenLayers/Control/Crosshair.js", "OpenLayers/Geometry.js", "OpenLayers/Geometry/Rectangle.js", "OpenLayers/Geometry/Collection.js",