diff src/java/de/intevation/mxd/writer/MapScriptWriter.java @ 88:df2eb0e7d229

Removed obsolete code.
author Raimund Renkert <rrenkert@intevation.de>
date Tue, 31 May 2011 18:31:00 +0200
parents 7d4cf2db43f1
children 82a1f39214fd
line wrap: on
line diff
--- 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");
-    }
 }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)