Mercurial > mxd2map
diff src/java/de/intevation/mxd/writer/FillStyleWriter.java @ 150:7b1433d3b574
Handle outlines with width < 1 and transparent color.
author | vc11884admin@VC11884.win.bsh.de |
---|---|
date | Wed, 29 Jun 2011 19:29:14 +0200 |
parents | b2c5a66022f1 |
children | b1e4a871033e |
line wrap: on
line diff
--- a/src/java/de/intevation/mxd/writer/FillStyleWriter.java Wed Jun 29 17:59:52 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/FillStyleWriter.java Wed Jun 29 19:29:14 2011 +0200 @@ -34,6 +34,7 @@ private mapObj map; private classObj cl; private styleObj style; + private colorObj fill; public FillStyleWriter (mapObj map, classObj cl) { logger.debug("contructor(mapObj, classObj)"); @@ -59,6 +60,15 @@ (symbols.getLength() == 1 && !symbolElement.hasAttribute("hatch"))) && type.equals("line")) { + if(symbolElement.hasAttribute("color")) { + Color oCol = Color.decode( + symbolElement.getAttribute("color")); + fill = new colorObj( + oCol.getRed(), + oCol.getGreen(), + oCol.getBlue(), + -4); + } writeOutline(nextSym); if (symbols.getLength() == 1) { writeSimple(symbolElement); @@ -131,17 +141,18 @@ logger.debug("writeOutline()"); //write transparent outline colorObj color = new colorObj(-1, -1, -1, -4); + double w = 0; + double transp = -1; if(symbolElement.hasAttribute("width")) { - double w = 0; try { w = Double.parseDouble(symbolElement.getAttribute("width")); + transp = Double.parseDouble( + symbolElement.getAttribute("transparency")); } catch(NumberFormatException nfe) { - logger.warn("Error setting outline width."); + logger.warn("Error setting outline width or transparency."); w = 0; - } - if (w < 1.0) { - return; + transp = -1; } } //write new style for the outline @@ -150,13 +161,18 @@ symbolElement.getAttribute("color")); styleObj outline = new styleObj (cl); - - colorObj outlinecolor = new colorObj( - oCol.getRed(), - oCol.getGreen(), - oCol.getBlue(), - -4); - outline.setOutlinecolor(outlinecolor); + if (w < 1.0 && transp > 0) { + symbolElement.setAttribute("width", "1"); + outline.setOutlinecolor(fill); + } + else { + colorObj outlinecolor = new colorObj( + oCol.getRed(), + oCol.getGreen(), + oCol.getBlue(), + -4); + outline.setOutlinecolor(outlinecolor); + } try { outline.setOutlinewidth(Double.parseDouble( symbolElement.getAttribute("width")));