changeset 175:f11d13940626

Handle symbol set and font set paths.
author raimund renkert <raimund.renkert@intevation.de>
date Thu, 07 Jul 2011 13:03:56 +0200 (2011-07-07)
parents 707f13cfba74
children d95dbd643add
files ChangeLog src/java/de/intevation/mxd/writer/MapScriptWriter.java src/java/de/intevation/mxd/writer/SymbolWriter.java
diffstat 3 files changed, 31 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jul 06 18:38:40 2011 +0200
+++ b/ChangeLog	Thu Jul 07 13:03:56 2011 +0200
@@ -1,3 +1,14 @@
+2011-07-07  Raimund Renkert  <raimund.renkert@intevation.de>
+
+	* src/java/de/intevation/mxd/writer/MapScriptWriter.java:
+	  Set absolute font set path and replace all windows file separators
+	  with "/" separators in paths.
+
+	* src/java/de/intevation/mxd/writer/SymbolWriter.java:
+	  Save the symbol set in the directory read from the template or in
+	  the same directory as the mapfile if no symbol set was set in the
+	  template.
+
 2011-07-06  Raimund Renkert  <raimund.renkert@intevation.de>
 
 	* src/java/de/intevation/mxd/Converter.java:
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Wed Jul 06 18:38:40 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java	Thu Jul 07 13:03:56 2011 +0200
@@ -65,7 +65,12 @@
 	    mapFilename = System.getProperty("user.dir") +
 	       	File.separator +
 		mapFilename;
-	}	
+	}
+	String fontSetPath = map.getFontset().getFilename();
+	File fonts = new File(fontSetPath);
+	String fontSet = fonts.getAbsolutePath();
+	fontSet = fontSet.replaceAll("\\\\", "/");
+	map.setFontSet(fontSet);
     }
 
     /**
@@ -226,6 +231,7 @@
                     datasource += File.separator;
                 }
                 datasource += layerElement.getAttribute("data_source");
+		datasource = datasource.replaceAll("\\\\", "/");
                 layer.setData(datasource);
             }
             else if(con_type.equals("SDE")) {
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jul 06 18:38:40 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java	Thu Jul 07 13:03:56 2011 +0200
@@ -155,18 +155,29 @@
     private void saveSymbolSet(symbolSetObj symbols)
     throws Exception {
         String path = this.map.getMappath();
+        String symbolPath = symbols.getFilename();
         if(path.equals("")) {
             return;
         }
+        if(symbolPath == null || symbolPath.equals("")) {
+            symbolPath = "symbols.sym";
+            symbols.setFilename(symbolPath);
+            path = path.replaceAll("\\\\", "/");
+            symbols.save(path);
+            this.map.setSymbolSet(path);
+            return;
+        }
 
         if (path.endsWith(".map")) {
             path = path.substring(0, path.lastIndexOf(File.separator) + 1);
-            path += "symbols.sym";
+            path += symbolPath;
         }
         else {
-            path += "symbols.sym";
+            path += symbolPath;
         }
+        path = path.replaceAll("\\\\", "/");
         symbols.save(path);
+        this.map.setSymbolSet(symbolPath);
     }
 
     private int symbolExists (Element elem) {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)