comparison artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java @ 8202:e4606eae8ea5

sed src/**/*.java 's/logger/log/g'
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 05 Sep 2014 12:58:17 +0200
parents 59e50aa0c6c2
children 7f1fb07e4e3d
comparison
equal deleted inserted replaced
8201:4b8c5a08de04 8202:e4606eae8ea5
55 private YAXIS(int c) { 55 private YAXIS(int c) {
56 idx = c; 56 idx = c;
57 } 57 }
58 } 58 }
59 59
60 /** The logger used in this generator. */ 60 /** The log used in this generator. */
61 private static Logger logger = 61 private static Logger log =
62 Logger.getLogger(DischargeCurveGenerator.class); 62 Logger.getLogger(DischargeCurveGenerator.class);
63 63
64 public static final String I18N_CHART_TITLE = 64 public static final String I18N_CHART_TITLE =
65 "chart.discharge.curve.title"; 65 "chart.discharge.curve.title";
66 66
85 // Look if there is a gauge at chosen km: 85 // Look if there is a gauge at chosen km:
86 // Get gauge which is defined for km 86 // Get gauge which is defined for km
87 Gauge gauge = 87 Gauge gauge =
88 RiverUtils.getRiver(artifact).determineGauge(km-0.1d, km+0.1d); 88 RiverUtils.getRiver(artifact).determineGauge(km-0.1d, km+0.1d);
89 if (gauge == null) { 89 if (gauge == null) {
90 logger.error("No Gauge could be found at station " + km + "!"); 90 log.error("No Gauge could be found at station " + km + "!");
91 return 0d; 91 return 0d;
92 } 92 }
93 double subtractPNP = 0d; 93 double subtractPNP = 0d;
94 // Compare to km. 94 // Compare to km.
95 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) { 95 if (Math.abs(km - gauge.getStation().doubleValue()) < tolerance) {
152 if (fixedWinMRange != null) { 152 if (fixedWinMRange != null) {
153 boundsInMGauge = new DoubleBounds(fixedWinMRange.getLowerBound(), 153 boundsInMGauge = new DoubleBounds(fixedWinMRange.getLowerBound(),
154 fixedWinMRange.getUpperBound()); 154 fixedWinMRange.getUpperBound());
155 } 155 }
156 156
157 logger.debug("Syncing Axis Bounds. Bounds W: " + boundsInMGauge.toString() + 157 log.debug("Syncing Axis Bounds. Bounds W: " + boundsInMGauge.toString() +
158 " Bounds Wcm: " + boundsInCM.toString()); 158 " Bounds Wcm: " + boundsInCM.toString());
159 159
160 double datum = getCurrentGaugeDatum(); 160 double datum = getCurrentGaugeDatum();
161 161
162 // Convert boundsInMGauge to Datum+cm 162 // Convert boundsInMGauge to Datum+cm
172 (Double)boundsInCM.getUpper() / 100d + datum); 172 (Double)boundsInCM.getUpper() / 100d + datum);
173 173
174 // Set the new combined bounds 174 // Set the new combined bounds
175 setYBounds(YAXIS.W.idx, boundsInMGauge); 175 setYBounds(YAXIS.W.idx, boundsInMGauge);
176 setYBounds(YAXIS.WCm.idx, boundsInCM); 176 setYBounds(YAXIS.WCm.idx, boundsInCM);
177 logger.debug("Synced Bounds W: " + boundsInMGauge.toString() + 177 log.debug("Synced Bounds W: " + boundsInMGauge.toString() +
178 " Bounds Wcm: " + boundsInCM.toString()); 178 " Bounds Wcm: " + boundsInCM.toString());
179 } 179 }
180 180
181 public DischargeCurveGenerator() { 181 public DischargeCurveGenerator() {
182 super(); 182 super();
235 /** Translate River annotations if a gauge. */ 235 /** Translate River annotations if a gauge. */
236 public void translateRiverAnnotation(RiverAnnotation riverAnnotation) { 236 public void translateRiverAnnotation(RiverAnnotation riverAnnotation) {
237 if (getCurrentGaugeDatum() == 0d) { 237 if (getCurrentGaugeDatum() == 0d) {
238 return; 238 return;
239 } 239 }
240 logger.debug("Translate some river annotation."); 240 log.debug("Translate some river annotation.");
241 double translate = getCurrentGaugeDatum(); 241 double translate = getCurrentGaugeDatum();
242 double factor = 100d; 242 double factor = 100d;
243 for (StickyAxisAnnotation annotation: riverAnnotation.getAxisTextAnnotations()){ 243 for (StickyAxisAnnotation annotation: riverAnnotation.getAxisTextAnnotations()){
244 if (!annotation.atX()) { 244 if (!annotation.atX()) {
245 annotation.setPos((annotation.getPos() - translate)*factor); 245 annotation.setPos((annotation.getPos() - translate)*factor);
256 ArtifactAndFacet artifactFacet, 256 ArtifactAndFacet artifactFacet,
257 ThemeDocument theme, 257 ThemeDocument theme,
258 boolean visible 258 boolean visible
259 ) { 259 ) {
260 String name = artifactFacet.getFacetName(); 260 String name = artifactFacet.getFacetName();
261 logger.debug("DischargeCurveGenerator.doOut: " + name); 261 log.debug("DischargeCurveGenerator.doOut: " + name);
262 262
263 MiscDischargeProcessor dProcessor = new MiscDischargeProcessor(getRange()[0]); 263 MiscDischargeProcessor dProcessor = new MiscDischargeProcessor(getRange()[0]);
264 if (dProcessor.canHandle(name)) { 264 if (dProcessor.canHandle(name)) {
265 // In Base DischargeCurveGenerator, always at gauge, use WCm axis. 265 // In Base DischargeCurveGenerator, always at gauge, use WCm axis.
266 dProcessor.doOut(this, artifactFacet, theme, visible, YAXIS.WCm.idx); 266 dProcessor.doOut(this, artifactFacet, theme, visible, YAXIS.WCm.idx);
284 artifactFacet, 284 artifactFacet,
285 theme, 285 theme,
286 visible); 286 visible);
287 } 287 }
288 else { 288 else {
289 logger.warn("DischargeCurveGenerator.doOut: Unknown facet name: " + name); 289 log.warn("DischargeCurveGenerator.doOut: Unknown facet name: " + name);
290 return; 290 return;
291 } 291 }
292 } 292 }
293 293
294 294
300 Object o, 300 Object o,
301 String description, 301 String description,
302 ThemeDocument theme, 302 ThemeDocument theme,
303 boolean visible) 303 boolean visible)
304 { 304 {
305 logger.debug("DischargeCurveGenerator.doDischargeOut"); 305 log.debug("DischargeCurveGenerator.doDischargeOut");
306 WQKms wqkms = (WQKms) o; 306 WQKms wqkms = (WQKms) o;
307 307
308 String gaugeName = wqkms.getName(); 308 String gaugeName = wqkms.getName();
309 309
310 River river = RiverUtils.getRiver(artifact); 310 River river = RiverUtils.getRiver(artifact);
311 311
312 if (river == null) { 312 if (river == null) {
313 logger.debug("no river found"); 313 log.debug("no river found");
314 return; 314 return;
315 } 315 }
316 316
317 Gauge gauge = river.determineGaugeByName(gaugeName); 317 Gauge gauge = river.determineGaugeByName(gaugeName);
318 318
319 if (gauge == null) { 319 if (gauge == null) {
320 logger.debug("no gauge found"); 320 log.debug("no gauge found");
321 return; 321 return;
322 } 322 }
323 323
324 XYSeries series = new StyledXYSeries(description, theme); 324 XYSeries series = new StyledXYSeries(description, theme);
325 325
337 Object wqkms, 337 Object wqkms,
338 ArtifactAndFacet aaf, 338 ArtifactAndFacet aaf,
339 ThemeDocument theme, 339 ThemeDocument theme,
340 boolean visible 340 boolean visible
341 ) { 341 ) {
342 logger.debug("DischargeCurveGenerator: doQOut (add W/Q data)."); 342 log.debug("DischargeCurveGenerator: doQOut (add W/Q data).");
343 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme); 343 XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
344 344
345 StyledSeriesBuilder.addPointsQW(series, (WQKms) wqkms); 345 StyledSeriesBuilder.addPointsQW(series, (WQKms) wqkms);
346 346
347 addAxisSeries(series, YAXIS.W.idx, visible); 347 addAxisSeries(series, YAXIS.W.idx, visible);
398 Object wq, 398 Object wq,
399 ArtifactAndFacet aaf, 399 ArtifactAndFacet aaf,
400 ThemeDocument theme, 400 ThemeDocument theme,
401 boolean visible 401 boolean visible
402 ) { 402 ) {
403 logger.debug("DischargeCurveGenerator: doWQOut"); 403 log.debug("DischargeCurveGenerator: doWQOut");
404 double [][] data = (double [][]) wq; 404 double [][] data = (double [][]) wq;
405 String title = aaf.getFacetDescription(); 405 String title = aaf.getFacetDescription();
406 406
407 double translate = getCurrentGaugeDatum(); 407 double translate = getCurrentGaugeDatum();
408 408

http://dive4elements.wald.intevation.org