tim@987: <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
tim@987: function handleMeasurements(event) {
tim@987: var geometry = event.geometry;
tim@987: var units = event.units;
tim@987: var order = event.order;
tim@987: var measure = event.measure;
tim@987: var element = document.getElementById('measurements');
tim@987:
tim@987: var out = "";
tim@987: if(order == 1) {
tim@987: out += "L\u00e4nge: " + measure.toFixed(3) + " " + units;
tim@987: } else {
tim@987: out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "2";
tim@987: }
tim@987:
tim@987: element.innerHTML=out;
tim@987: };
tim@987:
tim@987:
tim@987:
tim@987: function readWMC(merge) {
tim@987: var layers = mapPanel.layers;
tim@987: map = mapPanel.map;
tim@987:
tim@987: var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
tim@987: var text = document.getElementById("wmc").value;
tim@987:
tim@987: merge = true;
tim@987: if(merge) {
tim@987: try {
tim@987: map = format.read(text, {map: map});
tim@987: } catch(err) {
tim@987: document.getElementById("wmc").value = err;
tim@987: }
tim@987: } else {
tim@987: map.destroy();
tim@987: try {
tim@987: var jsonFormat = new OpenLayers.Format.JSON();
tim@987: var mapOptions = jsonFormat.read();
tim@987: map = format.read(text, {map: mapOptions});
tim@987: } catch(err) {
tim@987: document.getElementById("wmc").value = err;
tim@987: }
tim@987: }
tim@987:
tim@987: // create MapPanel
tim@987: mapPanel = new GeoExt.MapPanel({
tim@987: border: true,
tim@987: title: "Karte",
tim@987: region: "center",
tim@987: map: map,
tim@987: zoom: 1,
tim@987: layers: map.layers
tim@987: });
tim@987: }
tim@987:
tim@987:
tim@987: function writeWMC(merge) {
tim@987: var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
tim@987:
tim@987: try {
tim@987: var text = format.write(map);
tim@987: document.getElementById("wmc").value = text;
tim@987: } catch(err) {
tim@987: document.getElementById("wmc").value = err;
tim@987: }
tim@987: }
tim@987:
tim@987:
tim@987:
tim@987: function toggleGetFeatureInfo(evt) {
tim@987: if (infoActive) {
tim@987: infoControls.click.deactivate();
tim@987: infoActive = false;
tim@987: }
tim@987: else {
tim@987: infoControls.click.activate();
tim@987: infoActive = true;
tim@987: }
tim@987: }
tim@987:
tim@987:
tim@987: function showInfo(evt) {
tim@987: }
tim@987:
tim@987:
tim@987: function addLayer() {
tim@989: var records = grid.getSelectionModel().getSelections();
tim@989: for (rec in records){
tim@989:
tim@989: var record = records[rec];
tim@989: // TODO: Look for something better than object
tim@989: if (typeof record == "object"){
tim@987: var copy = record.copy();
tim@987: copy.set("layer", record.get("layer"));
tim@987: copy.get("layer").mergeNewParams({
tim@987: format: "image/png",
tim@987: transparent: true
tim@987: });
tim@987: mapPanel.layers.add(copy);
tim@989: }
tim@989: }
tim@989:
tim@987: }
tim@987:
tim@987:
tim@987: // this is just copied from OpenLayers.Util
tim@987: function urlAppend(url, paramStr) {
tim@987: var newUrl = url;
tim@987: if(paramStr) {
tim@987: var parts = (url + " ").split(/[?&]/);
tim@987: newUrl += (parts.pop() === " " ?
tim@987: paramStr :
tim@987: parts.length ? "&" + paramStr : "?" + paramStr);
tim@987: }
tim@987: return newUrl;
tim@987: }
tim@987:
tim@989: function showWarning(){
tim@989: if (store.data.length == 0){
tim@989: Ext.MessageBox.alert("
"+att+": | " + attributes[att] + " |