Mercurial > mxd2map
comparison src/java/de/intevation/mxd/writer/LineStyleWriter.java @ 136:7632850b9520
Convert cartographic line template to mapfile pattern.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 23 Jun 2011 13:27:30 +0200 |
parents | cd18c61cbcf6 |
children | 8f30f7e802d6 |
comparison
equal
deleted
inserted
replaced
135:a4ab239509f1 | 136:7632850b9520 |
---|---|
95 style.setPatternlength(6); | 95 style.setPatternlength(6); |
96 vals = new double[] {5.0, 4.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0}; | 96 vals = new double[] {5.0, 4.0, 1.0, 3.0, 1.0, 4.0, 0, 0, 0, 0}; |
97 style.setPattern(vals); | 97 style.setPattern(vals); |
98 } | 98 } |
99 } | 99 } |
100 else if(symbolElement.hasAttribute("pattern_count")) { | |
101 int count = 0; | |
102 try { | |
103 count = Integer.parseInt( | |
104 symbolElement.getAttribute("pattern_count")); | |
105 double[] vals = new double[10]; | |
106 double move = 0.0; | |
107 int pos = 0; | |
108 for(int i = 0; i < count; i++) { | |
109 double mark = | |
110 Double.parseDouble(symbolElement.getAttribute("mark_" + i)); | |
111 double gap = | |
112 Double.parseDouble(symbolElement.getAttribute("gap_" + i)); | |
113 if(i == 0 && mark == 0.0) { | |
114 move = gap; | |
115 } | |
116 else if(i == count - 1 && move > 0.0) { | |
117 vals[pos++] = mark; | |
118 vals[pos++] = gap + move; | |
119 } | |
120 else { | |
121 vals[pos++] = mark; | |
122 vals[pos++] = gap; | |
123 } | |
124 } | |
125 if(move > 0.0) { | |
126 style.setPatternlength((count*2) -2); | |
127 } | |
128 else { | |
129 style.setPatternlength(count*2); | |
130 } | |
131 style.setPattern(vals); | |
132 | |
133 } | |
134 catch(NumberFormatException nfe) { | |
135 logger.warn("Could not write PATTERN."); | |
136 } | |
137 } | |
138 | |
100 String type = symbolElement.getAttribute("type"); | 139 String type = symbolElement.getAttribute("type"); |
101 | 140 |
102 if(type.equals("marker")) { | 141 if(type.equals("marker")) { |
103 style.setSymbolByName(map, name); | 142 style.setSymbolByName(map, name); |
104 SymbolWriter sw = new SymbolWriter(this.map, this.cl); | 143 SymbolWriter sw = new SymbolWriter(this.map, this.cl); |