changeset 1001:ebc3d018af6a

Prevent NPE if the Mapviewer has delivered no Geometry. gnv/trunk@1202 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 11 Jun 2010 12:11:52 +0000
parents 905cc67da916
children b1eea43ba133
files gnv/ChangeLog gnv/src/main/webapp/scripts/olutils.js
diffstat 2 files changed, 8 insertions(+), 191 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Fri Jun 11 12:06:03 2010 +0000
+++ b/gnv/ChangeLog	Fri Jun 11 12:11:52 2010 +0000
@@ -1,3 +1,11 @@
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	Issue278
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+	  Prevent NPE if the Mapviewer has delivered no Geometry.
+	
+
 2010-06-11  Tim Englich  <tim.englich@intevation.de>
 
 	  Customize Look and Feel to styleguide of the bsh.
--- a/gnv/src/main/webapp/scripts/olutils.js	Fri Jun 11 12:06:03 2010 +0000
+++ b/gnv/src/main/webapp/scripts/olutils.js	Fri Jun 11 12:11:52 2010 +0000
@@ -1,191 +0,0 @@
-function handleMeasurements(event) {
-    var geometry = event.geometry;
-    var units    = event.units;
-    var order    = event.order;
-    var measure  = event.measure;
-    var element  = document.getElementById('measurements');
-    
-    var out = "";
-    if(order == 1) {
-        out += "L\u00e4nge: " + measure.toFixed(3) + " " + units;
-    } else {
-        out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "<sup>2</sup>";
-    }
-
-    element.innerHTML=out;
-};
-
-
-
-function readWMC(merge) {
-    var layers = mapPanel.layers;
-    map    = mapPanel.map;
-
-    var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
-    var text = document.getElementById("wmc").value;
-
-    merge = true;
-    if(merge) {
-        try {
-            map = format.read(text, {map: map});
-        } catch(err) {
-            document.getElementById("wmc").value = err;
-        }
-    } else {
-        map.destroy();
-        try {
-            var jsonFormat = new OpenLayers.Format.JSON();
-            var mapOptions = jsonFormat.read();
-            map = format.read(text, {map: mapOptions});
-        } catch(err) {
-            document.getElementById("wmc").value = err;
-        }
-    }
-
-    // create MapPanel
-    mapPanel = new GeoExt.MapPanel({
-        border: true,
-        title: "Karte",
-        region: "center",
-        map: map,
-        zoom: 1,
-        layers: map.layers
-    });
-}
-
-
-function writeWMC(merge) {
-    var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
-
-    try {
-        var text = format.write(map);
-        document.getElementById("wmc").value = text;
-    } catch(err) {
-        document.getElementById("wmc").value = err;
-    }
-}
-
-
-
-function toggleGetFeatureInfo(evt) {
-    if (infoActive) {
-        infoControls.click.deactivate();
-        infoActive = false;
-    }
-    else {
-        infoControls.click.activate();
-        infoActive = true;
-    }
-}
-
-
-function showInfo(evt) {
-}
-
-
-function addLayer() {
-    var record = grid.getSelectionModel().getSelected();
-    
-    if (record) {
-        var copy = record.copy();
-        copy.set("layer", record.get("layer"));
-        copy.get("layer").mergeNewParams({
-            format: "image/png",
-            transparent: true
-        });
-
-        mapPanel.layers.add(copy);
-        mapPanel.map.zoomToExtent(OpenLayers.Bounds.fromArray(copy.get("llbbox")));
-    }
-}
-
-
-// this is just copied from OpenLayers.Util
-function urlAppend(url, paramStr) {
-    var newUrl = url;
-    if(paramStr) {
-        var parts = (url + " ").split(/[?&]/);
-        newUrl += (parts.pop() === " " ?
-            paramStr :
-            parts.length ? "&" + paramStr : "?" + paramStr);
-    }
-    return newUrl;
-}
-
-
-function updateCapabilities() {
-    var ele = Ext.Element.get('capfield');
-
-    var url     = ele.getValue();
-    var service = "SERVICE=WMS";
-    var request = "REQUEST=GetCapabilities";
-    url = urlAppend(url, service);
-    url = urlAppend(url, request);
-
-    store = new GeoExt.data.WMSCapabilitiesStore({
-        url: url
-    });
-    store.load();
-
-    grid.destroy();
-    grid = new Ext.grid.GridPanel({
-        id: 'wmsgrid',
-        collapsible: false,
-        split: false,
-        border: true,
-        // TODO: autoHeight might cause trouble
-        autoHeight: true,
-        overflow: 'auto',
-        store: store,
-        cm: new Ext.grid.ColumnModel([
-        {
-            header: 'Name',
-            dataIndex: 'name',
-            sortable: true
-        },
-        {
-            id: 'title',
-            header: 'Title',
-            dataIndex: 'title',
-            sortable: true
-        }]),
-        renderTo: 'capgrid',
-        bbar: [{
-            text: 'Add Layer',
-            handler: addLayer
-        }]
-    });
-}
-
-
-function editFeature(e) {
-    var feature = e.feature;
-
-    // TODO SET FEATURE ATTRIBUTES
-    //feature.attributes['lawa'] = 999;
-    //feature.attributes['lawa_id'] = 999;
-    //feature.attributes['w_gwk_lawa'] = 999;
-    //feature.attributes['w_wrrl'] = 999;
-    //feature.attributes['length_fee'] = 999;
-}
-
-function updateControls() {
-    var controls = panel.controls;
-
-    controls.remove(drawPointControl);
-    controls.remove(drawPathControl);
-    controls.remove(drawPolygonControl);
-
-    panel.destroy();
-    panel = new OpenLayers.Control.Panel();
-    panel.addControls(controls);
-
-    if (points.getVisibility())
-        panel.addControls(drawPointControl);
-    if (lines.getVisibility())
-        panel.addControls(drawPathControl);
-    if (polygons.getVisibility())
-        panel.addControls(drawPolygonControl);
-
-    map.addControl(panel);
-}

http://dive4elements.wald.intevation.org