Mercurial > mxd2map
comparison 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 |
comparison
equal
deleted
inserted
replaced
183:fe6dbfc86144 | 184:c79c3c6fc99a |
---|---|
191 /** | 191 /** |
192 * Save the symbol set. | 192 * Save the symbol set. |
193 * | 193 * |
194 * @param symbols The symbol set object. | 194 * @param symbols The symbol set object. |
195 */ | 195 */ |
196 private void saveSymbolSet(symbolSetObj symbols) | 196 public void saveSymbolSet(symbolSetObj symbols) |
197 throws Exception { | 197 throws Exception { |
198 String path = this.map.getMappath(); | 198 String path = this.map.getMappath(); |
199 String symbolPath = symbols.getFilename(); | 199 String filename = path.substring(path.lastIndexOf(File.separator) + 1, |
200 path.lastIndexOf(".")); | |
201 String symbolPath = filename + "-symbols.sym"; | |
200 if(path.equals("")) { | 202 if(path.equals("")) { |
201 return; | |
202 } | |
203 if(symbolPath == null || symbolPath.equals("")) { | |
204 symbolPath = "symbols.sym"; | |
205 symbols.setFilename(symbolPath); | |
206 path = path.replaceAll("\\\\", "/"); | |
207 symbols.save(path); | |
208 this.map.setSymbolSet(path); | |
209 return; | 203 return; |
210 } | 204 } |
211 | 205 |
212 if (path.endsWith(".map")) { | 206 if (path.endsWith(".map")) { |
213 path = path.substring(0, path.lastIndexOf(File.separator) + 1); | 207 path = path.substring(0, path.lastIndexOf(File.separator) + 1); |
216 else { | 210 else { |
217 path += symbolPath; | 211 path += symbolPath; |
218 } | 212 } |
219 path = path.replaceAll("\\\\", "/"); | 213 path = path.replaceAll("\\\\", "/"); |
220 symbols.save(path); | 214 symbols.save(path); |
221 this.map.setSymbolSet(symbolPath); | 215 this.map.setSymbolSet(path); |
222 } | 216 } |
223 | 217 |
224 /** | 218 /** |
225 * Determine whether the symbol exists. | 219 * Determine whether the symbol exists. |
226 * | 220 * |