Mercurial > mxd2map
comparison src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 174:707f13cfba74
Improved the commandline arguments and save the mapfile in the correct directory.
author | raimund.renkert@intevation.de |
---|---|
date | Wed, 06 Jul 2011 18:38:40 +0200 |
parents | 929e09649b08 |
children | f11d13940626 |
comparison
equal
deleted
inserted
replaced
173:0a1435aa33d8 | 174:707f13cfba74 |
---|---|
48 map = new mapObj(""); | 48 map = new mapObj(""); |
49 mapFilename = ""; | 49 mapFilename = ""; |
50 } | 50 } |
51 | 51 |
52 public MapScriptWriter(String templ, String filename) { | 52 public MapScriptWriter(String templ, String filename) { |
53 String path = System.getProperty("user.dir"); | |
53 map = new mapObj(templ); | 54 map = new mapObj(templ); |
54 mapFilename = filename; | 55 File f = new File(filename); |
56 mapFilename = filename; | |
57 if(f.isAbsolute()) { | |
58 map.setMappath(mapFilename); | |
59 } | |
60 else { | |
61 map.setMappath( | |
62 System.getProperty("user.dir") + | |
63 File.separator + | |
64 mapFilename); | |
65 mapFilename = System.getProperty("user.dir") + | |
66 File.separator + | |
67 mapFilename; | |
68 } | |
55 } | 69 } |
56 | 70 |
57 /** | 71 /** |
58 * Write the mapfile. | 72 * Write the mapfile. |
59 * @param doc The root document containin the map attributes. | 73 * @param doc The root document containin the map attributes. |
73 writeMap(); | 87 writeMap(); |
74 //Write the layers. | 88 //Write the layers. |
75 writeLayer(); | 89 writeLayer(); |
76 //Save the map. | 90 //Save the map. |
77 mapObj cloneMap = map.cloneMap(); | 91 mapObj cloneMap = map.cloneMap(); |
78 cloneMap.save(mapFilename); | 92 |
79 logger.info("Mapfile successfully created."); | 93 cloneMap.save(mapFilename); |
94 logger.info("Mapfile created: " + mapFilename); | |
80 return true; | 95 return true; |
81 } | 96 } |
82 | 97 |
83 /** | 98 /** |
84 * Create the map object and set the attributes. | 99 * Create the map object and set the attributes. |