Mercurial > dive4elements > river
changeset 4479:5fc7df736634
WINFOArtifact: Compute extreme values for cross sections too. Add CS-Facet.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 13 Nov 2012 14:48:57 +0100 |
parents | 6153c50f78cf |
children | 14885031d974 |
files | flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java |
diffstat | 2 files changed, 34 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Nov 13 14:46:44 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Tue Nov 13 14:48:57 2012 +0100 @@ -28,7 +28,9 @@ import de.intevation.flys.artifacts.model.WW; import de.intevation.flys.artifacts.model.WstValueTable; import de.intevation.flys.artifacts.model.WstValueTableFactory; +import de.intevation.flys.artifacts.model.extreme.ExtremeResult; +import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import de.intevation.flys.artifacts.states.LocationDistanceSelect; import de.intevation.flys.model.DischargeTable; @@ -157,6 +159,15 @@ // // METHODS FOR RETRIEVING COMPUTED DATA FOR DIFFERENT CHART TYPES // + // + /** + * Returns the data that is computed by a waterlevel computation. + * + * @return an array of data triples that consist of W, Q and Kms. + */ + public CalculationResult getWaterlevelData() { + return this.getWaterlevelData(null); + } /** * Returns the data that is computed by a waterlevel computation. @@ -167,11 +178,15 @@ { logger.debug("WINFOArtifact.getWaterlevelData"); - if (getDataAsString("calculation_mode") - .equals("calc.discharge.longitudinal.section") + String calculationMode = getDataAsString("calculation_mode"); + + if (calculationMode.equals("calc.discharge.longitudinal.section") ) { return getDischargeLongitudinalSectionData(); } + else if (calculationMode.equals("calc.extreme.curve")) { + return (CalculationResult) this.compute(context, ComputeType.ADVANCE, false); + } River river = FLYSUtils.getRiver(this); if (river == null) { @@ -625,13 +640,22 @@ */ @Override public Lines.LineData getWaterLines(int idx, FastCrossSectionLine csl, - double nextIgnored, double prevIgnored) { + double nextIgnored, double prevIgnored, CallContext context) { logger.debug("getWaterLines(" + idx + ")"); List<Point2D> points = csl.getPoints(); // Need W at km - WQKms [] wqkms = (WQKms[]) getWaterlevelData().getData(); + Object waterlevelResult = getWaterlevelData(context).getData(); + WQKms [] wqkms; + + if (waterlevelResult instanceof ExtremeResult) { + wqkms = ((ExtremeResult) waterlevelResult).getWQKms(); + } + else { + wqkms = (WQKms[]) waterlevelResult; + } + if (wqkms.length == 0) { logger.error("No WQKms found."); return Lines.createWaterLines(points, 0.0f); @@ -643,12 +667,12 @@ return waterLineC(idx, csl); } + // Find W at km, linear naive approach. + WQKms triple = wqkms[idx]; + // Find index of km. double wishKM = csl.getKm(); - // Find W at km, linear naive approach. - WQKms triple = wqkms[idx]; - if (triple.size() == 0) { logger.warn("Calculation of waterline is empty."); return Lines.createWaterLines(points, 0.0f);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java Tue Nov 13 14:46:44 2012 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java Tue Nov 13 14:48:57 2012 +0100 @@ -9,6 +9,7 @@ import de.intevation.flys.artifacts.access.ExtremeAccess; import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet; import de.intevation.flys.artifacts.model.DataFacet; import de.intevation.flys.artifacts.model.FacetTypes; import de.intevation.flys.artifacts.model.ReportFacet; @@ -88,9 +89,11 @@ i, LONGITUDINAL_W, name, ComputeType.ADVANCE, id, hash); Facet q = new WaterlevelFacet( i, LONGITUDINAL_Q, qname, ComputeType.ADVANCE, id, hash); + Facet csFacet = new CrossSectionWaterLineFacet(i, name); facets.add(w); facets.add(q); + facets.add(csFacet); }