# HG changeset patch # User Raimund Renkert # Date 1306859460 -7200 # Node ID df2eb0e7d229006efb66a647727a4aed5a5cc5f5 # Parent 7d4cf2db43f15be72416d4c5d71065bc78d13d22 Removed obsolete code. diff -r 7d4cf2db43f1 -r df2eb0e7d229 ChangeLog --- a/ChangeLog Tue May 31 17:54:43 2011 +0200 +++ b/ChangeLog Tue May 31 18:31:00 2011 +0200 @@ -1,3 +1,8 @@ +2011-05-31 Raimund Renkert + + * src/java/de/intevation/mxd/writer/MapScriptWriter.java: + Removed obsolete code. + 2011-05-31 Raimund Renkert * src/java/de/intevation/mxd/writer/IWriter.java, diff -r 7d4cf2db43f1 -r df2eb0e7d229 src/java/de/intevation/mxd/writer/MapScriptWriter.java --- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue May 31 17:54:43 2011 +0200 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Tue May 31 18:31:00 2011 +0200 @@ -240,169 +240,5 @@ saveSymbolSet(symbolSet); } } - - /** - * Adds the symbols and styles to the mapfile. - * @param co Mapscript class object. - * @param classElement Dom element containing the style and symbol - * attributes. - */ - private void writeSymbol(classObj co, Element classElement) { - //Get all symbol elements from dom. - NodeList list = classElement.getElementsByTagName("symbol"); - - //Get the symbol set from the map object. - symbolSetObj symbolSet = map.getSymbolset(); - - for(int i = 0; i < list.getLength(); i++){ - Element symbolElement = (Element) list.item(i); - styleObj style = new styleObj(co); - if (symbolElement.hasAttribute("angle")) { - style.setAngle( - Double.parseDouble(symbolElement.getAttribute("angle"))); - } - if(symbolElement.hasAttribute("color")) { - String c = symbolElement.getAttribute("color"); - Color col = Color.decode(c); - colorObj color = new colorObj( - col.getRed(), - col.getGreen(), - col.getBlue(), - -4); - style.setColor(color); - } - if (symbolElement.hasAttribute ("size")) { - style.setSize(Double.parseDouble( - symbolElement.getAttribute("size"))); - } - if(symbolElement.hasAttribute("outline_color")) { - Color oCol = Color.decode( - symbolElement.getAttribute("outline_color")); - colorObj outlineColor = new colorObj( - oCol.getRed(), - oCol.getGreen(), - oCol.getBlue(), - -4); - style.setOutlinecolor(outlineColor); - style.setOutlinewidth(Double.parseDouble( - symbolElement.getAttribute("outline_size"))); - } - //Section for line symbols - //Setting the width - if(symbolElement.hasAttribute("width")) { - style.setWidth((int)Double.parseDouble( - symbolElement.getAttribute("width"))); - } - String name = symbolElement.getAttribute("name"); - style.setSymbolByName(map, name); - symbolObj sym = symbolSet.getSymbolByName(name); - - //The following lines are for dashed and/or dotted lines. - //These lines throw an "incorrect array size" error. - //TODO Find out how to set the pattern correctly. -// style.setPatternlength(2); -// double[] vals = new double[] {1.0, 2.0, 3.0}; -// vals[0] = 1.0; -// vals[1] = 2.0; -// vals[2] = 3.0; -// vals[3] = 4.0; -// style.setPattern(vals); - String symType = symbolElement.getAttribute("style"); - if(symType.equals("point")) { - writePointSymbol(sym, symbolElement); - } - else if (symType.equals("arrow")) { - writeArrowSymbol(sym, symbolElement); - } - else if (symType.equals("char")) { - writeCharSymbol(sym, symbolElement); - } - else if(symType.equals("line")) { - writeSimpleLineSymbol(sym, symbolElement); - } - } - saveSymbolSet(symbolSet); - } - - - /** - * Write point symbols to the map. - * @param symbol The symbol object. - * @param symbolElement The DOM object containing the attributes. - */ - private void writePointSymbol(symbolObj symbol, Element symbolElement) { - lineObj points = new lineObj(); - points.add(new pointObj(1,1,0)); - symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE.swigValue()); - symbol.setPoints(points); - symbol.setFilled(1); - } - - - /** - * Write arrow symbol to the map. - * @param symbol The symbol object. - * @param symbolElement The DOM object containig the attributes. - */ - private void writeArrowSymbol(symbolObj symbol, Element symbolElement) { - double len = Double.parseDouble(symbolElement.getAttribute("length")); - double width = Double.parseDouble(symbolElement.getAttribute("width")); - double ratio = len/width; - lineObj points = new lineObj(); - - points.add(new pointObj(0, 0, 0)); - points.add(new pointObj((1*ratio), 0.5, 0)); - points.add(new pointObj(0, 1, 0)); - points.add(new pointObj(0, 0, 0)); - symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR.swigValue()); - symbol.setPoints(points); - symbol.setFilled(1); - } - - - /** - * Write font symbols to the map. - * @param symbol The symbol object. - * @param symbolElement The DOM object containing the attributes. - */ - private void writeCharSymbol(symbolObj symbol, Element symbolElement) { - //TODO Write the symbol correctly. See Issue 3885 on trac.osgeo.org - symbol.setFont(symbolElement.getAttribute("font")); - symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue()); - symbol.setAntialias(1); - symbol.setCharacter("#&" + symbolElement.getAttribute("char") + ";"); - } - - - private void writeSimpleLineSymbol( - symbolObj symbol, - Element symbolElement) { - logger.debug("writeSimpleLineSymbol()"); - symbol.setType(MS_SYMBOL_TYPE.MS_SYMBOL_SIMPLE.swigValue()); - String ls = symbolElement.getAttribute("linestyle"); - if(ls.equals("solid")) { - symbol.setFilled(1); - } - } - - - /** - * Save the symbol set. - * @param symbols The symbol set. - */ - private void saveSymbolSet(symbolSetObj symbols) { - Element fileNode = (Element)XMLUtils.xpath( - root, - "/mxd/file", - XPathConstants.NODE); - String path = ""; - if(mapFilename.contains("/")) { - path = mapFilename.substring(0, mapFilename.lastIndexOf("/")); - } - else if(mapFilename.contains("\\")) { - path = mapFilename.substring(0, mapFilename.lastIndexOf("\\")); - } - symbols.save(path + "/symbols.sym"); - } }