comparison src/java/de/intevation/mxd/writer/FillStyleWriter.java @ 123:3c792458a716

Write PATTERN for polygon outlines and hatch symbols.
author Raimund Renkert <rrenkert@intevation.de>
date Fri, 17 Jun 2011 13:36:33 +0200
parents 11d63bf00326
children cd18c61cbcf6
comparison
equal deleted inserted replaced
122:f0a72d232aa8 123:3c792458a716
44 44
45 /** 45 /**
46 * Write the content. 46 * Write the content.
47 */ 47 */
48 public boolean write(Element symbolElement) { 48 public boolean write(Element symbolElement) {
49 logger.debug("write()Element");
49 symbolSetObj symbolSet = map.getSymbolset(); 50 symbolSetObj symbolSet = map.getSymbolset();
50 51
51 if(symbolElement.hasChildNodes()) { 52 if(symbolElement.hasChildNodes()) {
52 NodeList symbols = symbolElement.getChildNodes(); 53 NodeList symbols = symbolElement.getChildNodes();
53 for (int i = 0; i < symbols.getLength(); i++) { 54 for (int i = 0; i < symbols.getLength(); i++) {
133 oCol.getBlue(), 134 oCol.getBlue(),
134 -4); 135 -4);
135 outline.setOutlinecolor(outlinecolor); 136 outline.setOutlinecolor(outlinecolor);
136 outline.setOutlinewidth(Double.parseDouble( 137 outline.setOutlinewidth(Double.parseDouble(
137 symbolElement.getAttribute("width"))); 138 symbolElement.getAttribute("width")));
139 if(symbolElement.hasAttribute("linestyle")) {
140 String ls = symbolElement.getAttribute("linestyle");
141 double[] vals;
142 if(ls.equals("dash")) {
143 outline.setPatternlength(2);
144 vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
145 outline.setPattern(vals);
146 }
147 else if(ls.equals("dot")) {
148 outline.setPatternlength(2);
149 vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
150 outline.setPattern(vals);
151 }
152 else if(ls.equals("dashdot")) {
153 outline.setPatternlength(4);
154 vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
155 outline.setPattern(vals);
156 }
157 else if (ls.equals("dashdotdot")) {
158 outline.setPatternlength(6);
159 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
160 outline.setPattern(vals);
161 }
162 }
163
164
138 } 165 }
139 166
140 /** 167 /**
141 * Write marker attributes and a symbol for the polygon fill. 168 * Write marker attributes and a symbol for the polygon fill.
142 */ 169 */
178 -4); 205 -4);
179 style.setOutlinecolor(outlineColor); 206 style.setOutlinecolor(outlineColor);
180 style.setOutlinewidth(Double.parseDouble( 207 style.setOutlinewidth(Double.parseDouble(
181 symbolElement.getAttribute("outline_size"))); 208 symbolElement.getAttribute("outline_size")));
182 } 209 }
183 if(symbolElement.hasAttribute("linestyle")) {
184 String ls = symbolElement.getAttribute("linestyle");
185 double[] vals;
186 if(ls.equals("dash")) {
187 style.setPatternlength(2);
188 vals = new double[] {2.0, 2.0};
189 style.setPattern(vals);
190 }
191 else if(ls.equals("dot")) {
192 style.setPatternlength(2);
193 vals = new double[] {1.0, 2.0};
194 style.setPattern(vals);
195 }
196 else if(ls.equals("dashdot")) {
197 style.setPatternlength(4);
198 vals = new double[] {2.0, 2.0, 1.0, 2.0};
199 style.setPattern(vals);
200 }
201 else if (ls.equals("dashdotdot")) {
202 style.setPatternlength(6);
203 vals = new double[] {2.0, 2.0, 1.0, 2.0, 1.0, 2.0};
204 style.setPattern(vals);
205 }
206 }
207
208 if(type.equals("marker")) { 210 if(type.equals("marker")) {
209 style.setSymbolByName(map, name); 211 style.setSymbolByName(map, name);
210 SymbolWriter sw = new SymbolWriter(this.map, this.cl); 212 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
211 sw.write(symbolElement); 213 sw.write(symbolElement);
212 } 214 }
213 else if(type.equals("line")) { 215 else if(type.equals("line")) {
214 style.setSymbolByName(map, "hatch"); 216 style.setSymbolByName(map, "hatch");
215 SymbolWriter sw = new SymbolWriter(this.map, this.cl); 217 SymbolWriter sw = new SymbolWriter(this.map, this.cl);
216 symbolElement.setAttribute("name", "hatch"); 218 symbolElement.setAttribute("name", "hatch");
217 sw.write(symbolElement); 219 sw.write(symbolElement);
220 if(symbolElement.hasAttribute("linestyle")) {
221 String ls = symbolElement.getAttribute("linestyle");
222 double[] vals;
223 if(ls.equals("dash")) {
224 style.setPatternlength(2);
225 vals = new double[] {4.0, 4.0, 0, 0, 0, 0, 0, 0, 0, 0};
226 style.setPattern(vals);
227 }
228 else if(ls.equals("dot")) {
229 style.setPatternlength(2);
230 vals = new double[] {1.0, 3.0, 0, 0, 0, 0, 0, 0, 0, 0};
231 style.setPattern(vals);
232 }
233 else if(ls.equals("dashdot")) {
234 style.setPatternlength(4);
235 vals = new double[] {4.0, 3.0, 1.0, 3.0, 0, 0, 0, 0, 0, 0, 0};
236 style.setPattern(vals);
237 }
238 else if (ls.equals("dashdotdot")) {
239 style.setPatternlength(6);
240 vals = new double[] {5.0, 3.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0};
241 style.setPattern(vals);
242 }
243 }
218 } 244 }
219 } 245 }
220 246
221 /** 247 /**
222 * Write simple fill attributes. 248 * Write simple fill attributes.
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)