Mercurial > mxd2map
changeset 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 | 07e2033dd60e |
children | 1623c8c99135 |
files | ChangeLog src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java src/java/de/intevation/mxd/writer/FillStyleWriter.java |
diffstat | 3 files changed, 43 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jun 29 17:59:52 2011 +0200 +++ b/ChangeLog Wed Jun 29 19:29:14 2011 +0200 @@ -1,3 +1,12 @@ +2011-06-29 Raimund Renkert <raimund.renkert@intevation.de> + + * src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java: + Read transparency from symbol color. + + * src/java/de/intevation/mxd/writer/FillStyleWriter.java: + Write outline in the same color as the fill if the outline width < 1 + and outline is transparent. + 2011-06-29 Raimund Renkert <raimund.renkert@intevation.de> * src/java/de/intevation/mxd/reader/MXDReader.java:
--- a/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java Wed Jun 29 17:59:52 2011 +0200 +++ b/src/java/de/intevation/mxd/reader/SimpleLineSymbolReader.java Wed Jun 29 19:29:14 2011 +0200 @@ -80,6 +80,9 @@ color.getGreen(), color.getBlue()); symbolElement.setAttribute("color", String.valueOf(c.getRGB())); + symbolElement.setAttribute( + "transparency", + String.valueOf(c.getTransparency())); } else { RgbColor col = new RgbColor(); @@ -89,6 +92,9 @@ col.getGreen(), col.getBlue()); symbolElement.setAttribute("color", String.valueOf(c.getRGB())); + symbolElement.setAttribute( + "transparency", + String.valueOf(c.getTransparency())); } } catch(IOException ioe) {
--- 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")));