changeset 94:273e49f51cfb

Merged with Stephans commit.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 01 Jun 2011 11:52:53 +0200
parents 3993b5adf67c (diff) 39fe778ab9f4 (current diff)
children 1ae8e05b863f
files ChangeLog
diffstat 3 files changed, 43 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jun 01 11:34:25 2011 +0200
+++ b/ChangeLog	Wed Jun 01 11:52:53 2011 +0200
@@ -1,3 +1,12 @@
+2011-06-01  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java:
+	  Read and convert the symbol color and convert to integer.
+
+	* src/java/de/intevation/mxd/writer/SymbolWriter.java:
+	  Set the correct character and font string. Save the symbolset to the
+	  mapfile path.
+
 2011-06-01  Stephan Holl  <stephan.holl@intevation.de>
 
 	* M ttf-fonts/fonts.txt: Added a more verbose comment for removing
--- a/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Wed Jun 01 11:34:25 2011 +0200
+++ b/src/java/de/intevation/mxd/reader/CharacterMarkerSymbolReader.java	Wed Jun 01 11:52:53 2011 +0200
@@ -7,8 +7,12 @@
 import com.esri.arcgis.display.CharacterMarkerSymbol;
 import com.esri.arcgis.display.IColor;
 import com.esri.arcgis.support.ms.stdole.Font;
+import com.esri.arcgis.display.IRgbColor;
+import com.esri.arcgis.display.RgbColor;
+
 
 import org.w3c.dom.Element;
+import java.awt.Color;
 
 /**
  * Reads character marker symbol information.
@@ -61,7 +65,6 @@
         logger.debug("read()");
         Element symbolElement = util.addSymbol(parent);
 
-        IColor c = symbol.getColor();
         symbolElement.setAttribute(
             "angle",
             String.valueOf(symbol.getAngle()));
@@ -75,18 +78,34 @@
             "y_offset",
             String.valueOf(symbol.getYOffset()));
         symbolElement.setAttribute(
-            "color",
-            String.valueOf(c.getRGB()));
-        symbolElement.setAttribute(
-            "tranparency",
-            String.valueOf(c.getTransparency()));
-        symbolElement.setAttribute(
             "name",
             symbol.getNameString());
         symbolElement.setAttribute(
             "char",
             String.valueOf(symbol.getCharacterIndex()));
 
+        if(symbol.getColor() instanceof IRgbColor) {
+            IRgbColor color = (IRgbColor)symbol.getColor();
+            Color c = new Color (
+                color.getRed(),
+                color.getGreen(),
+                color.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(color.getTransparency()));
+        }
+        else {
+            RgbColor col = new RgbColor();
+            col.setRGB(symbol.getColor().getRGB());
+            Color c = new Color (
+                col.getRed(),
+                col.getGreen(),
+                col.getBlue());
+            symbolElement.setAttribute("color", String.valueOf(c.getRGB()));
+            symbolElement.setAttribute("transparency",
+                String.valueOf(col.getTransparency()));
+        }
+
         Font f = symbol.getFont();
         symbolElement.setAttribute("font", f.getName());
         symbolElement.setAttribute("char_set", String.valueOf(f.getCharset()));
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jun 01 11:34:25 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jun 01 11:52:53 2011 +0200
@@ -99,10 +99,13 @@
     private void writeCharacter(symbolObj symbol, Element symbolElement) {
         logger.debug("writeCharacter(symbolObj, Element)");
         //TODO Write the symbol correctly. See Issue 3885 on trac.osgeo.org
-        symbol.setFont(symbolElement.getAttribute("font"));
+        String font = symbolElement.getAttribute("font");
+        //Remove all blank character to match the mapserver fonts.txt.
+        font = font.replaceAll(" ", "");
+        symbol.setFont(font);
         symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue());
         symbol.setAntialias(1);
-        symbol.setCharacter("#&" + symbolElement.getAttribute("char") + ";");
+        symbol.setCharacter("&#" + symbolElement.getAttribute("char") + ";");
     }
 
     public boolean canWrite(String type) {
@@ -118,12 +121,12 @@
 
     private void saveSymbolSet(symbolSetObj symbols)
     throws Exception {
-        String path = "";// TODO Get the correct path. Mapfile path or symbolset path
+        String path = this.map.getMappath();
         if(path.equals("")) {
             return;
         }
-        else if(path.endsWith(".map")) {
-            path.replace(".map", ".sym");
+        else {
+            path += "symbols.sym";
         }
         symbols.save(path);
     }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)