# HG changeset patch # User Felix Wolfsteller # Date 1328108413 0 # Node ID 9dc81827b1877f91d6d7d8808c393b238da51a73 # Parent 4db19a88bddbbf456ffc3041882c475b7d33f030 Add some fake 'input' data for reference curve. plot references curves from input km to input km +2. flys-artifacts/trunk@3869 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 4db19a88bddb -r 9dc81827b187 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Wed Feb 01 14:48:00 2012 +0000 +++ b/flys-artifacts/ChangeLog Wed Feb 01 15:00:13 2012 +0000 @@ -1,3 +1,17 @@ +2012-02-01 Felix Wolfsteller + + Fake some reference curve input values to have working prototype + to work on. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: + Syntax-stunt fake reference inputs. + + * src/main/java/de/intevation/flys/artifacts/model/WW.java + (getW1): Accessor for first w at index (for the raw ww). + + * src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java + (doReferenceOut): Plot the raw W-over-W. + 2012-02-01 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: Create time diff -r 4db19a88bddb -r 9dc81827b187 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Wed Feb 01 14:48:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Wed Feb 01 15:00:13 2012 +0000 @@ -649,6 +649,7 @@ return calc4.calculate(table, range[0], range[1], range[2]); } + /** * Returns the data that is computed by a reference curve computation. * @@ -683,7 +684,12 @@ return calc5.calculate(wst); } + protected Double getReferenceStartKm() { + if (true) { + return FLYSUtils.getLocations(this)[0]; + } + StateData sd = getData("reference_start"); if (sd == null) { @@ -709,8 +715,10 @@ } protected double [] getReferenceEndKms() { + StateData sd = getData("reference_end"); - StateData sd = getData("reference_end"); + if(true) + return new double[] {getReferenceStartKm() + 2.0d}; if (sd == null) { logger.warn("no reference end given."); diff -r 4db19a88bddb -r 9dc81827b187 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java Wed Feb 01 14:48:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WW.java Wed Feb 01 15:00:13 2012 +0000 @@ -93,6 +93,10 @@ ws2.add(w2); } + public double getW1(int idx) { + return ws.getQuick(idx); + } + public double getW2(int idx) { return ws2.getQuick(idx); } diff -r 4db19a88bddb -r 9dc81827b187 flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Wed Feb 01 14:48:00 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Wed Feb 01 15:00:13 2012 +0000 @@ -17,7 +17,7 @@ import de.intevation.artifactdatabase.state.ArtifactAndFacet; import de.intevation.flys.artifacts.model.FacetTypes; -import de.intevation.flys.artifacts.model.WQDay; +import de.intevation.flys.artifacts.model.WW; import de.intevation.flys.artifacts.resources.Resources; import de.intevation.flys.jfree.FLYSAnnotation; @@ -144,10 +144,17 @@ return label; } + + /** + * Called for each facet/them in the out mapped to this generator. + * @param artifactFacet artifact and facet for this theme. + * @param theme styling info. + * @param visible Whether or not the theme is visible. + */ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + Document theme, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -159,12 +166,9 @@ return; } - /* - if (name.equals(REFERENCE_W)) { - //doReference + if (name.equals(REFERENCE_CURVE)) { + doReferenceOut(artifactFacet.getData(context), theme, visible); } - */ - if (false) {} else { logger.warn("Unknown facet name: " + name); return; @@ -172,6 +176,24 @@ } + public void doReferenceOut( + Object data, + Document theme, + boolean visible + ){ + XYSeries series = new StyledXYSeries("TODO-RCG", theme); + + WW ww = (WW) (((WW.ApplyFunctionIterator)data).getWW()); + int size = ww.size(); + for (int i = 0; i < size; i++) { + series.add(ww.getW1(i), ww.getW2(i)); + } + + addAxisSeries(series, YAXIS.W.idx, visible); + } + + + /** Get Walker to iterate over all axes. */ @Override protected YAxisWalker getYAxisWalker() { return new YAxisWalker() {