- function displayFeatureWarning() {
- var div = document.createElement("div");
- var p = document.createElement("p");
- p.appendChild(document.createTextNode("You have loaded an area which contains " + featureList.length + " features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."));
- div.appendChild(p);
- var input = document.createElement("input");
- input.type = "submit";
- input.value = "Load Data";
- input.onclick = loadFeatureList;
- div.appendChild(input);
- $("object").innerHTML="";
- $("object").appendChild(div);
+
+ return false;
+ }
+
+ $("browse_select_view").onclick = useMap;
+
+ function endDrag(bbox) {
+ var bounds = bbox.getBounds();
+ var projected = bounds.clone().transform(map.getProjectionObject(), epsg4326);
+
+ browseBoxControl.deactivate();
+ browseBounds = projected;
+ getData(bounds);
+
+ browseMode = "manual";
+
+ $("browse_select_box").innerHTML = "#{I18n.t('browse.start_rjs.manually_select')}";
+ $("browse_select_view").style.display = "inline";
+ }
+
+ function displayFeatureWarning() {
+ clearStatus();
+
+ var div = document.createElement("div");
+
+ var p = document.createElement("p");
+ p.appendChild(document.createTextNode("#{I18n.t('browse.start_rjs.loaded_an_area')} " + browseFeatureList.length + " #{I18n.t('browse.start_rjs.browsers')}"));
+ div.appendChild(p);
+
+ var input = document.createElement("input");
+ input.type = "submit";
+ input.value = "#{I18n.t('browse.start_rjs.load_data')}";
+ input.onclick = loadFeatureList;
+ div.appendChild(input);
+
+ $("browse_content").innerHTML = "";
+ $("browse_content").appendChild(div);
+ }
+
+ function loadFeatureList() {
+ browseDataLayer.addFeatures(browseFeatureList);
+ browseDataLayer.events.triggerEvent("loadend");
+
+ browseFeatureList = [];
+
+ return false;
+ }
+
+ function customDataLoader(request) {
+ if (browseActive) {
+ var doc = request.responseXML;
+
+ if (!doc || !doc.documentElement) {
+ doc = request.responseText;
+ }
+
+ var options = {};
+
+ OpenLayers.Util.extend(options, this.formatOptions);
+
+ if (this.map && !this.projection.equals(this.map.getProjectionObject())) {
+ options.externalProjection = this.projection;
+ options.internalProjection = this.map.getProjectionObject();
+ }
+
+ var gml = this.format ? new this.format(options) : new OpenLayers.Format.GML(options);
+
+ browseFeatureList = gml.read(doc);
+
+ if (!this.maxFeatures || browseFeatureList.length <= this.maxFeatures) {
+ loadFeatureList();
+ } else {
+ displayFeatureWarning();
+ }