Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/SedimentYieldArtifact.java @ 7499:ab17c76611f9
issue1658: Let SedimentYieldArtifact create facet based on Sed.L. unit.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 01 Nov 2013 16:25:19 +0100 |
parents | 6bc884bab32e |
children | 0d45b1d6e432 |
comparison
equal
deleted
inserted
replaced
7498:6bfa19119040 | 7499:ab17c76611f9 |
---|---|
144 | 144 |
145 List<Facet> fs = new ArrayList<Facet>(); | 145 List<Facet> fs = new ArrayList<Facet>(); |
146 String code = getDatacageIDValue(data); | 146 String code = getDatacageIDValue(data); |
147 | 147 |
148 if (code != null) { | 148 if (code != null) { |
149 String fraction = SedimentLoadFactory.getSedimentYieldFractionName(Integer.valueOf(code)); | 149 int id = Integer.valueOf(code); |
150 String fraction = SedimentLoadFactory.getSedimentYieldFractionName(id); | |
150 String fractionName = Resources.getMsg(callMeta, fraction, "-"); | 151 String fractionName = Resources.getMsg(callMeta, fraction, "-"); |
151 Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(Integer.valueOf(code)); | 152 Date[] dates = SedimentLoadFactory.getSedimentYieldTimes(id); |
152 Calendar date = Calendar.getInstance(); | 153 Calendar date = Calendar.getInstance(); |
153 date.setTime(dates[0]); | 154 date.setTime(dates[0]); |
154 String name = fractionName + " - " + date.get(Calendar.YEAR); | 155 String name = fractionName + " - " + date.get(Calendar.YEAR); |
155 if (dates[1] != null) { | 156 if (dates[1] != null) { |
156 date.setTime(dates[1]); | 157 date.setTime(dates[1]); |
157 name += " - " + date.get(Calendar.YEAR); | 158 name += " - " + date.get(Calendar.YEAR); |
158 } | 159 } |
159 | 160 |
161 boolean unitIsTA = | |
162 SedimentLoadFactory.getSedimentYieldUnitName(id).startsWith("t"); | |
163 | |
160 String facetType = ""; | 164 String facetType = ""; |
161 if (fraction.equals("coarse")) { | 165 if (fraction.equals("coarse")) { |
162 facetType = SEDIMENT_LOAD_COARSE; | 166 if (unitIsTA) { |
167 facetType = SEDIMENT_LOAD_TA_COARSE; | |
168 } | |
169 else { | |
170 facetType = SEDIMENT_LOAD_M3A_COARSE; | |
171 } | |
163 } | 172 } |
164 else if (fraction.equals("sand")) { | 173 else if (fraction.equals("sand")) { |
165 facetType = SEDIMENT_LOAD_SAND; | 174 if (unitIsTA) { |
175 facetType = SEDIMENT_LOAD_TA_SAND; | |
176 } | |
177 else { | |
178 facetType = SEDIMENT_LOAD_M3A_SAND; | |
179 } | |
166 } | 180 } |
167 else if (fraction.equals("fine_middle")) { | 181 else if (fraction.equals("fine_middle")) { |
168 facetType = SEDIMENT_LOAD_FINEMIDDLE; | 182 if (unitIsTA) { |
183 facetType = SEDIMENT_LOAD_TA_FINEMIDDLE; | |
184 } | |
185 else { | |
186 facetType = SEDIMENT_LOAD_M3A_FINEMIDDLE; | |
187 } | |
169 } | 188 } |
170 else if (fraction.equals("susp_sand")) { | 189 else if (fraction.equals("susp_sand")) { |
171 facetType = SEDIMENT_LOAD_SUSP_SAND; | 190 if (unitIsTA) { |
191 facetType = SEDIMENT_LOAD_TA_SUSP_SAND; | |
192 } | |
193 else { | |
194 facetType = SEDIMENT_LOAD_M3A_SAND; | |
195 } | |
172 } | 196 } |
173 else if (fraction.equals("susp_sand_bed")) { | 197 else if (fraction.equals("susp_sand_bed")) { |
174 facetType = SEDIMENT_LOAD_SUSP_SAND_BED; | 198 if (unitIsTA) { |
199 facetType = SEDIMENT_LOAD_TA_SUSP_SAND_BED; | |
200 } | |
201 else { | |
202 facetType = SEDIMENT_LOAD_M3A_SUSP_SAND_BED; | |
203 } | |
175 } | 204 } |
176 else if (fraction.equals("suspended_sediment")) { | 205 else if (fraction.equals("suspended_sediment")) { |
177 facetType = SEDIMENT_LOAD_SUSP_SEDIMENT; | 206 if (unitIsTA) { |
207 facetType = SEDIMENT_LOAD_TA_SUSP_SEDIMENT; | |
208 } | |
209 else { | |
210 facetType = SEDIMENT_LOAD_M3A_SUSP_SEDIMENT; | |
211 } | |
178 } | 212 } |
179 else if (fraction.equals("total")) { | 213 else if (fraction.equals("total")) { |
180 facetType = SEDIMENT_LOAD_TOTAL_LOAD; | 214 if (unitIsTA) { |
215 facetType = SEDIMENT_LOAD_TA_TOTAL_LOAD; | |
216 } | |
217 else { | |
218 facetType = SEDIMENT_LOAD_M3A_TOTAL_LOAD; | |
219 } | |
181 } | 220 } |
182 else { | 221 else { |
183 logger.error("Do not know fraction type " + fraction); | 222 logger.error("Do not know fraction type " + fraction); |
184 } | 223 } |
185 | 224 |