diff src/java/de/intevation/mxd/writer/SymbolWriter.java @ 184:c79c3c6fc99a

Always save a symbol set, use the mapfile name as prefix for the symbol set and use the mapfile path to save the symbol set.
author raimund renkert <raimund.renkert@intevation.de>
date Wed, 20 Jul 2011 12:23:57 +0200
parents 0bde090506f9
children 0dc34dcdaedc
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/SymbolWriter.java	Mon Jul 18 17:17:04 2011 +0200
+++ b/src/java/de/intevation/mxd/writer/SymbolWriter.java	Wed Jul 20 12:23:57 2011 +0200
@@ -193,21 +193,15 @@
      *
      * @param symbols The symbol set object.
      */
-    private void saveSymbolSet(symbolSetObj symbols)
+    public void saveSymbolSet(symbolSetObj symbols)
     throws Exception {
         String path = this.map.getMappath();
-        String symbolPath = symbols.getFilename();
+        String filename = path.substring(path.lastIndexOf(File.separator) + 1,
+                                         path.lastIndexOf("."));
+        String symbolPath = filename + "-symbols.sym";
         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);
@@ -218,7 +212,7 @@
         }
         path = path.replaceAll("\\\\", "/");
         symbols.save(path);
-        this.map.setSymbolSet(symbolPath);
+        this.map.setSymbolSet(path);
     }
 
     /**
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)