Mercurial > dive4elements > river
changeset 1802:26d7077e42d2
Corrected CrossSection diagram/out to include one facet per computed waterlevel.
flys-artifacts/trunk@3126 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 01 Nov 2011 10:40:05 +0000 |
parents | 6f83d9d434f2 |
children | 51e59f221333 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java |
diffstat | 4 files changed, 32 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Oct 31 17:05:14 2011 +0000 +++ b/flys-artifacts/ChangeLog Tue Nov 01 10:40:05 2011 +0000 @@ -1,3 +1,20 @@ +2011-11-01 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Show multiple water lines and facets in cross-section diagram if + multiple waterlevel values had been entered. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java + (appendBackgroundActivity): Made static. + (getWaterLines): Add 'idx' argument to specify index of queried + waterlevel. + + * src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java: + Add index. + + * src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java: + Add one Facet for each of the computed waterlevels. + + 2011-10-31 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/geom/VectorUtils.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Mon Oct 31 17:05:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Nov 01 10:40:05 2011 +0000 @@ -189,7 +189,7 @@ } - protected void appendBackgroundActivity( + protected static void appendBackgroundActivity( ElementCreator cr, Element root, CallContext context @@ -744,10 +744,11 @@ * @return an array holding coordinates of points of surface of water ( * in the form {{x1, x2} {y1, y2}} ). */ - public double [][] getWaterLines() { + public double [][] getWaterLines(int idx) { logger.debug("getWaterLines()"); CrossSectionLine csl = searchCrossSectionKmLine(); List<Point2D> points = csl.fetchCrossSectionLinesPoints(); + // Need W at km WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); if (wqkms.length == 0) { @@ -755,11 +756,14 @@ return Lines.createWaterLines(points, 0.0f); } - if (wqkms.length > 1) { - logger.warn("More than one wqkms found, taking first one."); + if (wqkms.length < idx) { + logger.error("getWaterLines() requested index (" + + idx + " not found."); } + // Find W at km, linear naive approach. - WQKms triple = wqkms[0]; + WQKms triple = wqkms[idx]; + // Find index of km. double wishKM = 0.0f; int old_idx = 0;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java Mon Oct 31 17:05:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java Tue Nov 01 10:40:05 2011 +0000 @@ -22,8 +22,8 @@ /** Trivial constructor, set (maybe localized) description. */ - public CrossSectionWaterLineFacet(String description) { - super(0, CROSS_SECTION_WATER_LINE, description); + public CrossSectionWaterLineFacet(int idx, String description) { + super(idx, CROSS_SECTION_WATER_LINE, description); } @@ -35,14 +35,14 @@ WINFOArtifact winfo = (WINFOArtifact)artifact; - return winfo.getWaterLines(); + return winfo.getWaterLines(this.getIndex()); } /** Do a deep copy. */ @Override public Facet deepCopy() { - CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet(this.description); + CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet(this.getIndex(), this.description); copy.set(this); return copy; }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java Mon Oct 31 17:05:14 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java Tue Nov 01 10:40:05 2011 +0000 @@ -71,6 +71,8 @@ Facet q = new WaterlevelFacet( i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash); + facets.add(new CrossSectionWaterLineFacet(i, nameQ)); + facets.add(w); facets.add(q); } @@ -85,10 +87,6 @@ facets.add(csv); // Also register the CrossSectionFacet (added to respective out). facets.add(new CrossSectionFacet(winfo.getCrossSectionName())); - // Assume to be in wq_single mode. - // TODO: Use createWTitle for label. - facets.add(new CrossSectionWaterLineFacet("Q=" + - winfo.getDataAsString("wq_single"))); } if (res.getReport().hasProblems()) {