# HG changeset patch # User gernotbelger # Date 1534520881 -7200 # Node ID bd5f5d2220fab42e3a50b75a0830f38ce37bc87f # Parent 15f274e6d83b0402fbc99508e9a58f808adcf08e Work on salix cross sections; waterlevels work now with different colors Colors and i10n for all themes. diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/doc/conf/artifacts/uinfo.xml --- a/artifacts/doc/conf/artifacts/uinfo.xml Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/doc/conf/artifacts/uinfo.xml Fri Aug 17 17:48:01 2018 +0200 @@ -150,13 +150,19 @@ - + + + + + + + - + - - - - + + + + - - + + - + - - - - + + + + - + @@ -166,14 +166,14 @@ - - - + + + - - - + + + @@ -181,1301 +181,1301 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - - - - + + + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - + + + + + @@ -1483,53 +1483,53 @@ - - - - + + + + - - + + - - - + + + - - - - - - - + + + + + + + - + - + - + - - - - - + + + + + @@ -1537,38 +1537,38 @@ - - - + + + - - + + - - + + - - - - + + + + - - + + - - - + + + @@ -1576,33 +1576,33 @@ - - - - + + + + - - - + + + - + - + - + - + @@ -1610,320 +1610,320 @@ - - + + - - + + - - - + + + - - - + + + - + - - - - - + + + + + - + - - - + + + - + - + - + - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1931,44 +1931,44 @@ - - + + - + - + - - + + - + - - - + + + - + @@ -1976,93 +1976,93 @@ - - - + + + - - + + - - + + - - + + - + - + - - - + + + - + - + - + - + - + - + - - - + + + @@ -2070,59 +2070,59 @@ - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2154,18 +2154,18 @@ - - + + - - - - - - - - + + + + + + + + @@ -2173,21 +2173,21 @@ - - - - + + + + - - - + + + - + @@ -2197,789 +2197,837 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - - + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - + + - + - - - - - - + + + + - - - - + - + + + + - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - + - + - + - + - + - + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/doc/conf/themes/second.xml --- a/artifacts/doc/conf/themes/second.xml Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/doc/conf/themes/second.xml Fri Aug 17 17:48:01 2018 +0200 @@ -2,36 +2,36 @@ - + - - - + + + - + - - - + + + - + - - + + @@ -39,126 +39,126 @@ - - + + - - + + - - - + + + - - - - + + + + - - + + - - + + - - - + + + - - - + + + - + - - + + - - + + - + - - + + - + - + - - - - - + + + + + - - - - + + + + - - + + - + - - - - + + + + - + @@ -166,14 +166,14 @@ - - - + + + - - - + + + @@ -181,1301 +181,1301 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - - - - + + + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - - + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - - - + + + + + @@ -1483,53 +1483,53 @@ - - - - + + + + - - + + - - - + + + - - - - - - - + + + + + + + - + - + - + - - - - - + + + + + @@ -1537,38 +1537,38 @@ - - - + + + - - + + - - + + - - - - + + + + - - + + - - - + + + @@ -1576,33 +1576,33 @@ - - - - + + + + - - - + + + - + - + - + - + @@ -1610,320 +1610,320 @@ - - + + - - + + - - - + + + - - - + + + - + - - - - - + + + + + - + - - - + + + - + - + - + - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1931,44 +1931,44 @@ - - + + - + - + - - + + - + - - - + + + - + @@ -1976,93 +1976,93 @@ - - - + + + - - + + - - + + - - + + - + - + - - - + + + - + - + - + - + - + - + - - - + + + @@ -2070,59 +2070,59 @@ - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + @@ -2154,18 +2154,18 @@ - - + + - - - - - - - - + + + + + + + + @@ -2173,21 +2173,21 @@ - - - - + + + + - - - + + + - + @@ -2197,777 +2197,825 @@ - - + + - - - + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - + + - + - - - - - - + + + + - - - - + - + + + + - + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - + - + - + - + - + - + - - + + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - - - - + + + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - - + + - - - + + + - + - + - + - + - + - + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionWaterLineFacet.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionWaterLineFacet.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionWaterLineFacet.java Fri Aug 17 17:48:01 2018 +0200 @@ -36,10 +36,9 @@ private final Serializable waterLineIndex; - /** Trivial constructor, set (maybe localized) description. */ - public CrossSectionWaterLineFacet(final int idx, final String description, final ComputeType type, final String hash, final String stateId, + public CrossSectionWaterLineFacet(final int facetIndex, final String description, final ComputeType type, final String hash, final String stateId, final Serializable waterLineIndex) { - this(idx, CROSS_SECTION_WATER_LINE, description, type, hash, stateId, waterLineIndex); + this(facetIndex, CROSS_SECTION_WATER_LINE, description, type, hash, stateId, waterLineIndex); } /** diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java Fri Aug 17 17:48:01 2018 +0200 @@ -30,11 +30,11 @@ private static final long serialVersionUID = 1L; - private SInfoResultType(final String unit, final String csvHeader) { + protected SInfoResultType(final String unit, final String csvHeader) { super(unit, csvHeader, csvHeader); } - private SInfoResultType(final String unit, final String csvHeader, final String pdfHeader) { + protected SInfoResultType(final String unit, final String csvHeader, final String pdfHeader) { super(unit, csvHeader, pdfHeader); } @@ -104,55 +104,6 @@ } }; - public static final SInfoResultType waterlevel1 = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.1.w", - "sinfo.flood_duration.header.pdf.mainvalue.1.w") { - private static final long serialVersionUID = 1L; - - @Override - public String exportValue(final CallContext context, final Object value) { - final double doubleValue = asDouble(value); - return exportDoubleValue(context, doubleValue); - } - - @Override - protected NumberFormat createFormatter(final CallContext context) { - return Formatter.getFlowDepth(context); - } - }; - - public static final SInfoResultType waterlevel2 = new SInfoResultType(null, "sinfo.flood_duration.header.mainvalue.2.w", - "sinfo.flood_duration.header.pdf.mainvalue.2.w") { - private static final long serialVersionUID = 1L; - - @Override - public String exportValue(final CallContext context, final Object value) { - final double doubleValue = asDouble(value); - return exportDoubleValue(context, doubleValue); - } - - @Override - protected NumberFormat createFormatter(final CallContext context) { - return Formatter.getFlowDepth(context); - } - }; - - // public static final SInfoResultType waterlevel3 = new SInfoResultType(null, - // "sinfo.flood_duration.header.mainvalue.3.w", - // "sinfo.flood_duration.header.pdf.mainvalue.3.w") { - // private static final long serialVersionUID = 1L; - // - // @Override - // public String exportValue(final CallContext context, final Object value) { - // final double doubleValue = asDouble(value); - // return exportDoubleValue(context, doubleValue); - // } - // - // @Override - // protected NumberFormat createFormatter(final CallContext context) { - // return Formatter.getFlowDepth(context); - // } - // }; - public static final SInfoResultType infrastructuretype = new SInfoResultType(I18NStrings.UNIT_NONE, "sinfo.export.flood_duration.csv.header.infrastructure_type", "sinfo.export.flood_duration.pdf.header.infrastructure_type") { private static final long serialVersionUID = 1L; diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/common/UInfoResultType.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/common/UInfoResultType.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/common/UInfoResultType.java Fri Aug 17 17:48:01 2018 +0200 @@ -23,21 +23,8 @@ private static final long serialVersionUID = 1L; - public UInfoResultType(final String unit, final String csvHeader) { + protected UInfoResultType(final String unit, final String csvHeader) { super(unit, csvHeader, csvHeader); - - } - - @Override - public String exportValue(final CallContext context, final Object value) { - // TODO Auto-generated method stub - return null; - } - - @Override - protected NumberFormat createFormatter(final CallContext context) { - // TODO Auto-generated method stub - return null; } public static final UInfoResultType customMultiRowColSalixScenarios = new UInfoResultType(null, "uinfo.export.salix_line.csv.header.scenario") { @@ -148,4 +135,57 @@ return Formatter.getUeberflutungsdauer(context); } }; -} + + public static final UInfoResultType waterlevelMNW = new UInfoResultType(null, null) { + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + throw new UnsupportedOperationException(); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; + public static final UInfoResultType waterlevelMW = new UInfoResultType(null, null) { + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + throw new UnsupportedOperationException(); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; + public static final UInfoResultType waterlevelMHW = new UInfoResultType(null, null) { + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + throw new UnsupportedOperationException(); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; + public static final UInfoResultType waterlevelMH5 = new UInfoResultType(null, null) { + private static final long serialVersionUID = 1L; + + @Override + public String exportValue(final CallContext context, final Object value) { + throw new UnsupportedOperationException(); + } + + @Override + protected NumberFormat createFormatter(final CallContext context) { + throw new UnsupportedOperationException(); + } + }; +} \ No newline at end of file diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculationResult.java Fri Aug 17 17:48:01 2018 +0200 @@ -24,6 +24,7 @@ import org.dive4elements.river.artifacts.common.ResultRow; import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType; +import org.dive4elements.river.artifacts.uinfo.salix.SalixLineCrossSectionIndexData.SalixWaterlevel; import gnu.trove.TDoubleArrayList; @@ -186,7 +187,7 @@ if (row == null) return Double.NaN; - // FIXME: hier wird die geodätische Höhe der SalixLinie benötigt; ggf schon in die Ergebnistzeilen einbauen + // FIXME: hier wird die geodätische Höhe der SalixLinie benötigt; am besten auch schon in die Ergebnistzeilen einbauen return 84.0; // return row.getDoubleValue(UInfoResultType.salixline); } @@ -202,13 +203,28 @@ return Double.NaN; // FIXME: hier wird die geodätische Höhe der SalixLinie benötigt; ggf schon als weiteres Feld an SalixScenario dranbauen - return 85; + return 89; // return salixScenario.getSalixValue(); } - public final double getWaterlevelValue(final double currentKm, final double nextKm, final double prevKm, final String waterlevelName) { + public final double getWaterlevelValue(final double currentKm, final double nextKm, final double prevKm, final SalixWaterlevel waterlevel) { + final ResultRow row = getRowForStation(currentKm, STATION_TOLERANCE); - // TODO implement - return Double.NaN; + if (row == null) + return Double.NaN; + + switch (waterlevel) { + case mnw: + return row.getDoubleValue(UInfoResultType.waterlevelMNW); + case mw: + return row.getDoubleValue(UInfoResultType.waterlevelMW); + case mhw: + return row.getDoubleValue(UInfoResultType.waterlevelMHW); + case mh5: + return row.getDoubleValue(UInfoResultType.waterlevelMH5); + + default: + throw new UnsupportedOperationException(); + } } } \ No newline at end of file diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCalculator.java Fri Aug 17 17:48:01 2018 +0200 @@ -28,7 +28,6 @@ import org.dive4elements.river.artifacts.model.WstValueTable.QPosition; import org.dive4elements.river.artifacts.model.WstValueTableFactory; import org.dive4elements.river.artifacts.sinfo.common.RiverInfoProvider; -import org.dive4elements.river.artifacts.sinfo.common.SInfoResultType; import org.dive4elements.river.artifacts.sinfo.tkhstate.WinfoArtifactWrapper; import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType; @@ -151,9 +150,12 @@ final double mnw = interpolateW(station, this.refGaugeMnwPos); final double mw = interpolateW(station, this.refGaugeMwPos); final double mhw = interpolateW(station, this.refGaugeMhwPos); - row.putValue(SInfoResultType.waterlevel, mnw); - row.putValue(SInfoResultType.waterlevel1, mw); - row.putValue(SInfoResultType.waterlevel2, mhw); + row.putValue(UInfoResultType.waterlevelMNW, mnw); + row.putValue(UInfoResultType.waterlevelMW, mw); + row.putValue(UInfoResultType.waterlevelMHW, mhw); + // TODO: hier noch den W(HQ5) + row.putValue(UInfoResultType.waterlevelMH5, Double.NaN); + // Calc salix-line and mw-mnw row.putValue(UInfoResultType.salixline, calcSalix(mhw, mw)); row.putValue(UInfoResultType.salix_mw_mnw, calcMwmnw(mw, mnw)); diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCrossSectionIndexData.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCrossSectionIndexData.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineCrossSectionIndexData.java Fri Aug 17 17:48:01 2018 +0200 @@ -19,6 +19,14 @@ * @author Gernot Belger */ public final class SalixLineCrossSectionIndexData implements Serializable { + + /** + * Known waterlevels of the salix computation + */ + public enum SalixWaterlevel { + mnw, mw, mhw, mh5 + } + private static final long serialVersionUID = 1L; private static final SalixLineCrossSectionIndexData SALIX_LINE = new SalixLineCrossSectionIndexData(null, null); @@ -28,7 +36,7 @@ private final Integer scenarioIndex; - private final String waterlevelName; + private final SalixWaterlevel waterlevel; /** * Creates an instance of this class that represants the salix line. @@ -50,18 +58,18 @@ // 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) { + public static final SalixLineCrossSectionIndexData waterlevel(final SalixWaterlevel name) { assert name != null; return new SalixLineCrossSectionIndexData(null, name); } - private SalixLineCrossSectionIndexData(final Integer scenarioIndex, final String waterlevelName) { + private SalixLineCrossSectionIndexData(final Integer scenarioIndex, final SalixWaterlevel waterlevel) { this.scenarioIndex = scenarioIndex; - this.waterlevelName = waterlevelName; + this.waterlevel = waterlevel; } - public double getCrossSectionLine(final SalixLineCalculationResults results, final double currentKm, final double nextKm, - final double prevKm, final CallContext context) { + 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); @@ -70,9 +78,9 @@ return result.getSalixScenarioValue(currentKm, nextKm, prevKm, this.scenarioIndex); } - if (this.waterlevelName != null) { + if (this.waterlevel != null) { // fetch waterlevel result data = salix line value at km - return result.getWaterlevelValue(currentKm, nextKm, prevKm, this.waterlevelName); + return result.getWaterlevelValue(currentKm, nextKm, prevKm, this.waterlevel); } // fetch normal result data = salix line value at km diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineProcessor.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineProcessor.java Fri Aug 17 17:48:01 2018 +0200 @@ -19,8 +19,12 @@ import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.access.RangeAccess; import org.dive4elements.river.artifacts.common.AbstractProcessor; +import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; +import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.resources.Resources; +import org.dive4elements.river.artifacts.states.DefaultState.ComputeType; import org.dive4elements.river.artifacts.uinfo.common.UInfoResultType; +import org.dive4elements.river.artifacts.uinfo.salix.SalixLineCrossSectionIndexData.SalixWaterlevel; import org.dive4elements.river.exports.DiagramGenerator; import org.dive4elements.river.themes.ThemeDocument; @@ -60,6 +64,15 @@ private static final String FACET_SALIX_RANK_DESCRIPTION = "uinfo_facet_salix_rank.description"; + // REMARK: must end with FacetTypes.CROSS_SECTION_WATER_LINE so its correctly recognized as such a theme + private static final String FACET_SALIX_CROSS_SECTION_WATER_LINE = "uinfo_facet_salix_line_" + FacetTypes.CROSS_SECTION_WATER_LINE; + + private static final String FACET_SALIX_CROSS_SECTION_WATER_LINE_DESCRIPTION = FACET_SALIX_CROSS_SECTION_WATER_LINE + "_description"; + + private static final String FACET_SALIX_SCENARIO_CROSS_SECTION_WATER_LINE = "uinfo_facet_salix_scenario_" + FacetTypes.CROSS_SECTION_WATER_LINE; + + private static final String FACET_SALIX_WATERLEVEL_CROSS_SECTION_WATER_LINE_PREFIX = "uinfo_facet_salix_waterlevel_"; + private static final String I18N_AXIS_LABEL = "uinfo.chart.salix_line.section.yaxis.label"; private static final Set HANDLED_FACET_TYPES = new HashSet<>(); @@ -107,8 +120,8 @@ public static Facet createSalixScenarioFilteredFacet(final CallContext context, final String hash, final String id, final int dataIndex, final int resultIndex, final int facetIndex, final String subLabel) { - final String description = Resources.getMsg(context.getMeta(), FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, - FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, subLabel); + final String description = Resources.getMsg(context.getMeta(), FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, + subLabel); return new SalixScenarioResultFacet(facetIndex, resultIndex, dataIndex, FACET_SALIX_SCENARIO_FILTERED, description, I18N_AXIS_LABEL, hash, id); } @@ -125,6 +138,33 @@ return new SalixRankResultFacet(facetIndex, resultIndex, FACET_SALIX_RANK, description, I18N_AXIS_LABEL, id, hash); } + public static Facet createSalixCrossSectionFacet(final CallContext context, final ComputeType type, final String hash, final String stateId, + final int facetIndex) { + final String description = Resources.getMsg(context.getMeta(), FACET_SALIX_CROSS_SECTION_WATER_LINE_DESCRIPTION); + return new CrossSectionWaterLineFacet(facetIndex, FACET_SALIX_CROSS_SECTION_WATER_LINE, description, type, hash, stateId, + SalixLineCrossSectionIndexData.salixLine()); + } + + public static Facet createSalixScenarioCrossSectionFacet(final CallContext context, final ComputeType type, final String hash, final String stateId, + final int scenarioIndex, final int facetIndex, final String subLabel) { + + final String description = Resources.getMsg(context.getMeta(), FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, FACET_SALIX_SCENARIO_FILTERED_DESCRIPTION, + subLabel); + + return new CrossSectionWaterLineFacet(facetIndex, FACET_SALIX_SCENARIO_CROSS_SECTION_WATER_LINE, description, type, hash, stateId, + SalixLineCrossSectionIndexData.scenario(scenarioIndex)); + } + + public static Facet createSalixWaterlevelCrossSectionFacet(final CallContext context, final ComputeType type, final String hash, final String stateId, + final SalixWaterlevel knownWaterlevel, final int facetIndex) { + final String facetName = FACET_SALIX_WATERLEVEL_CROSS_SECTION_WATER_LINE_PREFIX + knownWaterlevel.name() + "_" + FacetTypes.CROSS_SECTION_WATER_LINE; + final String facetI10n = facetName + "_description"; + final String facetDescirption = Resources.getMsg(context.getMeta(), facetI10n); + + return new CrossSectionWaterLineFacet(facetIndex, facetName, facetDescirption, type, hash, stateId, + SalixLineCrossSectionIndexData.waterlevel(knownWaterlevel)); + } + @Override protected String generateSeries(final DiagramGenerator generator, final ArtifactAndFacet bundle, final ThemeDocument theme, final boolean visible) { @@ -139,7 +179,6 @@ } if (bundle.getFacetName().equals(FACET_SALIX_RANK)) { - final CallContext context = generator.getContext(); final RangeAccess kmRange = new RangeAccess((D4EArtifact) bundle.getArtifact()); // TODO get all rank data (5 ranks) from database final double[][] points = new double[2][2]; diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineState.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineState.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineState.java Fri Aug 17 17:48:01 2018 +0200 @@ -17,7 +17,6 @@ import org.dive4elements.river.artifacts.D4EArtifact; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.CalculationResult; -import org.dive4elements.river.artifacts.model.CrossSectionWaterLineFacet; import org.dive4elements.river.artifacts.model.DataFacet; import org.dive4elements.river.artifacts.model.EmptyFacet; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -25,6 +24,7 @@ import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.states.DefaultState; import org.dive4elements.river.artifacts.uinfo.UINFOArtifact; +import org.dive4elements.river.artifacts.uinfo.salix.SalixLineCrossSectionIndexData.SalixWaterlevel; /** * @author Domenico Nardi Tironi @@ -90,23 +90,24 @@ facets.add(SalixLineProcessor.createSalixMnwMwRawFacet(context, hash, stateId, facetIndex++, 0)); facets.add(SalixLineProcessor.createSalixRankFacet(context, hash, stateId, facetIndex++, 0)); - facets.add(new CrossSectionWaterLineFacet(facetIndex++, "Salix Linie (!I10N!)", type, hash, stateId, SalixLineCrossSectionIndexData.salixLine())); + facets.add(SalixLineProcessor.createSalixCrossSectionFacet(context, type, hash, stateId, facetIndex++)); final SalixLineCalculationResult result = resultList.get(0); for (int i = 0; i <= result.getScenarioCount() - 1; i++) { - final String sublabel = Resources.getMsg(context.getMeta(), "uinfo_salix_scenario_deltaw", "uinfo_salix_scenario_deltaw", - result.getScenarioLabel(i)); + final String scenarioLabel = result.getScenarioLabel(i); + + final String sublabel = Resources.getMsg(context.getMeta(), "uinfo_salix_scenario_deltaw", "uinfo_salix_scenario_deltaw", scenarioLabel); // REMARK: using data index as facetIndex, as we know there is only one result of this type. Else we should just // increment facets.add(SalixLineProcessor.createSalixScenarioFilteredFacet(context, hash, stateId, i, 0, facetIndex++, sublabel)); facets.add(SalixLineProcessor.createSalixScenarioRawFacet(context, hash, stateId, i, 0, facetIndex++, sublabel)); - facets.add(new CrossSectionWaterLineFacet(facetIndex++, "Salix Linie Scenario (!I10N! )" + i, type, hash, stateId, - SalixLineCrossSectionIndexData.scenario(i))); + facets.add(SalixLineProcessor.createSalixScenarioCrossSectionFacet(context, type, hash, stateId, i, facetIndex++, sublabel)); } - // FIXME: add cross section wst lines (MW, MMHW, ...) + for (final SalixWaterlevel knownWaterlevel : SalixLineCrossSectionIndexData.SalixWaterlevel.values()) + facets.add(SalixLineProcessor.createSalixWaterlevelCrossSectionFacet(context, type, hash, stateId, knownWaterlevel, facetIndex++)); final Facet csv = new DataFacet(FacetTypes.CSV, "CSV data", ComputeType.ADVANCE, hash, stateId); final Facet pdf = new DataFacet(FacetTypes.PDF, "PDF data", ComputeType.ADVANCE, hash, stateId); diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java Fri Aug 17 17:48:01 2018 +0200 @@ -288,7 +288,7 @@ attr, visible); } - else if (name.equals(CROSS_SECTION_WATER_LINE)) { + else if (name.endsWith(CROSS_SECTION_WATER_LINE)) { doCrossSectionWaterLineOut( artifactFacet.getData(context), artifactFacet.getFacetDescription(), diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/resources/messages.properties Fri Aug 17 17:48:01 2018 +0200 @@ -1184,7 +1184,12 @@ uinfo_salix_calc.warning.missing_mq = MQ (MW) missing at reference gauge, no calculation possible uinfo_salix_calc.warning.missing_mhq = MHQ (MHW) missing at reference gauge, no salix calculation possible uinfo_salix_calc.warning.missing_mnq = MNQ (MNW) missing at reference gauge, no (MW-MNW) calculation possible -uinfo_salix_calc.warning.missing_bedheights = missing bed height values in the scenario range +uinfo_salix_calc.warning.missing_bedheights = missing bed height values in the scenario range +uinfo_facet_salix_line_cross_section_water_line_description = Iota +uinfo_facet_salix_waterlevel_mnw_cross_section_water_line_description = W(MNQ) +uinfo_facet_salix_waterlevel_mw_cross_section_water_line_description = W(MQ) +uinfo_facet_salix_waterlevel_mhw_cross_section_water_line_description = W(MHQ) +uinfo_facet_salix_waterlevel_mh5_cross_section_water_line_description = W(HQ5) predefineddepthevol.total.title = Gesamt: {0} predefineddepthevol.peryear.title = J\u00e4hrlich: {0} diff -r 15f274e6d83b -r bd5f5d2220fa artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Fri Aug 17 17:40:59 2018 +0200 +++ b/artifacts/src/main/resources/messages_de.properties Fri Aug 17 17:48:01 2018 +0200 @@ -1184,7 +1184,12 @@ uinfo_salix_calc.warning.missing_mq = MQ (MW) fehlt am Bezugspegel, Berechnung nicht m\u00f6glich uinfo_salix_calc.warning.missing_mhq = MHQ (MHW) fehlt am Bezugspegel, Berechnung des Iota nicht m\u00f6glich uinfo_salix_calc.warning.missing_mnq = MNQ (MNW) fehlt am Bezugspegel, Berechnung von (MW-MNW) nicht m\u00f6glich -uinfo_salix_calc.warning.missing_bedheights = Im Teilabschnitt fehlen Sohlh\u00f6hen +uinfo_salix_calc.warning.missing_bedheights = Im Teilabschnitt fehlen Sohlh\u00f6hen +uinfo_facet_salix_line_cross_section_water_line_description = Iota +uinfo_facet_salix_waterlevel_mnw_cross_section_water_line_description = W(MNQ) +uinfo_facet_salix_waterlevel_mw_cross_section_water_line_description = W(MQ) +uinfo_facet_salix_waterlevel_mhw_cross_section_water_line_description = W(MHQ) +uinfo_facet_salix_waterlevel_mh5_cross_section_water_line_description = W(HQ5) predefineddepthevol.total.title = Gesamt: {0} predefineddepthevol.peryear.title = J\u00e4hrlich: {0} diff -r 15f274e6d83b -r bd5f5d2220fa gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java --- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java Fri Aug 17 17:40:59 2018 +0200 +++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/chart/CrossSectionChartThemePanel.java Fri Aug 17 17:48:01 2018 +0200 @@ -619,7 +619,7 @@ @Override protected boolean canArea(Theme a) { return a.getFacet().equals("cross_section") - || a.getFacet().equals("cross_section_water_line") + || a.getFacet().endsWith("cross_section_water_line") || a.getFacet().endsWith("line"); }