Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCrossSectionIndexData.java @ 9427:3b188c34d422
salix.regional scenario select bugfix
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 16:48:24 +0200 |
parents | b6e595f1696f |
children | bd5f5d2220fa |
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde * Software engineering by * Björnsen Beratende Ingenieure GmbH * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt * * This file is Free Software under the GNU AGPL (>=v3) * and comes with ABSOLUTELY NO WARRANTY! Check out the * documentation coming with Dive4Elements River for details. */ package org.dive4elements.river.artifacts.uinfo.salix; import java.io.Serializable; import org.dive4elements.artifacts.CallContext; /** * The 'index' that tells the cross section facet which of my result are to be fetched as a cross section line. * * @author Gernot Belger */ public final class SalixLineCrossSectionIndexData implements Serializable { private static final long serialVersionUID = 1L; private static final SalixLineCrossSectionIndexData SALIX_LINE = new SalixLineCrossSectionIndexData(null, null); // REMARK: we know at the moment there is exactly one result private final int resultIndex = 0; private final Integer scenarioIndex; private final String waterlevelName; /** * Creates an instance of this class that represants the salix line. */ public static final SalixLineCrossSectionIndexData salixLine() { return SALIX_LINE; } /** * Creates an instance of this class that represants the salix line. */ public static final SalixLineCrossSectionIndexData scenario(final int scenarioIndex) { return new SalixLineCrossSectionIndexData(scenarioIndex, null); } /** * Creates an instance of this class that represants the salix line. */ // FIXME: gemeint sind die einzublendenden 'MNW, MW, MHW, HW5' mir nicht klar wo diese Daten herkommen, ggf. aus der // Rechnung? // FIXME: statt 'name' vielleicht eine enum oder irgend etwas anderes was diese dinger eindeutig referenzieet? public static final SalixLineCrossSectionIndexData waterlevel(final String name) { assert name != null; return new SalixLineCrossSectionIndexData(null, name); } private SalixLineCrossSectionIndexData(final Integer scenarioIndex, final String waterlevelName) { this.scenarioIndex = scenarioIndex; this.waterlevelName = waterlevelName; } public double getCrossSectionLine(final SalixLineCalculationResults results, final double currentKm, final double nextKm, final double prevKm, final CallContext context) { final SalixLineCalculationResult result = results.getResults().get(this.resultIndex); if (this.scenarioIndex != null) { // fetch scenario result data = salix line value at km return result.getSalixScenarioValue(currentKm, nextKm, prevKm, this.scenarioIndex); } if (this.waterlevelName != null) { // fetch waterlevel result data = salix line value at km return result.getWaterlevelValue(currentKm, nextKm, prevKm, this.waterlevelName); } // fetch normal result data = salix line value at km return result.getSalixValue(currentKm, nextKm, prevKm); } }