comparison flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java @ 1793:1636686070f7

Initial commit to support styles in maps. flys-artifacts/trunk@3116 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 28 Oct 2011 14:42:24 +0000
parents 741ba9e34c7d
children 5364b86a0880
comparison
equal deleted inserted replaced
1792:49ad801076e4 1793:1636686070f7
6 import java.awt.Font; 6 import java.awt.Font;
7 7
8 import org.w3c.dom.Document; 8 import org.w3c.dom.Document;
9 9
10 import de.intevation.artifacts.common.utils.XMLUtils; 10 import de.intevation.artifacts.common.utils.XMLUtils;
11
12 import de.intevation.flys.artifacts.model.MapserverStyle;
13 import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
11 14
12 15
13 /** 16 /**
14 * Utility to deal with themes and their representations. 17 * Utility to deal with themes and their representations.
15 */ 18 */
282 } 285 }
283 return c; 286 return c;
284 } 287 }
285 288
286 289
290 public static String getLineColorString(Document theme) {
291 return XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null);
292 }
293
294
287 /** 295 /**
288 * Gets color from color field. 296 * Gets color from color field.
289 * @param theme the theme document. 297 * @param theme the theme document.
290 * @return color. 298 * @return color.
291 */ 299 */
292 public static Color parseLineColorField(Document theme) { 300 public static Color parseLineColorField(Document theme) {
293 String color = XMLUtils.xpathString(theme, XPATH_LINE_COLOR, null); 301 return parseRGB(getLineColorString(theme));
294 return parseRGB(color); 302 }
303
304
305 public static String createMapserverStyle(Document theme) {
306 String linecolor = getLineColorString(theme);
307 int linewidth = parseLineWidth(theme);
308
309 MapserverStyle ms = new MapserverStyle();
310
311 Clazz c = new Clazz(" ");
312 c.setOutlineColor(linecolor);
313 c.setSize(linewidth);
314
315 ms.addClazz(c);
316
317 return ms.toString();
295 } 318 }
296 } 319 }

http://dive4elements.wald.intevation.org