Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixationCompute.java @ 3192:cd309f8597f6
Fix for 'linecolor ignored' issue
flys-artifacts/trunk@4808 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 27 Jun 2012 11:50:24 +0000 |
parents | c130be3fa809 |
children | 1b9f791937c3 |
comparison
equal
deleted
inserted
replaced
3191:ef0db530c341 | 3192:cd309f8597f6 |
---|---|
61 | 61 |
62 private static final String I18N_DEVIATION = "fix.deviation"; | 62 private static final String I18N_DEVIATION = "fix.deviation"; |
63 | 63 |
64 private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation"; | 64 private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation"; |
65 | 65 |
66 public static class IdGenerator { | |
67 private int id; | |
68 | |
69 public IdGenerator() { | |
70 } | |
71 | |
72 public IdGenerator(int id) { | |
73 this.id = id; | |
74 } | |
75 | |
76 public int next() { | |
77 return id++; | |
78 } | |
79 | |
80 public int next(int s) { | |
81 return id += s; | |
82 } | |
83 } | |
84 | |
66 /** | 85 /** |
67 * The default constructor that initializes an empty State object. | 86 * The default constructor that initializes an empty State object. |
68 */ | 87 */ |
69 public FixationCompute() { | 88 public FixationCompute() { |
70 } | 89 } |
102 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); | 121 facets.add(new ReportFacet(ComputeType.ADVANCE, hash, id)); |
103 } | 122 } |
104 facets.add( | 123 facets.add( |
105 new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); | 124 new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id)); |
106 | 125 |
126 int maxId = -100; | |
107 | 127 |
108 int count = access.getAnalysisPeriods().length; | 128 int count = access.getAnalysisPeriods().length; |
129 | |
109 for (int i = 0; i < count; i++) { | 130 for (int i = 0; i < count; i++) { |
110 DateRange period = access.getAnalysisPeriods()[i]; | 131 DateRange period = access.getAnalysisPeriods()[i]; |
111 DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); | 132 DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); |
112 String startDate = df.format(period.getFrom()); | 133 String startDate = df.format(period.getFrom()); |
113 String endDate = df.format(period.getTo()); | 134 String endDate = df.format(period.getTo()); |
129 | 150 |
130 int sectorNdx = j - access.getQSectorStart().intValue(); | 151 int sectorNdx = j - access.getQSectorStart().intValue(); |
131 int facetNdx = i << 2; | 152 int facetNdx = i << 2; |
132 facetNdx = facetNdx | j; | 153 facetNdx = facetNdx | j; |
133 | 154 |
155 if (facetNdx > maxId) maxId = facetNdx; | |
156 | |
134 facets.add( | 157 facets.add( |
135 new FixAvSectorFacet(facetNdx, | 158 new FixAvSectorFacet(facetNdx, |
136 FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx, | 159 FIX_SECTOR_AVERAGE_DWT + "_" + sectorNdx, |
137 description)); | 160 description)); |
138 facets.add( | 161 facets.add( |
148 new FixAvSectorFacet(facetNdx, | 171 new FixAvSectorFacet(facetNdx, |
149 FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx, | 172 FIX_SECTOR_AVERAGE_WQ + "_" + sectorNdx, |
150 description)); | 173 description)); |
151 | 174 |
152 } | 175 } |
176 | |
153 String eventDesc = | 177 String eventDesc = |
154 Resources.getMsg(context.getMeta(), | 178 Resources.getMsg(context.getMeta(), |
155 I18N_ANALYSIS, | 179 I18N_ANALYSIS, |
156 I18N_ANALYSIS) + | 180 I18N_ANALYSIS) + |
157 ": " + startDate + " - " + endDate; | 181 ": " + startDate + " - " + endDate; |
164 facets.add(new FixAnalysisEventsFacet(i, | 188 facets.add(new FixAnalysisEventsFacet(i, |
165 FIX_ANALYSIS_EVENTS_WQ, | 189 FIX_ANALYSIS_EVENTS_WQ, |
166 eventDesc)); | 190 eventDesc)); |
167 } | 191 } |
168 | 192 |
193 IdGenerator idg = new IdGenerator(maxId); | |
194 | |
169 String i18n_ref = Resources.getMsg(context.getMeta(), | 195 String i18n_ref = Resources.getMsg(context.getMeta(), |
170 I18N_REFERENCEPERIOD, | 196 I18N_REFERENCEPERIOD, |
171 I18N_REFERENCEPERIOD); | 197 I18N_REFERENCEPERIOD); |
172 String i18n_dev = Resources.getMsg(context.getMeta(), | 198 String i18n_dev = Resources.getMsg(context.getMeta(), |
173 I18N_REFERENCEDEVIATION, | 199 I18N_REFERENCEDEVIATION, |
174 I18N_REFERENCEDEVIATION); | 200 I18N_REFERENCEDEVIATION); |
175 | 201 |
176 | 202 |
177 facets.add(new FixReferenceEventsFacet(0, | 203 facets.add(new FixReferenceEventsFacet(idg.next(), |
178 FIX_REFERENCE_EVENTS_DWT, | 204 FIX_REFERENCE_EVENTS_DWT, |
179 i18n_ref)); | 205 i18n_ref)); |
180 facets.add(new FixLongitudinalReferenceFacet(1, | 206 facets.add(new FixLongitudinalReferenceFacet(idg.next(), |
181 FIX_REFERENCE_EVENTS_LS, | 207 FIX_REFERENCE_EVENTS_LS, |
182 i18n_ref)); | 208 i18n_ref)); |
183 facets.add(new FixReferenceEventsFacet(2, | 209 facets.add(new FixReferenceEventsFacet(idg.next(), |
184 FIX_REFERENCE_EVENTS_WQ, | 210 FIX_REFERENCE_EVENTS_WQ, |
185 i18n_ref)); | 211 i18n_ref)); |
186 | 212 |
187 facets.add(new FixLongitudinalDeviationFacet(0, | 213 facets.add(new FixLongitudinalDeviationFacet(idg.next(), |
188 FIX_DEVIATION_LS, | 214 FIX_DEVIATION_LS, |
189 i18n_dev)); | 215 i18n_dev)); |
190 | 216 |
191 String i18n_ana = Resources.getMsg(context.getMeta(), | 217 String i18n_ana = Resources.getMsg(context.getMeta(), |
192 I18N_ANALYSISPERIODS, | 218 I18N_ANALYSISPERIODS, |
193 I18N_ANALYSISPERIODS); | 219 I18N_ANALYSISPERIODS); |
194 facets.add(new FixAnalysisPeriodsFacet(0, | 220 facets.add(new FixAnalysisPeriodsFacet(idg.next(), |
195 FIX_ANALYSIS_PERIODS_DWT, | 221 FIX_ANALYSIS_PERIODS_DWT, |
196 i18n_ana)); | 222 i18n_ana)); |
197 facets.add(new FixAnalysisPeriodsFacet(1, | 223 facets.add(new FixAnalysisPeriodsFacet(idg.next(), |
198 FIX_ANALYSIS_PERIODS_LS, | 224 FIX_ANALYSIS_PERIODS_LS, |
199 i18n_ana)); | 225 i18n_ana)); |
200 facets.add(new FixAnalysisPeriodsFacet(2, | 226 facets.add(new FixAnalysisPeriodsFacet(idg.next(), |
201 FIX_ANALYSIS_PERIODS_WQ, | 227 FIX_ANALYSIS_PERIODS_WQ, |
202 i18n_ana)); | 228 i18n_ana)); |
203 | 229 |
204 facets.add(new FixWQCurveFacet("W/Q")); | 230 |
231 facets.add(new FixWQCurveFacet(idg.next(), "W/Q")); | |
205 | 232 |
206 Boolean preprocessing = access.getPreprocessing(); | 233 Boolean preprocessing = access.getPreprocessing(); |
207 | 234 |
208 if (preprocessing != null && preprocessing) { | 235 if (preprocessing != null && preprocessing) { |
209 facets.add(new FixOutlierFacet(FIX_OUTLIER, | 236 facets.add(new FixOutlierFacet(idg.next(), FIX_OUTLIER, |
210 Resources.getMsg(context.getMeta(), I18N_OUTLIER, I18N_OUTLIER))); | 237 Resources.getMsg(context.getMeta(), I18N_OUTLIER, I18N_OUTLIER))); |
211 } | 238 } |
212 | 239 |
213 facets.add(new FixDerivateFacet(FIX_DERIVATE, | 240 facets.add(new FixDerivateFacet( |
241 idg.next(), | |
242 FIX_DERIVATE, | |
214 Resources.getMsg(context.getMeta(), | 243 Resources.getMsg(context.getMeta(), |
215 I18N_DERIVATIVE, | 244 I18N_DERIVATIVE, |
216 I18N_DERIVATIVE))); | 245 I18N_DERIVATIVE))); |
217 | 246 |
218 facets.add(new FixDeviationFacet(FIX_DEVIATION_DWT, | 247 facets.add(new FixDeviationFacet( |
248 idg.next(), | |
249 FIX_DEVIATION_DWT, | |
219 Resources.getMsg(context.getMeta(), | 250 Resources.getMsg(context.getMeta(), |
220 I18N_DEVIATION, | 251 I18N_DEVIATION, |
221 I18N_DEVIATION))); | 252 I18N_DEVIATION))); |
222 return res; | 253 return res; |
223 } | 254 } |