Mercurial > dive4elements > river
changeset 3811:1558ef7b0e7b
Picked rev3357, rev3359 and rev3360 from trunk.
flys-artifacts/tags/pre2.6-2011-12-05@3362 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 07 Dec 2011 13:36:36 +0000 |
parents | b6431052a694 |
children | f788d2d901d6 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java |
diffstat | 5 files changed, 106 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Dec 05 10:51:15 2011 +0000 +++ b/flys-artifacts/ChangeLog Wed Dec 07 13:36:36 2011 +0000 @@ -1,3 +1,40 @@ +2011-12-06 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Further flys/issue420 fix (No Discharge Curves for Mosel). + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + (includeYRange, mergeRanges): Moved NaN-guard to lowest level. + (combineXRanges): Also NaN guard the X Axis extent. + +2011-12-06 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Partial fix for flys/issue420 (Berechnete Abflusskurve: Kein Diagramm für + Mosel). Protect axis extent calculation from empty or invalid + datasets. + + * src/main/java/de/intevation/flys/exports/XYChartGenerator.java: + (includeRange, includeYRange): Renamed, updated callers. + (includeYRange): Protect from merging extent with NaNs. + (debugDatasets): Be more verbose on the datasets. + (zoom): Doc. + +2011-12-06 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Fix flys/issue423 (Diagramm: Hauptwerte bei Abflusskurve am Pegel + werden an Y-Achse nicht angezeigt) - show not "raw" (vs interpolated) + values at Gauge. + + * src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java, + src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java: + Add parameterization to let facet know whether to fetch data at + Gauges or at Artifacts position. + + * src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java: + Let the MainValueFacets know whether to ask for interpolated + MainValues; (do not interpolate for Gauges Main Values). + (getMainValuesQ, getMainValuesW): Added parameter to control + interpolation. + 2011-12-05 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/utils/MapfileGenerator.java: Modified @@ -14,6 +51,7 @@ not. In addition, the scenario parameter used by WSPLGEN is now set correctly. +>>>>>>> .r3356 2011-12-05 Felix Wolfsteller <felix.wolfsteller@intevation.de> Allow longitudinal_section.q facets in wdiff states output.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Dec 05 10:51:15 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Wed Dec 07 13:36:36 2011 +0000 @@ -83,25 +83,29 @@ Resources.getMsg( callMeta, "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q")); + "facet.discharge_curves.mainvalues.q"), + false); Facet qfacet2 = new MainValuesQFacet( MAINVALUES_Q, Resources.getMsg( callMeta, "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q")); + "facet.discharge_curves.mainvalues.q"), + true); Facet wfacet1 = new MainValuesWFacet( COMPUTED_DISCHARGE_MAINVALUES_W, Resources.getMsg( callMeta, "facet.discharge_curves.mainvalues.w", - "facet.discharge_curves.mainvalues.w")); + "facet.discharge_curves.mainvalues.w"), + false); Facet wfacet2 = new MainValuesWFacet( MAINVALUES_W, Resources.getMsg( callMeta, "facet.discharge_curves.mainvalues.w", - "facet.discharge_curves.mainvalues.w")); + "facet.discharge_curves.mainvalues.w"), + true); List<Facet> fs = new ArrayList<Facet>(); fs.add(qfacet1); @@ -233,7 +237,7 @@ * Get a list of "Q" main values. * @return list of Q main values. */ - public List<NamedDouble> getMainValuesQ() { + public List<NamedDouble> getMainValuesQ(boolean atGauge) { List<NamedDouble> filteredList = new ArrayList<NamedDouble>(); Gauge gauge = getGauge(); WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); @@ -246,8 +250,13 @@ List<MainValue> orig = gauge.getMainValues(); for (MainValue mv : orig) { if (mv.getMainValue().getType().getName().equals("Q")) { - interpolator.interpolate(mv.getValue().doubleValue(), + if (atGauge) { + q_out[0] = mv.getValue().doubleValue(); + } + else { + interpolator.interpolate(mv.getValue().doubleValue(), gaugeStation, kms, w_out, q_out, c); + } filteredList.add(new NamedDouble( mv.getMainValue().getName(), q_out[0] @@ -261,9 +270,10 @@ /** * Get a list of "W" main values. + * @param atGauge if true, do not interpolate * @return list of W main values. */ - public List<NamedDouble> getMainValuesW() { + public List<NamedDouble> getMainValuesW(boolean atGauge) { List<NamedDouble> filteredList = new ArrayList<NamedDouble>(); Gauge gauge = getGauge(); WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); @@ -276,6 +286,13 @@ if (gauge != null) { List<MainValue> orig = gauge.getMainValues(); for (MainValue mv : orig) { + if (atGauge) { + if (mv.getMainValue().getType().getName().equals("W")) { + filteredList.add(new NamedDouble(mv.getMainValue().getName(), + mv.getValue().doubleValue())); + + } + } else // We cannot interpolate the W values, so derive them // from given Q values. if (mv.getMainValue().getType().getName().equals("Q")) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Mon Dec 05 10:51:15 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Wed Dec 07 13:36:36 2011 +0000 @@ -22,11 +22,15 @@ extends DefaultFacet implements FacetTypes { + /** Do we want MainValues at Gauge (not interpolated)? */ + protected boolean isAtGauge; + /** Trivial Constructor. */ - public MainValuesQFacet(String name, String description) { + public MainValuesQFacet(String name, String description, boolean atGauge) { this.description = description; this.name = name; - index = 0; + this.index = 0; + this.isAtGauge = atGauge; } @@ -42,7 +46,7 @@ public Object getData(Artifact artifact, CallContext context) { MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; - List<NamedDouble> qs = mvArtifact.getMainValuesQ(); + List<NamedDouble> qs = mvArtifact.getMainValuesQ(isAtGauge); List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); for (NamedDouble q: qs) { @@ -62,7 +66,8 @@ */ @Override public MainValuesQFacet deepCopy() { - MainValuesQFacet copy = new MainValuesQFacet(this.name, description); + MainValuesQFacet copy = new MainValuesQFacet(this.name, + description, this.isAtGauge); copy.set(this); return copy; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Mon Dec 05 10:51:15 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Wed Dec 07 13:36:36 2011 +0000 @@ -22,11 +22,15 @@ extends DefaultFacet implements FacetTypes { + /** Do we want MainValues at Gauge (not interpolated)? */ + protected boolean isAtGauge; + /** Trivial Constructor. */ - public MainValuesWFacet(String name, String description) { + public MainValuesWFacet(String name, String description, boolean atGauge) { this.description = description; this.name = name; - index = 0; + this.index = 0; + this.isAtGauge = atGauge; } @@ -42,7 +46,7 @@ public Object getData(Artifact artifact, CallContext context) { MainValuesArtifact mvArtifact = (MainValuesArtifact) artifact; - List<NamedDouble> ws = mvArtifact.getMainValuesW(); + List<NamedDouble> ws = mvArtifact.getMainValuesW(isAtGauge); List<XYTextAnnotation> xy = new ArrayList<XYTextAnnotation>(); for (NamedDouble w: ws) { @@ -50,7 +54,6 @@ w.getName(), (float) w.getValue(), StickyAxisAnnotation.SimpleAxis.Y_AXIS)); - } return new FLYSAnnotation(description, xy); @@ -63,7 +66,8 @@ */ @Override public MainValuesWFacet deepCopy() { - MainValuesWFacet copy = new MainValuesWFacet(this.name, description); + MainValuesWFacet copy = new MainValuesWFacet(this.name, + description, this.isAtGauge); copy.set(this); return copy; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Mon Dec 05 10:51:15 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java Wed Dec 07 13:36:36 2011 +0000 @@ -78,6 +78,12 @@ /** Merge (or create given range with range so far (if any). */ private void mergeRanges(Range subRange) { + // Avoid merging NaNs, as they take min/max place forever. + if (subRange == null || + Double.isNaN(subRange.getLowerBound()) || + Double.isNaN(subRange.getUpperBound())) { + return; + } if (range == null) { range = subRange; return; @@ -88,11 +94,11 @@ /** Add a dataset, include its range. */ public void addDataset(XYSeries dataset) { this.datasets.add(new XYSeriesCollection(dataset)); - includeRange(dataset); + includeYRange(dataset); } /** Adjust range to include given dataset. */ - public void includeRange(XYSeries dataset) { + public void includeYRange(XYSeries dataset) { mergeRanges(new Range(dataset.getMinY(), dataset.getMaxY())); } @@ -258,6 +264,11 @@ continue; } logger.debug("Dataset #" + i + ":" + plot.getDataset(i)); + XYSeriesCollection series = (XYSeriesCollection) plot.getDataset(i); + logger.debug("X-Extend of Dataset: " + series.getSeries(0).getMinX() + + " " + series.getSeries(0).getMaxX()); + logger.debug("Y-Extend of Dataset: " + series.getSeries(0).getMinY() + + " " + series.getSeries(0).getMaxY()); } } @@ -335,13 +346,16 @@ datasets.put(index, axisDataset); } + logger.debug("Series-extent x " + series.getMinX() + " : " + series.getMaxX() + + " extend y " + series.getMinY() + " : " + series.getMaxY()); + if (visible) { axisDataset.addDataset(series); } else { // Do this also when not visible to have axis scaled by default such // that every data-point could be seen (except for annotations). - axisDataset.includeRange(series); + axisDataset.includeYRange(series); } combineXRanges(new Range(series.getMinX(), series.getMaxX()), 0); @@ -355,6 +369,12 @@ */ private void combineXRanges(Range range, int index) { + if (range == null + || Double.isNaN(range.getLowerBound()) + || Double.isNaN(range.getUpperBound())) { + return; + } + Range old = xRanges.get(index); if (old != null) { @@ -491,10 +511,10 @@ /** * Zooms the x axis to the range specified in the attribute document. * - * @param plot The XYPlot. - * @param axis The axis the shoud be modified. + * @param plot The XYPlot. + * @param axis The axis the shoud be modified. * @param range The whole range specified by a dataset. - * @param x A user defined range (null permitted). + * @param x A user defined range (null permitted). * * @return true, if a zoom range was specified, otherwise false. */