diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 321:b6c0fbae16dc

Expand Graphics Layer Support
author Andre Heinecke <aheinecke@intevation.de>
date Thu, 20 Sep 2012 17:58:29 +0200
parents 9289b7c1b4ce
children 40442cbfbcc7
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Sep 20 13:01:33 2012 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Sep 20 17:58:29 2012 +0200
@@ -551,12 +551,14 @@
                 layer.setOffsite(new colorObj(255,255,255,-4));
             }
 
-            // Set scaling properties for layer
+            // Set scaling properties for layer and add Processing
             if(type == "annotation") {
                 if (mapNode.hasAttribute("referencescale")) {
                     layer.setSymbolscaledenom(Double.parseDouble(
                             mapNode.getAttribute("referencescale")));
                 }
+                layer.addProcessing("ITEMS=classId");
+                layer.setClassitem("classId");
             }
 
             // Create labelitem
@@ -616,13 +618,18 @@
             shape.add(line);
             shape.setText(feature.getAttribute("text"));
 
-            // Write the Style / Symbol once
-            if ( i == 0 ) {
-                classObj co = new classObj(layer);
-                writeLabel(co, feature, layerElement.getAttribute("type"));
-                LabelStyleWriter swriter = new LabelStyleWriter (this.map, co);
-                swriter.write((Element)feature.getFirstChild());
-            }
+            shape.initValues(1);
+            shape.setValue(0, feature.getAttribute("classId"));
+
+            // Write the Style / Symbol for each element as a single class
+            // TODO build a hash of the style/symbol and check if classes can be
+            // grouped
+
+            classObj co = new classObj(layer);
+            writeLabel(co, feature, layerElement.getAttribute("type"));
+            co.setExpression("\"" + feature.getAttribute("classId") + "\"");
+            LabelStyleWriter swriter = new LabelStyleWriter (this.map, co);
+            swriter.write((Element)feature.getFirstChild());
             layer.addFeature(shape);
         }
     }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)