# HG changeset patch # User Felix Wolfsteller # Date 1323159984 0 # Node ID 3b08b8aacfb0276041970b8943617711fee310cc # Parent a5f87f8dbe57b182f660b12e04773d0b60e66c91 Fix flys/issue423, do not interpolate main values at gauge. flys-artifacts/trunk@3357 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r a5f87f8dbe57 -r 3b08b8aacfb0 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Dec 05 10:40:14 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Dec 06 08:26:24 2011 +0000 @@ -1,3 +1,20 @@ +2011-12-06 Felix Wolfsteller + + 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 * src/main/java/de/intevation/flys/utils/MapfileGenerator.java: Modified @@ -14,6 +31,7 @@ not. In addition, the scenario parameter used by WSPLGEN is now set correctly. +>>>>>>> .r3356 2011-12-05 Felix Wolfsteller Allow longitudinal_section.q facets in wdiff states output. diff -r a5f87f8dbe57 -r 3b08b8aacfb0 flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Dec 05 10:40:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Tue Dec 06 08:26:24 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 fs = new ArrayList(); fs.add(qfacet1); @@ -233,7 +237,7 @@ * Get a list of "Q" main values. * @return list of Q main values. */ - public List getMainValuesQ() { + public List getMainValuesQ(boolean atGauge) { List filteredList = new ArrayList(); Gauge gauge = getGauge(); WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); @@ -246,8 +250,13 @@ List 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 getMainValuesW() { + public List getMainValuesW(boolean atGauge) { List filteredList = new ArrayList(); Gauge gauge = getGauge(); WstValueTable interpolator = WstValueTableFactory.getTable(FLYSUtils.getRiver(this)); @@ -276,6 +286,13 @@ if (gauge != null) { List 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")) { diff -r a5f87f8dbe57 -r 3b08b8aacfb0 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Mon Dec 05 10:40:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java Tue Dec 06 08:26:24 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 qs = mvArtifact.getMainValuesQ(); + List qs = mvArtifact.getMainValuesQ(isAtGauge); List xy = new ArrayList(); 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; } diff -r a5f87f8dbe57 -r 3b08b8aacfb0 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Mon Dec 05 10:40:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java Tue Dec 06 08:26:24 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 ws = mvArtifact.getMainValuesW(); + List ws = mvArtifact.getMainValuesW(isAtGauge); List xy = new ArrayList(); 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; }