diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 300:215ae6199b95

Add WMS Support to the writer
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 05 Sep 2012 16:15:03 +0200
parents c4fb04f6422f
children 50031b1ae8e6
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Wed Sep 05 16:13:39 2012 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Wed Sep 05 16:15:03 2012 +0200
@@ -261,7 +261,8 @@
             Element layerElement = (Element)list.item(i);
             layerObj layer = new layerObj(map);
             NodeList renderer = layerElement.getElementsByTagName("renderer");
-            if (renderer.getLength() == 0) {
+            if (renderer.getLength() == 0 &&
+                    layerElement.getAttribute("connection_type") != "WMS") {
                 map.removeLayer(layer.getIndex());
                 logger.warn(
                     "Skipping empty layer " + 
@@ -326,6 +327,18 @@
                 layer.setMetaData("ows_srs", owssrs);
             }
 
+            // WMS Version
+            if (layerElement.hasAttribute("wms_server_version")) {
+                layer.setMetaData("wms_server_version",
+                    layerElement.getAttribute("wms_server_version"));
+            }
+
+            // WMS Version
+            if (layerElement.hasAttribute("imageType")) {
+                layer.setMetaData("wms_format",
+                    layerElement.getAttribute("imageType"));
+            }
+
             // The layer extent metadata.
             if(layerElement.hasAttribute("extent_min_x") &&
                layerElement.hasAttribute("extent_max_x") &&
@@ -498,6 +511,12 @@
                         layer.setFilter("where " +
                         layerElement.getAttribute("definition_query"));
                 }
+            } else if(con_type.equals("WMS")) {
+                layer.setType(MS_LAYER_TYPE.MS_LAYER_RASTER);
+                layer.setConnection(layerElement.getAttribute("connection"));
+                layer.setConnectionType(MS_CONNECTION_TYPE.MS_WMS.swigValue(), "");
+                layer.setMetaData("wms_name",
+                    layerElement.getAttribute("wms_name"));
             }
             if(!type.equals("raster")) {
                 layer.setTemplate("PleaseInsertAValidTemplateForGFI");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)