--- a/labs/openlayers/lib/OpenLayers/Control/ArgParser.js +++ b/labs/openlayers/lib/OpenLayers/Control/ArgParser.js @@ -1,1 +1,167 @@ +/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * @requires OpenLayers/Control.js + */ + +/** + * Class: OpenLayers.Control.ArgParser + * The ArgParser control adds location bar querystring parsing functionality + * to an OpenLayers Map. + * When added to a Map control, on a page load/refresh, the Map will + * automatically take the href string and parse it for lon, lat, zoom, and + * layers information. + * + * Inherits from: + * - + */ +OpenLayers.Control.ArgParser = OpenLayers.Class(OpenLayers.Control, { + + /** + * Parameter: center + * {} + */ + center: null, + + /** + * Parameter: zoom + * {int} + */ + zoom: null, + + /** + * Parameter: layers + * {Array()} + */ + layers: null, + + /** + * APIProperty: displayProjection + * {} Requires proj4js support. + * Projection used when reading the coordinates from the URL. This will + * + * reproject the map coordinates from the URL into the map's + * projection. + * + * If you are using this functionality, be aware that any permalink + * which is added to the map will determine the coordinate type which + * is read from the URL, which means you should not add permalinks with + * different displayProjections to the same map. + */ + displayProjection: null, + + /** + * Constructor: OpenLayers.Control.ArgParser + * + * Parameters: + * options - {Object} + */ + initialize: function(options) { + OpenLayers.Control.prototype.initialize.apply(this, arguments); + }, + + /** + * Method: setMap + * Set the map property for the control. + * + * Parameters: + * map - {} + */ + setMap: function(map) { + OpenLayers.Control.prototype.setMap.apply(this, arguments); + + //make sure we dont already have an arg parser attached + for(var i=0, len=this.map.controls.length; i