comparison src/java/de/intevation/mxd/writer/FillStyleWriter.java @ 167:b1e4a871033e

Write special pattern for outlines.
author vc11884admin@VC11884.win.bsh.de
date Tue, 05 Jul 2011 15:41:01 +0200
parents 7b1433d3b574
children f3a539ace2a4
comparison
equal deleted inserted replaced
166:51c99594346e 167:b1e4a871033e
144 double w = 0; 144 double w = 0;
145 double transp = -1; 145 double transp = -1;
146 if(symbolElement.hasAttribute("width")) { 146 if(symbolElement.hasAttribute("width")) {
147 try { 147 try {
148 w = Double.parseDouble(symbolElement.getAttribute("width")); 148 w = Double.parseDouble(symbolElement.getAttribute("width"));
149 transp = Double.parseDouble( 149 if(symbolElement.hasAttribute("transparency")) {
150 symbolElement.getAttribute("transparency")); 150 transp = Double.parseDouble(
151 symbolElement.getAttribute("transparency"));
152 }
153 else {
154 transp = -1;
155 }
151 } 156 }
152 catch(NumberFormatException nfe) { 157 catch(NumberFormatException nfe) {
153 logger.warn("Error setting outline width or transparency."); 158 logger.warn("Error setting outline width or transparency.");
154 w = 0; 159 w = 0;
155 transp = -1; 160 transp = -1;
203 outline.setPatternlength(6); 208 outline.setPatternlength(6);
204 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0}; 209 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
205 outline.setPattern(vals); 210 outline.setPattern(vals);
206 } 211 }
207 } 212 }
208 213 else if(symbolElement.hasAttribute("pattern_count")) {
209 214 int count = 0;
215 try {
216 count = Integer.parseInt(
217 symbolElement.getAttribute("pattern_count"));
218 double[] vals = new double[10];
219 double move = 0.0;
220 int pos = 0;
221 for(int i = 0; i < count; i++) {
222 double mark =
223 Double.parseDouble(symbolElement.getAttribute("mark_" + i));
224 double gap =
225 Double.parseDouble(symbolElement.getAttribute("gap_" + i));
226 if(i == 0 && mark == 0.0) {
227 move = gap;
228 }
229 else if(i == count - 1 && move > 0.0) {
230 vals[pos++] = mark;
231 vals[pos++] = gap + move;
232 }
233 else {
234 vals[pos++] = mark;
235 vals[pos++] = gap;
236 }
237 }
238 if(move > 0.0) {
239 outline.setPatternlength((count*2) -2);
240 }
241 else {
242 outline.setPatternlength(count*2);
243 }
244 outline.setPattern(vals);
245
246 }
247 catch(NumberFormatException nfe) {
248 logger.warn("Could not write PATTERN.");
249 }
250 }
210 } 251 }
211 252
212 /** 253 /**
213 * Write marker attributes and a symbol for the polygon fill. 254 * Write marker attributes and a symbol for the polygon fill.
214 */ 255 */
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)