# HG changeset patch # User raimund renkert # Date 1310036636 -7200 # Node ID f11d139406260d48d74678cbec08b928ad3fd9d6 # Parent 707f13cfba74a91c9bde4e8b565057628585dbe1 Handle symbol set and font set paths. diff -r 707f13cfba74 -r f11d13940626 ChangeLog --- 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 + + * 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 * src/java/de/intevation/mxd/Converter.java: diff -r 707f13cfba74 -r f11d13940626 src/java/de/intevation/mxd/writer/MapScriptWriter.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")) { diff -r 707f13cfba74 -r f11d13940626 src/java/de/intevation/mxd/writer/SymbolWriter.java --- 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) {