comparison src/java/de/intevation/mxd/writer/SymbolWriter.java @ 145:b2c5a66022f1

Exception handling for number conversions in writer modules.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 27 Jun 2011 18:22:21 +0200
parents 8f30f7e802d6
children 707f13cfba74
comparison
equal deleted inserted replaced
144:ad3f540fd1c3 145:b2c5a66022f1
95 symbol.setFilled(1); 95 symbol.setFilled(1);
96 } 96 }
97 97
98 private void writeArrow(symbolObj symbol, Element symbolElement) { 98 private void writeArrow(symbolObj symbol, Element symbolElement) {
99 logger.debug("writeArrow(symbolObj, Element)"); 99 logger.debug("writeArrow(symbolObj, Element)");
100 double len = Double.parseDouble(symbolElement.getAttribute("length")); 100 double len = 0;
101 double width = Double.parseDouble(symbolElement.getAttribute("width")); 101 double width = 1;
102 try {
103 len =
104 Double.parseDouble(symbolElement.getAttribute("length"));
105 width =
106 Double.parseDouble(symbolElement.getAttribute("width"));
107 }
108 catch(NumberFormatException nfe) {
109 logger.warn ("Error setting arrow symbol.");
110 return;
111 }
102 double ratio = len/width; 112 double ratio = len/width;
103 lineObj points = new lineObj(); 113 lineObj points = new lineObj();
104 114
105 points.add(new pointObj(0, 0, 0)); 115 points.add(new pointObj(0, 0, 0));
106 points.add(new pointObj((1*ratio), 0.5, 0)); 116 points.add(new pointObj((1*ratio), 0.5, 0));
159 symbolObj sym = symbolSet.getSymbol(i); 169 symbolObj sym = symbolSet.getSymbol(i);
160 int stype = sym.getType(); 170 int stype = sym.getType();
161 String etype = elem.getAttribute("style"); 171 String etype = elem.getAttribute("style");
162 if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE.swigValue () && 172 if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_ELLIPSE.swigValue () &&
163 etype.equals("point")) { 173 etype.equals("point")) {
164 return i; 174 return i;
165 } 175 }
166 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR.swigValue () && 176 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_VECTOR.swigValue () &&
167 etype.equals("arrow")) { 177 etype.equals("arrow")) {
168 return i; 178 return i;
169 } 179 }
170 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue () && 180 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_TRUETYPE.swigValue () &&
171 etype.equals("char")) { 181 etype.equals("char")) {
172 String font = elem.getAttribute("font"); 182 String font = elem.getAttribute("font");
173 font = font.replaceAll(" ", ""); 183 font = font.replaceAll(" ", "");
179 } 189 }
180 190
181 } 191 }
182 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_HATCH.swigValue () && 192 else if(stype == MS_SYMBOL_TYPE.MS_SYMBOL_HATCH.swigValue () &&
183 etype.equals("hatch")) { 193 etype.equals("hatch")) {
184 return i; 194 return i;
185 } 195 }
186
187 } 196 }
188 return -1; 197 return -1;
189 } 198 }
190 } 199 }
191 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 200 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)