/* Copyright (c) 2006-2010 MetaCarta, Inc., 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.OpenSearch * A control that loads a collection of OpenSearch services and * manages queries. Support for BBOX filtering. * * Inherits from: * - */ OpenLayers.Control.OpenSearch = OpenLayers.Class(OpenLayers.Control, { /** * APIProperty: control div ID */ div: null, /** * Property: results div ID */ resultsDiv: null, /** * Property: array of descriptions */ descriptions: null, /** * Property: form text input */ input: null, /** * Property: selectFeature */ selectFeature: null, /** * Constructor: OpenLayers.Control.OpenSearch * Create a new OpenSearch control. * * Parameters: * options - {Object} Optional object whose properties will be set on the * instance. A "descriptions" array property is mandatory. */ initialize: function (options) { OpenLayers.Control.prototype.initialize.apply(this, arguments); this.draw(); this.strategies = new Array(); for(var i=0;i0) this.search(); OpenLayers.Console.debug("Selected search engine: "+this.strategies[i].description.name); }, /** * Method: search */ search: function() { for(var i=0;i'; for(var attribute in feature.attributes) { html += '
'; html += '' + attribute + ''; html += '' + feature.attributes[attribute] + ''; html += '
'; } html += ""; return html; }, /** * Method: onItemMouseOver */ onItemMouseOver: function(event) { var div = event.currentTarget; var feature = this.layer.getFeatureById(div.id); this.selectFeature.select(feature); }, /** * Method: onItemMouseOut */ onItemMouseOut: function(event) { var div = event.currentTarget; var feature = this.layer.getFeatureById(div.id); this.selectFeature.unselect(feature); }, /** * Method: onFeatureSelect */ onFeatureSelect: function(event) { var feature = event.feature; $(feature.id).className = this.displayClass + "SelectedItem"; }, /** * Method: onFeatureUnselect */ onFeatureUnselect: function(event) { var feature = event.feature; $(feature.id).className = this.displayClass + "Item"; }, CLASS_NAME: "OpenLayers.Control.OpenSearch" });