diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 317:5a2b5bc066eb

Implement Label Styles and Labels with background
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Sep 2012 12:55:21 +0200
parents 1d77ea6a915d
children 9289b7c1b4ce
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Mon Sep 17 17:10:44 2012 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Sep 20 12:55:21 2012 +0200
@@ -408,6 +408,9 @@
             else if(type.equals("raster")) {
                 layer.setType(MS_LAYER_TYPE.MS_LAYER_RASTER);
             }
+            else if (type == "annotation") {
+                layer.setType(MS_LAYER_TYPE.MS_LAYER_ANNOTATION);
+            }
 
             //The layer datasource.
             String con_type = layerElement.getAttribute("connection_type");
@@ -548,6 +551,14 @@
                 layer.setOffsite(new colorObj(255,255,255,-4));
             }
 
+            // Set scaling properties for layer
+            if(type == "annotation") {
+                if (mapNode.hasAttribute("referencescale")) {
+                    layer.setSymbolscaledenom(Double.parseDouble(
+                            mapNode.getAttribute("referencescale")));
+                }
+            }
+
             // Create labelitem
             NodeList labels = layerElement.getElementsByTagName("label");
             if(labels.getLength() > 0) {
@@ -609,7 +620,7 @@
             if ( i == 0 ) {
                 classObj co = new classObj(layer);
                 writeLabel(co, feature, layerElement.getAttribute("type"));
-                MarkerStyleWriter swriter = new MarkerStyleWriter (this.map, co);
+                LabelStyleWriter swriter = new LabelStyleWriter (this.map, co);
                 swriter.write((Element)feature.getFirstChild());
             }
             layer.addFeature(shape);
@@ -758,6 +769,14 @@
             if(layerType.equals("point")) {
                 label.setPosition(MS_POSITIONS_ENUM.MS_UC.swigValue());
             }
+
+            //Set annotation specific values
+            if (layerType == "annotation") {
+                label.setPosition(MS_POSITIONS_ENUM.MS_CC.swigValue());
+                label.setOffsetx(2);
+                label.setOffsety(-2);
+            }
+
         }
     }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)