# HG changeset patch # User mschaefer # Date 1519297411 -3600 # Node ID 89f3c5462a163c9f41e963cbec2a6401f05c7a71 # Parent f431aec10d2cc6a6d4a8dbcf6f7b18397c48a3aa Implemented S-INFO Flowdepth TKH calculation diff -r f431aec10d2c -r 89f3c5462a16 .hgignore --- a/.hgignore Wed Feb 14 19:06:21 2018 +0100 +++ b/.hgignore Thu Feb 22 12:03:31 2018 +0100 @@ -25,3 +25,30 @@ \.swo \.pyc TAGS + +\.checkstyle +\.log +syntax: regexp +^artifacts/doc/conf/log4j\.properties$ +syntax: regexp +^artifacts/doc/conf/seddb-db\.xml$ +syntax: regexp +^artifacts/doc$ +syntax: regexp +^artifacts/artifactsdb$ +syntax: regexp +^artifacts/cache$ +syntax: regexp +^artifacts/datacagedb$ +syntax: regexp +^artifacts/contrib$ +syntax: regexp +^artifacts/conf$ +syntax: regexp +\.map$ +syntax: regexp +^gwt-client/debug_user_file\.txt$ +gwt-client/pom\.xml +syntax: glob +contrib/.project +doc/.project diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedQualityD50KmValueFinder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/BedQualityD50KmValueFinder.java Thu Feb 22 12:03:31 2018 +0100 @@ -0,0 +1,209 @@ +/* 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.sinfo.flowdepth; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.math.DoubleRange; +import org.apache.commons.math.ArgumentOutsideDomainException; +import org.apache.commons.math.analysis.interpolation.LinearInterpolator; +import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; +import org.apache.log4j.Logger; +import org.dive4elements.river.artifacts.model.DateRange; +import org.dive4elements.river.backend.SedDBSessionHolder; +import org.dive4elements.river.model.River; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.type.StandardBasicTypes; + +/** + * Searchable sorted km array with parallel bed measurements value array and linear interpolation for km and d50 between the array elements. + * @author Matthias Schäfer + * + */ +public class BedQualityD50KmValueFinder { + + /***** INNER CLASSES *****/ + + /** + * A bed measurements aggregate with its d50 characteristic grain diameter + */ + private class D50Measurement { + private double km; + public double getKm() { + return km; + } + private Date mindate; + public Date getMinDate() { + return mindate; + } + private Date maxdate; + public Date getMaxDate() { + return maxdate; + } + private int cnt; + public int getCnt() { + return cnt; + } + private double mindepth; + public double getMinDepth() { + return mindepth; + } + private double maxdepth; + public double getMaxDepth() { + return maxdepth; + } + private double d50; + /** + * D50 in m + */ + public double getD50() { + return d50; + } + /** + * Parameter constructor + */ + public D50Measurement(double km, Date mindate, Date maxdate, int cnt, double mindepth, double maxdepth, double d50mm) { + this.km = km; + this.mindate = mindate; + this.maxdate = maxdate; + this.cnt = cnt; + this.mindepth = mindepth; + this.maxdepth = maxdepth; + this.d50 = d50mm / 1000; + } + + /** + * Query result row constructor + */ + public D50Measurement(Object[] tuple, String[] aliases) { + km = 0; + mindate = null; + maxdate = null; + cnt = 0; + mindepth = Double.NaN; + maxdepth = Double.NaN; + d50 = Double.NaN; + for (int i = 0; i < tuple.length; ++i) { + if (tuple[i] == null) + continue; + switch (aliases[i]) { + case "km": + km = ((Number) tuple[i]).doubleValue(); + break; + case "mindate": + mindate = (Date) tuple[i]; + break; + case "maxdate": + maxdate = (Date) tuple[i]; + break; + case "cnt": + cnt = ((Number) tuple[i]).intValue(); + break; + case "mindepth": + mindepth = ((Number) tuple[i]).doubleValue(); + break; + case "maxdepth": + maxdepth = ((Number) tuple[i]).doubleValue(); + break; + case "d50": + d50 = ((Number) tuple[i]).doubleValue() / 1000; // mm to m + break; + default: + break; + } + } + } + } + + /***** FIELDS *****/ + + /** + * Private log to use here. + */ + private static Logger log = Logger.getLogger(BedQualityD50KmValueFinder.class); + + /** + * Query that aggregates by km for a km range and a time period all sub layer bed measurements with their d50
+ *
+ * A km may have bed measurements for multiple dates, multiple distances from the river bank, and multiple depth layers. + * The query filters by km range, time period and layer (sub layer: below bed to max. 50 cm depth). + * Those measurements are then grouped by km, and the D50 aggregated as average value. + */ + private static final String SQL_BED_D50_SUBLAYER_MEASUREMENT = + "SELECT t.km, MIN(t.datum) AS mindate, MAX(t.datum) AS maxdate, COUNT(*) AS cnt," + + " MIN(p.tiefevon) AS mindepth, MAX(p.tiefebis) AS maxdepth, AVG(a.d50) AS d50" + + " FROM sohltest t INNER JOIN station s ON t.stationid = s.stationid" + + " INNER JOIN gewaesser g ON s.gewaesserid = g.gewaesserid" + + " INNER JOIN sohlprobe p ON t.sohltestid = p.sohltestid" + + " INNER JOIN siebanalyse a ON p.sohlprobeid = a.sohlprobeid" + + " WHERE (g.name = :name) AND (s.km BETWEEN :fromkm - 0.0001 AND :tokm + 0.0001)" + + " AND (p.tiefevon > 0.0) AND (p.tiefebis <= 0.5)" + + " AND (t.datum BETWEEN :fromdate AND :todate)" + + " GROUP BY t.km" + + " ORDER BY t.km"; + private static final String[] SQL_BED_D50_SELECT_ALIAS = {"km", "mindate", "maxdate", "cnt", "mindepth", "maxdepth", "d50"}; + + /** + * Real linear interpolator for kms and d50 values + */ + private PolynomialSplineFunction interpolator; + + /***** METHODS *****/ + + /** + * Returns the d50 value interpolated according to a km + * @throws ArgumentOutsideDomainException + */ + public double findD50(double km) throws ArgumentOutsideDomainException { + return interpolator.value(km); + } + + /** + * Loads the range of the river's kms with their associated values. + * @return Whether the load has been successful + */ + public boolean loadValues(final River river, final DoubleRange kmRange, final DateRange dateRange) { + log.debug(String.format("loadValues km %.3f - %.3f %tF - %tF", kmRange.getMinimumDouble(), kmRange.getMaximumDouble(), dateRange.getFrom(), dateRange.getTo())); + Session session = SedDBSessionHolder.HOLDER.get(); + SQLQuery sqlQuery = session.createSQLQuery(SQL_BED_D50_SUBLAYER_MEASUREMENT) + .addScalar("km", StandardBasicTypes.DOUBLE) + .addScalar("mindate", StandardBasicTypes.DATE) + .addScalar("maxdate", StandardBasicTypes.DATE) + .addScalar("cnt", StandardBasicTypes.INTEGER) + .addScalar("mindepth", StandardBasicTypes.DOUBLE) + .addScalar("maxdepth", StandardBasicTypes.DOUBLE) + .addScalar("d50", StandardBasicTypes.DOUBLE); + String seddbRiver = river.nameForSeddb(); + sqlQuery.setString("name", seddbRiver); + sqlQuery.setDouble("fromkm", kmRange.getMinimumDouble()); + sqlQuery.setDouble("tokm", kmRange.getMaximumDouble()); + sqlQuery.setDate("fromdate", dateRange.getFrom()); + sqlQuery.setDate("todate", dateRange.getTo()); + @SuppressWarnings("unchecked") + final List rows = sqlQuery.list(); + final double[] kms = new double[rows.size()]; + final double[] values = new double[rows.size()]; + D50Measurement measurement; + int i = -1; + for (Object[] row : rows) { + measurement = new D50Measurement(row, SQL_BED_D50_SELECT_ALIAS); + i++; + kms[i] = measurement.getKm(); + values[i] = measurement.getD50(); + log.debug(String.format("loadValues km %.3f d50(mm) %.1f count %d", kms[i], values[i], measurement.getCnt())); + } + interpolator = new LinearInterpolator().interpolate(kms, values); + return true; + } + +} diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java --- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Wed Feb 14 19:06:21 2018 +0100 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowDepthCalculation.java Thu Feb 22 12:03:31 2018 +0100 @@ -16,18 +16,19 @@ import java.util.Date; import java.util.List; +import org.apache.commons.lang.math.DoubleRange; import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.analysis.UnivariateRealFunction; +import org.apache.log4j.Logger; import org.dive4elements.artifacts.ArtifactDatabase; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.BedHeightsArtifact; import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.artifacts.model.CalculationResult; +import org.dive4elements.river.artifacts.model.DateRange; import org.dive4elements.river.artifacts.model.LocationProvider; -import org.dive4elements.river.artifacts.model.QKms; +import org.dive4elements.river.artifacts.model.WQKms; import org.dive4elements.river.artifacts.model.WKms; -import org.dive4elements.river.artifacts.model.minfo.QualityMeasurementFactory; -import org.dive4elements.river.artifacts.model.minfo.QualityMeasurements; import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.artifacts.sinfo.SINFOArtifact; import org.dive4elements.river.artifacts.sinfo.flowdepth.FlowDepthAccess.DifferencesPair; @@ -43,6 +44,8 @@ class FlowDepthCalculation { + private static Logger log = Logger.getLogger(FlowDepthCalculation.class); + private static final int VALID_BED_MEASUREMENT_YEARS = 20; private static final String CSV_NOT_IN_GAUGE_RANGE = "export.waterlevel.csv.not.in.gauge.range"; @@ -70,6 +73,7 @@ final double from = access.getFrom(); final double to = access.getTo(); + final DoubleRange calcRange = new DoubleRange(from, to); final boolean useTkh = access.isUseTransportBodies(); @@ -84,7 +88,7 @@ final FlowDepthCalculationResults results = new FlowDepthCalculationResults(calcModeLabel, user, river, from, to, useTkh); for (final DifferencesPair diffPair : diffPairs) { - final FlowDepthCalculationResult result = calculateResult(river, from, to, diffPair, problems, gaugeIndex); + final FlowDepthCalculationResult result = calculateResult(river, calcRange, diffPair, problems, gaugeIndex, useTkh); if (result != null) results.addResult(result); } @@ -92,14 +96,17 @@ return new CalculationResult(results, problems); } - private FlowDepthCalculationResult calculateResult(final River river, final double from, final double to, final DifferencesPair diffPair, - final Calculation problems, final GaugeIndex gaugeIndex) { + /** + * Calculates one W-MSH differences pair. + */ + private FlowDepthCalculationResult calculateResult(final River river, final DoubleRange calcRange, final DifferencesPair diffPair, + final Calculation problems, final GaugeIndex gaugeIndex, final boolean useTkh) { /* access real input data from database */ final String soundingId = diffPair.getSoundingId(); final String wstId = diffPair.getWstId(); - final BedHeight bedHeight = loadBedHeight(soundingId, from, to); + final BedHeight bedHeight = loadBedHeight(soundingId); if (bedHeight == null) { final String message = Resources.format(this.context.getMeta(), "Failed to access sounding with id '{0}'", soundingId); problems.addProblem(message); @@ -136,36 +143,49 @@ // FIXME: nur prüfen/beschaffen wenn TKH Berechnung aktiv /* Abflusswerte vorhanden? */ - if (!(wstKms instanceof QKms)) { + if (!(wstKms instanceof WQKms)) { final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingQ", null, label); problems.addProblem(message); // TODO: keine Berechnung TKH } - final QualityMeasurements bedMeasurements = getBedMeasurements(river, from, to, sounding.getYear()); - // FIXME: prüfung ob (genug) werte vorhanden sind? was sind genau die kriterien? falls nein, problemhinzufügen und keine + BedQualityD50KmValueFinder bedMeasurementsFinder = null; + if (useTkh) + bedMeasurementsFinder = loadBedMeasurements(river, calcRange, sounding.getYear()); + // FIXME: prüfung ob (genug) werte vorhanden sind? was sind genau die kriterien? falls nein, problem hinzufügen und keine // berechnung tkh - // FIXME: wie wird ggf. interpoliert? --> absprache? - // FIXME: mir direkt aufgefallen, die Beispieldatenbank liefert Werte zum gleichen km und zeitpunkt, die messwerte sind - // aber unterschiedlich....??? - // FIXME: die eigentlichen daten extrahieren, ggf. wenn esswerte zum gleichen datum voriliegen. das neueste nehmen? oder - // das näheste zum Peiljahr? - - // FIXME Art der Gewässersohle (starr/mobil) - // FIXME: wie wird ggf. interpoliert? prüfung ob werte vorhanden? final String bedHeightLabel = bedHeight.getDescription(); final String wstLabel = wstKms.getName(); final UnivariateRealFunction wstInterpolator = DoubleUtil.getLinearInterpolator(wstKms.allKms(), wstKms.allWs()); - + UnivariateRealFunction qInterpolator = null; + DoubleRange qRange = null; + if (useTkh && (wstKms instanceof WQKms)) { + qInterpolator = DoubleUtil.getLinearInterpolator(((WQKms) wstKms).allKms(), ((WQKms) wstKms).allQs()); + qRange = new DoubleRange( ((WQKms) wstKms).allQs().min(), ((WQKms) wstKms).allQs().max()); + } + // FIXME: sort by station first, but in what direction? + // FIXME: using river.getKmUp()? final List values = bedHeight.getValues(); final List sortedValues = new ArrayList<>(values); Collections.sort(sortedValues, new BedHeightStationComparator()); - SoilKind lastKind = SoilKind.mobil; + // FIXME: wie wird ggf. interpoliert? prüfung ob werte vorhanden? + /* SoilKind lastKind = SoilKind.mobil; */ + SoilKindKmValueFinder soilKindFinder = null; + if (useTkh) { + soilKindFinder = new SoilKindKmValueFinder(); + soilKindFinder.loadValues(river, calcRange); + } + + FlowVelocityModelKmValueFinder flowVelocitiesFinder = null; + if (useTkh) { + flowVelocitiesFinder = new FlowVelocityModelKmValueFinder(); + flowVelocitiesFinder.loadValues(river, calcRange, qRange); + } for (final BedHeightValue bedHeightValue : sortedValues) { @@ -180,6 +200,9 @@ final double km = station; final double meanBedHeight = meanBedHeightDbl; + if (!calcRange.containsDouble(km)) + continue; + try { // FIXME: check out of range final double wst = wstInterpolator.value(km); @@ -188,30 +211,63 @@ // FIXME: piecewise constant interpolation? // final double discharge = wstKms instanceof QKms ? ((QKms) wstKms).getQ(i) : Double.NaN; - final double discharge = Double.NaN; + double discharge; + if (qInterpolator != null) + discharge = qInterpolator.value(km); + else + discharge = Double.NaN; // FIXME: calculate tkh - - // REMARK: bissl spielerei zum testen damit die sohlart nicht zu schnell wechselt + double tkh = 0; + if (useTkh) { + double d50 = 0; + try { + d50 = bedMeasurementsFinder.findD50(km); + } catch (Exception e) { + final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingD50", null, label); + problems.addProblem(km, message); + //FIXME: cumulate problems + } + if (flowVelocitiesFinder.findKmQValues(km, discharge)) { + tkh = calculateTkh(wst - meanBedHeight, flowVelocitiesFinder.getFindVmainFound(), d50, flowVelocitiesFinder.getFindTauFound()); + log.debug(String.format("calculateTkh km %.3f q %.0f w %.2f mbh %.2f vm %.1f tau %.1f d50(mm) %.1f tkh(cm) %.1f", + km, discharge, wst, meanBedHeight, flowVelocitiesFinder.getFindVmainFound(), flowVelocitiesFinder.getFindTauFound(), d50*1000, tkh)); + } + else + tkh = Double.NaN; + } + + // Soil kind + SoilKind kind = SoilKind.starr; + if (useTkh) { + try { + kind = soilKindFinder.findSoilKind(km); + } catch (Exception e) { + final String message = Resources.getMsg(this.context.getMeta(), "sinfo_calc_flow_depth.warning.missingSoilKind", null, label); + problems.addProblem(km, message); + //FIXME: cumulate problems + } + } + + /* // REMARK: bissl spielerei zum testen damit die sohlart nicht zu schnell wechselt + SoilKind kind; final boolean changeKind = Math.random() > 0.95; - SoilKind kind; if (changeKind) { switch (lastKind) { case starr: kind = SoilKind.mobil; break; - case mobil: default: kind = SoilKind.starr; break; - } } else kind = lastKind; lastKind = kind; - - final double tkh = 100 + 10 * (Math.random() - 0.5); + */ + + //tkh = 100 + 10 * (Math.random() - 0.5); final double flowDepthTkh; final double tkhUp; @@ -240,8 +296,8 @@ final String gaugeLabel = gauge == null ? notinrange : gauge.getName(); - resultData.addRow(km, flowDepth, flowDepthTkh, kind, tkh, tkhUp, tkhDown, wst, discharge, wstLabel, gaugeLabel, meanBedHeight, bedHeightLabel, - location); + resultData.addRow(km, flowDepth, flowDepthTkh, kind, tkh, tkhUp, tkhDown, wst, discharge, wstLabel, + gaugeLabel, meanBedHeight, bedHeightLabel, location); } catch (final FunctionEvaluationException e) { /* should only happen if out of range */ @@ -258,7 +314,7 @@ * Sohlbeschaffenheit (D50 Korndurchmesser aus Seddb) * Abhängig von Peiljahr */ - private QualityMeasurements getBedMeasurements(final River river, final double from, final double to, final int soundingYear) { + private BedQualityD50KmValueFinder loadBedMeasurements(final River river, final DoubleRange kmRange, final int soundingYear) { /* construct valid measurement time range */ final Calendar cal = Calendar.getInstance(); @@ -270,7 +326,11 @@ cal.set(soundingYear + VALID_BED_MEASUREMENT_YEARS, 11, 31); final Date endTime = cal.getTime(); - return QualityMeasurementFactory.getBedMeasurements(river.getName(), from, to, startTime, endTime); + final BedQualityD50KmValueFinder finder = new BedQualityD50KmValueFinder(); + if (finder.loadValues(river, kmRange, new DateRange(startTime, endTime))) + return finder; + else + return null; } /** @@ -348,10 +408,10 @@ } } - private BedHeight loadBedHeight(final String soundingId, final double from, final double to) { + private BedHeight loadBedHeight(final String soundingId) { // REMARK: absolutely unbelievable.... - // The way how bed-heights (and other data too) is accessed is different for nearly ever calculation-type + // The way how bed-heights (and other data too) is accessed is different for nearly every calculation-type // throughout flys. // The knowledge on how to parse the datacage-ids is spread through the complete code-base... @@ -375,4 +435,28 @@ return BedHeight.getBedHeightById(bedheightId); } + + /** + * Calculates a transport body height + * @param h flow depth in m + * @param vm flow velocity in m + * @param d50 grain diameter D50 in m (!) + * @param tau shear stress in N/m^2 + * @return transport body height in cm (!) + */ + private double calculateTkh(double h, double vm, double d50, double tau) { + final double PHYS_G = 9.81; + final double PHYS_SPECGRAV_S = 2.6; + final double PHYS_VELOCCOEFF_N = 6; + final double PHYS_FORMCOEFF_ALPHA = 0.7; + final double PHYS_VISCOSITY_NUE = 1.3e-6; + final double PHYS_GRAIN_DENSITY_RHOS = 2603; + final double PHYS_WATER_DENSITY_RHO = 999.97; + + final double froude = vm / Math.sqrt(PHYS_G * h); + final double partReynolds = Math.sqrt((PHYS_SPECGRAV_S - 1) * PHYS_G * d50) / PHYS_VISCOSITY_NUE * d50; + final double critShields = 0.22 * Math.pow(partReynolds, -0.6) + 0.06 * Math.pow(10, 7.7 * Math.pow(partReynolds, -0.6)); + final double critTau = critShields * (PHYS_GRAIN_DENSITY_RHOS - PHYS_WATER_DENSITY_RHO) * PHYS_G * d50; + return 100 * h * (1 - Math.pow(froude, 2)) / (2 * PHYS_VELOCCOEFF_N * PHYS_FORMCOEFF_ALPHA) * (1 - critTau / tau); + } } \ No newline at end of file diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowVelocityKmModelValues.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowVelocityKmModelValues.java Thu Feb 22 12:03:31 2018 +0100 @@ -0,0 +1,186 @@ +/* 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.sinfo.flowdepth; + +import org.apache.commons.math.analysis.interpolation.LinearInterpolator; +import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction; + +import gnu.trove.TDoubleArrayList; + +/** + * Sorted arrays of a station's q, v, and tau model values, running in parallel + * @author Matthias Schäfer + * + */ +public class FlowVelocityKmModelValues { + + /***** FIELDS *****/ + + /** + * Km + */ + private double km; + + /** + * The station's discharge model values, sorted in ascending order + */ + private TDoubleArrayList qs; + + /** + * The station's main section velocity for the q values + */ + private TDoubleArrayList vmains; + + /** + * The station's shear stress (tau) values for the q values + */ + private TDoubleArrayList taus; + + /** + * Discharge found by the last findQ + */ + private double findQ; + + /** + * Velocity found by the last {@link findQ} + */ + private double vmainFound; + + /** + * Shear stress found by the last {@link findQ} + */ + private double tauFound; + + /** + * Whether qFound has been interpolated + */ + private boolean isInterpolated; + + /** + * Real linear interpolator for q and v values + */ + private PolynomialSplineFunction vInterpolator; + + /** + * Real linear interpolator for q and tau values + */ + private PolynomialSplineFunction tauInterpolator; + + + /***** CONSTRUCTORS *****/ + + /** + * Constructor with km parameter + */ + public FlowVelocityKmModelValues(double km) { + this.km = km; + qs = new TDoubleArrayList(); + vmains = new TDoubleArrayList(); + taus = new TDoubleArrayList(); + vInterpolator = null; + tauInterpolator = null; + } + + /** + * Copy constructor with new km + */ + public FlowVelocityKmModelValues(double km, FlowVelocityKmModelValues src) { + this(km); + src.copyTo(qs, vmains, taus); + } + + /***** METHODS *****/ + + /** + * Number of the q-v-tau tuples + */ + public int size() { + if (qs != null) + return qs.size(); + else + return 0; + } + + /** + * Km + */ + public double getKm() { + return km; + } + + /** + * Adds all q-v-tau to another set of arrays + */ + void copyTo(TDoubleArrayList dstqs, TDoubleArrayList dstvmains, TDoubleArrayList dsttaus) { + for (int i = 0; i <= qs.size(); i++) { + dstqs.add(qs.getQuick(i)); + dstvmains.add(vmains.getQuick(i)); + dsttaus.add(taus.getQuick(i)); + } + } + + /** + * Discharge found by the last {@link findQ} + * @return + */ + public double getFindQ() { + return findQ; + } + + /** + * Velocity found by the last {@link findQ} + */ + public double getVmainFound() { + return vmainFound; + } + + /** + * Shear stress found by the last {@link findQ} + */ + public double getTauFound() { + return tauFound; + } + + /** + * Whether qFound has been interpolated + */ + public boolean getIsInterpolated() { + return isInterpolated; + } + + /** + * Adds a q-v-tau value triple. + */ + public void addValues(double q, double vmain, double tau) { + qs.add(q); + vmains.add(vmain); + taus.add(tau); + } + + /** + * Searches a discharge value and returns it or the interpolated value + * @return Found or interpolated discharge, or NaN otherwise + */ + public double findQ(double q) { + if (vInterpolator == null) { + vInterpolator = new LinearInterpolator().interpolate(qs.toNativeArray(), vmains.toNativeArray()); + tauInterpolator = new LinearInterpolator().interpolate(qs.toNativeArray(), taus.toNativeArray()); + } + findQ = q; + try { + vmainFound = vInterpolator.value(q); + tauFound = tauInterpolator.value(q); + } catch (Exception e) { + q = Double.NaN; + } + return q; + } +} diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowVelocityModelKmValueFinder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/FlowVelocityModelKmValueFinder.java Thu Feb 22 12:03:31 2018 +0100 @@ -0,0 +1,330 @@ +/* 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.sinfo.flowdepth; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.math.DoubleRange; +import org.apache.log4j.Logger; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.type.StandardBasicTypes; + +import gnu.trove.TDoubleArrayList; + +import org.dive4elements.river.artifacts.math.Linear; +import org.dive4elements.river.artifacts.math.Utils; +import org.dive4elements.river.backend.SessionHolder; +import org.dive4elements.river.model.River; + +/** + * Searchable sorted km array with parallel FlowVelocityKmModelValues array and linear interpolation for km and the model values between the array elements.
+ * {@link loadValues} loads all the model values for a given km range of a river.
+ * {@link findKmQValues} then searches a km in the values table or the nearest including km interval, resp. + * The v and tau values for a given discharge are either found directly or also interpolated linearly.
+ * + * (Created based on a copy of FlowVelocityMeasurementFactory.) + * + * @author Matthias Schäfer + * + */ +public class FlowVelocityModelKmValueFinder +{ + /***** FIELDS *****/ + + /** + * Private log to use here. + */ + private static Logger log = Logger.getLogger(FlowVelocityModelKmValueFinder.class); + + /** + * Query for a range of stations of a river with all their q, main-v and tau values.
+ * (Might be several 10000 rows if many stations and large q range) + */ + private static final String SQL_SELECT_ALL = + "SELECT fvmv.station AS station, fvmv.q AS q, fvmv.main_channel AS vmain, fvmv.shear_stress AS tau" + + " FROM (discharge_zone dz INNER JOIN flow_velocity_model fvm ON dz.id = fvm.discharge_zone_id)" + + " INNER JOIN flow_velocity_model_values fvmv ON fvm.id = fvmv.flow_velocity_model_id" + + " WHERE (dz.river_id = :river_id) AND (fvmv.station BETWEEN :kmfrom - 0.0001 AND :kmto + 0.0001)" + /* + " WHERE (dz.river_id = :river_id) AND (fvmv.q BETWEEN :qmin AND :qmax)" */ + + " ORDER BY fvmv.station ASC, fvmv.q ASC"; + + /** + * Query for a river's max km below a limit with all its q, main-v and tau values. + */ + private static final String SQL_SELECT_KMLOWER = + "SELECT fvmv.station AS station, fvmv.q AS q, fvmv.main_channel AS vmain, fvmv.shear_stress AS tau" + + " FROM flow_velocity_model_values fvmv" + + " INNER JOIN (SELECT MAX(fvmvi.station) AS kmmax" + + " FROM(discharge_zone dz INNER JOIN flow_velocity_model fvm ON dz.id = fvm.discharge_zone_id)" + + " INNER JOIN flow_velocity_model_values fvmvi ON fvm.id = fvmvi.flow_velocity_model_id" + + " WHERE (dz.river_id = :river_id) AND (fvmvi.station < :kmfrom - 0.0001)) finf ON fvmv.station = finf.kmmax" + + " ORDER BY fvmv.q ASC"; + + /** + * Query for a river's min km above a limit with all its q, main-v and tau values. + */ + private static final String SQL_SELECT_KMUPPER = + "SELECT fvmv.station AS station, fvmv.q AS q, fvmv.main_channel AS vmain, fvmv.shear_stress AS tau" + + " FROM flow_velocity_model_values fvmv" + + " INNER JOIN (SELECT MIN(fvmvi.station) AS kmmin" + + " FROM(discharge_zone dz INNER JOIN flow_velocity_model fvm ON dz.id = fvm.discharge_zone_id)" + + " INNER JOIN flow_velocity_model_values fvmvi ON fvm.id = fvmvi.flow_velocity_model_id" + + " WHERE (dz.river_id = :river_id) AND (fvmvi.station > :kmto + 0.0001)) fsup ON fvmv.station = fsup.kmmin" + + " ORDER BY fvmv.q ASC"; + + /** + * Query to select all km-q-v-tau of a river that are the q maxima below a q limit + */ + private static final String SQL_SELECT_QLOWER = + "SELECT fvmv.station AS station, fvmv.q AS q, fvmv.main_channel AS vmain, fvmv.shear_stress AS tau" + + " FROM flow_velocity_model_values fvmv" + + " INNER JOIN (SELECT fv2.station, MAX(fv2.q) AS q" + + " FROM (discharge_zone dz INNER JOIN flow_velocity_model fvm ON dz.id = fvm.discharge_zone_id)" + + " INNER JOIN flow_velocity_model_values fv2 ON fvm.id = fv2.flow_velocity_model_id" + + " WHERE (dz.river_id = :river_id) AND (fv2.q < :qlim) GROUP BY fv2.station) qx" + + " ON (fvmv.station=qx.station) AND (fvmv.q=qx.q)" + + " ORDER BY fvmv.station ASC"; + + /** + * Query to select all km-q-v-tau of a river that are the q minima above a q limit + */ + private static final String SQL_SELECT_QUPPER = + "SELECT fvmv.station AS station, fvmv.q AS q, fvmv.main_channel AS vmain, fvmv.shear_stress AS tau" + + " FROM flow_velocity_model_values fvmv" + + " INNER JOIN (SELECT fv2.station, MIN(fv2.q) AS q" + + " FROM (discharge_zone dz INNER JOIN flow_velocity_model fvm ON dz.id = fvm.discharge_zone_id)" + + " INNER JOIN flow_velocity_model_values fv2 ON fvm.id = fv2.flow_velocity_model_id" + + " WHERE (dz.river_id = :river_id) AND (fv2.q > :qlim) GROUP BY fv2.station) qx" + + " ON (fvmv.station=qx.station) AND (fvmv.q=qx.q)" + + " ORDER BY fvmv.station ASC"; + + /** + * Kms of the loaded river range + */ + private TDoubleArrayList kms; + + /** + * For each km in kms a list of q-v-tau-tupels + */ + private List values; + + /** + * Searched km of the last findKmValue + */ + private double findKm; + + /** + * kms and values index of the interval start found by the last findKmValue + */ + private int leftIndexFound = -1; + + /** + * kms and values index of the interval end found by the last findKmValue + */ + private int rightIndexFound = -1; + + /** + * Q of the last findKmQValues + */ + private double findQ; + + /***** METHODS *****/ + + /** + * Discharge of the last {@link findKmQValue} + */ + public double getFindQ() { + return findQ; + } + + /** + * Velocity of the last {@link findKmQValues} + */ + public double getFindVmainFound() { + if (leftIndexFound < 0) + return Double.NaN; + else if (leftIndexFound == rightIndexFound) + return getLeftValues().getVmainFound(); + else + return Linear.linear(findKm, getLeftValues().getKm(), getRightValues().getKm(), getLeftValues().getVmainFound(), getRightValues().getVmainFound()); + } + + /** + * Shear stress tau of the last {@link findKmQValues} + */ + public double getFindTauFound() { + if (leftIndexFound < 0) + return Double.NaN; + else if (leftIndexFound == rightIndexFound) + return getLeftValues().getTauFound(); + else + return Linear.linear(findKm, getLeftValues().getKm(), getRightValues().getKm(), getLeftValues().getTauFound(), getRightValues().getTauFound()); + } + + /** + * Whether the discharge has been interpolated in the last {@link findKmQValues} + */ + public boolean getFindIsQInterpolated() { + return (getLeftValues() != null) && (getLeftValues().getIsInterpolated() || getRightValues().getIsInterpolated()); + } + + /** + * Queries a range of a river's kms with all their q-v-tau values. + * @return Whether the load has been successful + */ + @SuppressWarnings("unchecked") + public boolean loadValues(River river, DoubleRange kmRange, DoubleRange qRange) { + // DB session + log.debug(String.format("loadValues km %.3f - %.3f / q %.1f - %.1f", kmRange.getMinimumDouble(), kmRange.getMaximumDouble(), qRange.getMinimumDouble(), qRange.getMaximumDouble())); + kms = new TDoubleArrayList(); + values = new ArrayList(); + boolean isDemoValuesCorrection = river.getName().equalsIgnoreCase("beispielfluss"); + final Session session = SessionHolder.HOLDER.get(); + + // Select km infimum + SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_KMLOWER) + .addScalar("station", StandardBasicTypes.DOUBLE) + .addScalar("q", StandardBasicTypes.DOUBLE) + .addScalar("vmain", StandardBasicTypes.DOUBLE) + .addScalar("tau", StandardBasicTypes.DOUBLE); + sqlQuery.setParameter("river_id", river.getId()); + sqlQuery.setParameter("kmfrom", kmRange.getMinimumDouble()); + addKms(sqlQuery.list(), isDemoValuesCorrection); + + // Select km range + sqlQuery = session.createSQLQuery(SQL_SELECT_ALL) + .addScalar("station", StandardBasicTypes.DOUBLE) + .addScalar("q", StandardBasicTypes.DOUBLE) + .addScalar("vmain", StandardBasicTypes.DOUBLE) + .addScalar("tau", StandardBasicTypes.DOUBLE); + sqlQuery.setParameter("river_id", river.getId()); + sqlQuery.setParameter("kmfrom", kmRange.getMinimumDouble()); + sqlQuery.setParameter("kmto", kmRange.getMaximumDouble()); + //sqlQuery.setParameter("qmin", qRange.getMinimumDouble()); + //sqlQuery.setParameter("qmax", qRange.getMaximumDouble()); + int kmcount = kms.size(); + int rowcount = addKms(sqlQuery.list(), isDemoValuesCorrection); + kmcount = kms.size() - kmcount; + + // Select km supremum + sqlQuery = session.createSQLQuery(SQL_SELECT_KMUPPER) + .addScalar("station", StandardBasicTypes.DOUBLE) + .addScalar("q", StandardBasicTypes.DOUBLE) + .addScalar("vmain", StandardBasicTypes.DOUBLE) + .addScalar("tau", StandardBasicTypes.DOUBLE); + sqlQuery.setParameter("river_id", river.getId()); + sqlQuery.setParameter("kmto", kmRange.getMaximumDouble()); + int supcnt = addKms(sqlQuery.list(), isDemoValuesCorrection); + + // Add copy of last km for search of max km value + if ((supcnt == 0) && (values.size() >= 1)) { + kms.add(kms.getQuick(kms.size()) + 0.0001); + values.add(new FlowVelocityKmModelValues(kms.getQuick(kms.size()-1), values.get(values.size()-1))); + } + + // log.debug + if (values.size() - 1 >= 0) { + log.debug(String.format("loadValues %d: km %.3f - %d values", 0, values.get(0).getKm(), values.get(0).size())); + if (values.size() - 1 >= 1) { + log.debug(String.format("loadValues %d: km %.3f - %d values", 1, values.get(1).getKm(), values.get(1).size())); + if (values.size() - 1 >= 2) + log.debug("loadValues ..."); + if (values.size() - 2 >= 3) + log.debug(String.format("loadValues %d: km %.3f - %d values", values.size()-2, values.get(values.size()-2).getKm(), values.get(values.size()-2).size())); + if (values.size() - 1 >= 3) + log.debug(String.format("loadValues %d: km %.3f - %d values", values.size()-1, values.get(values.size()-1).getKm(), values.get(values.size()-1).size())); + } + } + log.debug(String.format("loadValues %d kms, %d values loaded", kmcount, rowcount)); + return (kms.size() >= 1); + } + + /** + * Adds the km-q-v-tau values of a query result row to the last km of the list, or a new one resp. + * @return Number of rows + */ + private int addKms(List rows, boolean isDemoValuesCorrection) { + for (Object[] row : rows) { + if ((kms.size() == 0) || !Utils.epsilonEquals(kms.get(kms.size()-1), (double) row[0], 0.0001)) { + kms.add((double) row[0]); + values.add(new FlowVelocityKmModelValues(kms.get(kms.size()-1))); + } + if (isDemoValuesCorrection) + // "Verfremdung" der v-Werte etwas korrigieren (Originalwerte wurden mit Zufallswert zwischen 10 und 20 multipliziert) + values.get(values.size()-1).addValues((double) row[1], ((double) row[2]) / 10, (double) row[3]); + else + values.get(values.size()-1).addValues((double) row[1], (double) row[2], (double) row[3]); + } + return rows.size(); + } + + /** + * Searches a km and finds or interpolates the velocity and shear stress values for a discharge
+ * The values may be got via {@link getVmainFound} etc. + * @return Whether values have been found + */ + public boolean findKmQValues(double km, double q) { + findQ = q; + if (!searchKm(km)) + return false; + if (leftIndexFound == rightIndexFound) { + // Exact km match + final double qfound = getLeftValues().findQ(q); + log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d)", km, q, qfound, leftIndexFound)); + return !Double.isNaN(qfound); + } + else { + final double[] qfound = {getLeftValues().findQ(q), getRightValues().findQ(q)}; + log.debug(String.format("findKmQValues km %.3f q %.0f = %.0f (%d, %.3f) - %.0f (%d, %.3f)", km, q, qfound[0], leftIndexFound, + getLeftValues().getKm(), qfound[1], rightIndexFound, getRightValues().getKm())); + return !Double.isNaN(qfound[0]) && !Double.isNaN(qfound[1]); + } + } + + /** + * Searches a km + * @return Whether the km was within the supported range + */ + private boolean searchKm(double km) { + findKm = km; + leftIndexFound = -1; + rightIndexFound = -1; + if ((kms == null) || (kms.size() == 0)) + return false; + int i = kms.binarySearch(km); + if (i >= 0) { + // Exact km match + leftIndexFound = i; + rightIndexFound = i; + return true; + } + else { + // Out of range or within km interval + if (i < 0) + i = -i - 1; + if ((i <= 0) || (i >= kms.size())) + return false; + leftIndexFound = i - 1; + rightIndexFound = i; + return true; + } + } + + private FlowVelocityKmModelValues getLeftValues() { + return values.get(leftIndexFound); + } + private FlowVelocityKmModelValues getRightValues() { + return values.get(rightIndexFound); + } + +} diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/SoilKindKmValueFinder.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flowdepth/SoilKindKmValueFinder.java Thu Feb 22 12:03:31 2018 +0100 @@ -0,0 +1,106 @@ +/* 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.sinfo.flowdepth; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.math.DoubleRange; +import org.apache.commons.math.ArgumentOutsideDomainException; +import org.apache.log4j.Logger; +import org.dive4elements.river.model.River; + +import gnu.trove.TDoubleArrayList; + +/** + * @author matthias + * + */ +public class SoilKindKmValueFinder +{ + /** + * Private log to use here. + */ + private static Logger log = Logger.getLogger(SoilKindKmValueFinder.class); + + private TDoubleArrayList kms; + + private List values; + + /***** METHODS *****/ + + /** + * Searches a km with its soil kind + */ + public SoilKind findSoilKind(double km) throws ArgumentOutsideDomainException { + if ((kms == null) || (kms.size() == 0)) + throw new ArgumentOutsideDomainException(km, Double.NaN, Double.NaN); + int i = kms.binarySearch(km); + if (i >= 0) { + // Exact km match + return values.get(i); + } + else { + // Out of range or within km interval + if (i < 0) + i = -i - 1; + if ((i <= 0) || (i >= kms.size())) + throw new ArgumentOutsideDomainException(km, Double.NaN, Double.NaN); + if (km <= ((kms.get(i-1) + kms.get(i)) / 2)) + return values.get(i-1); + else + return values.get(i); + } + } + + /** + * Loads the range of the river's kms with their soil kind. + * @return Whether the load has been successful + */ + public boolean loadValues(River river, DoubleRange kmRange) { + kms = new TDoubleArrayList(); + values = new ArrayList(); + //FIXME Echte Daten aus der Datenbank abfragen + addKmKind(0, SoilKind.starr); + addKmKind(15.7, SoilKind.mobil); + addKmKind(15.8, SoilKind.mobil); + addKmKind(15.9, SoilKind.starr); + addKmKind(108.7, SoilKind.mobil); + addKmKind(108.8, SoilKind.mobil); + addKmKind(108.9, SoilKind.starr); + addKmKind(119.1, SoilKind.mobil); + addKmKind(119.4, SoilKind.mobil); + addKmKind(119.5, SoilKind.starr); + addKmKind(128.3, SoilKind.mobil); + addKmKind(128.9, SoilKind.mobil); + addKmKind(129, SoilKind.starr); + addKmKind(133.1, SoilKind.mobil); + addKmKind(135.9, SoilKind.mobil); + addKmKind(136, SoilKind.starr); + addKmKind(136.5, SoilKind.mobil); + addKmKind(139.9, SoilKind.mobil); + addKmKind(140, SoilKind.starr); + addKmKind(140.5, SoilKind.mobil); + addKmKind(165, SoilKind.mobil); + addKmKind(165.1, SoilKind.starr); + addKmKind(165.9, SoilKind.mobil); + addKmKind(180.8, SoilKind.mobil); + addKmKind(180.9, SoilKind.starr); + addKmKind(182, SoilKind.mobil); + addKmKind(221.3, SoilKind.mobil); + return true; + } + + private void addKmKind(double km, SoilKind kind) { + kms.add(km); + values.add(kind); + } +} diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/resources/messages.properties --- a/artifacts/src/main/resources/messages.properties Wed Feb 14 19:06:21 2018 +0100 +++ b/artifacts/src/main/resources/messages.properties Thu Feb 22 12:03:31 2018 +0100 @@ -773,6 +773,8 @@ sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.missingSoilKind = {0}: no soil kind available +sinfo_calc_flow_depth.warning.missingD50 = {0}: no d50 available sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe diff -r f431aec10d2c -r 89f3c5462a16 artifacts/src/main/resources/messages_de.properties --- a/artifacts/src/main/resources/messages_de.properties Wed Feb 14 19:06:21 2018 +0100 +++ b/artifacts/src/main/resources/messages_de.properties Thu Feb 22 12:03:31 2018 +0100 @@ -779,6 +779,8 @@ sinfo_calc_flow_depth.warning.missingQ = {0}: keine Abflussdaten vorhanden, Transportk\u00f6rperh\u00f6henberechnung nicht m\u00f6glich sinfo_calc_flow_depth.warning.waterlevel_discretisation = Wasserspiegel {0}: r\u00e4umliche Aufl\u00f6sung betr\u00e4gt mehr als 1000m sinfo_calc_flow_depth.warning.year_difference = {0}: Zeitliche Abweichung betr\u00e4gt {1} Jahre. Dies kann zu unplausiblen Ergebnissen f\u00fchren +sinfo_calc_flow_depth.warning.missingSoilKind = {0}: keine Sohlart vorhanden +sinfo_calc_flow_depth.warning.missingD50 = {0}: kein D50 vorhanden sinfo_calc_flow_depth_development=Flie\u00dftiefenentwicklung sinfo_calc_flow_depth_minmax=Minimale und Maximale Flie\u00dftiefe diff -r f431aec10d2c -r 89f3c5462a16 gwt-client/pom.xml --- a/gwt-client/pom.xml Wed Feb 14 19:06:21 2018 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,265 +0,0 @@ - - - - - 4.0.0 - org.dive4elements.river - gwt-client - war - 1.0-SNAPSHOT - org.dive4elements.river.client - - - UTF-8 - - 2.4.0 - - 1.6 - 1.6 - - - - - com.google.gwt - gwt-servlet - ${gwtVersion} - runtime - - - com.google.gwt - gwt-user - ${gwtVersion} - provided - - - - - com.isomorphic.smartgwt.lgpl - smartgwt-lgpl - 4.1-p20141119 - - - org.dive4elements - artifacts-common - 1.0-SNAPSHOT - - - org.dive4elements - http-client - 1.0-SNAPSHOT - - - net.sf.opencsv - opencsv - 2.0 - - - junit - junit - 4.4 - test - - - commons-lang - commons-lang - 2.6 - - - commons-fileupload - commons-fileupload - 1.2.1 - - - org.gwtopenmaps.openlayers - gwt-openlayers-client - 0.6 - - - commons-httpclient - commons-httpclient - 3.1 - - - org.apache.httpcomponents - httpclient - 4.2 - - - log4j - log4j - 1.2.14 - - - org.mapfish.print - print-lib - 1.2.0 - - - org.jdom - jdom - 1.1.3 - - - commons-io - commons-io - 2.2 - - - commons-codec - commons-codec - 1.4 - - - - - - target/www/WEB-INF/classes - - - - - - org.codehaus.mojo - gwt-maven-plugin - ${gwtVersion} - - - com.google.gwt - gwt-user - ${gwtVersion} - - - com.google.gwt - gwt-dev - ${gwtVersion} - - - - - - prepare-package - - compile - - - - - - - FLYS.html - - target/www - - true - - - - - - maven-surefire-plugin - - - ${project.build.sourceDirectory} - ${project.build.testSourceDirectory} - - false - always - - - - - gwt.args - -out target/www - - - - - - - - maven-resources-plugin - - - compile - - copy-resources - - - target/www - - - src/main/webapp - - - - - - - - - - maven-clean-plugin - - - src/main/webapp/flys - src/main/webapp/WEB-INF/classes - tomcat - www-test - .gwt-tmp - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.0.0 - - ../checkstyle.xml - UTF-8 - - - - validate - validate - - true - true - - - check - - - - - - - - - - com.smartgwt - SmartGWT - http://www.smartclient.com/maven2 - - - osgeo - Open Source Geospatial Foundation Repository - http://download.osgeo.org/webdav/geotools/ - - - diff -r f431aec10d2c -r 89f3c5462a16 gwt-client/src/main/webapp/WEB-INF/web.xml --- a/gwt-client/src/main/webapp/WEB-INF/web.xml Wed Feb 14 19:06:21 2018 +0100 +++ b/gwt-client/src/main/webapp/WEB-INF/web.xml Thu Feb 22 12:03:31 2018 +0100 @@ -69,6 +69,30 @@ /WEB-INF/log4j.properties + + GGInAFilter + org.dive4elements.river.client.server.filter.GGInAFilter + + deactivate + false + + + + + NoCacheFilter + org.dive4elements.river.client.server.filter.NoCacheFilter + + + + GGInAFilter + /* + + + + NoCacheFilter + /* + + org.dive4elements.river.client.server.BaseServletContextListener @@ -80,264 +104,132 @@ org.dive4elements.river.client.server.UserServiceImpl - - user - /flys/user - - - - server-info org.dive4elements.river.client.server.ServerInfoServiceImpl - - server-info - /flys/server-info - - artifact org.dive4elements.river.client.server.ArtifactServiceImpl - - artifact - /flys/artifact - - getartifact org.dive4elements.river.client.server.GetArtifactServiceImpl - - getartifact - /flys/getartifact - - cross-section-km org.dive4elements.river.client.server.CrossSectionKMServiceImpl - - cross-section-km - /flys/cross-section-km - - create-collection org.dive4elements.river.client.server.CreateCollectionServiceImpl - - create-collection - /flys/create-collection - - rivers org.dive4elements.river.client.server.RiverServiceImpl - - rivers - /flys/rivers - - riverinfo org.dive4elements.river.client.server.RiverInfoServiceImpl - - riverinfo - /flys/riverinfo - - forward org.dive4elements.river.client.server.StepForwardServiceImpl - - forward - /flys/forward - - - - feed - org.dive4elements.river.client.server.FeedServiceImpl - - - - feed - /flys/feed - - fixings-overview org.dive4elements.river.client.server.FixingsOverviewServiceImpl - - fixings-overview - /flys/fixings-overview - - advance org.dive4elements.river.client.server.AdvanceServiceImpl - - advance - /flys/advance - - add-artifact org.dive4elements.river.client.server.AddArtifactServiceImpl - - add-artifact - /flys/add-artifact - - load-artifact org.dive4elements.river.client.server.LoadArtifactServiceImpl - - load-artifact - /flys/load-artifact - - describe-collection org.dive4elements.river.client.server.DescribeCollectionServiceImpl - - describe-collection - /flys/describe-collection - - - + user-collections org.dive4elements.river.client.server.UserCollectionsServiceImpl - - user-collections - /flys/user-collections - + + feed + org.dive4elements.river.client.server.FeedServiceImpl + distanceinfo org.dive4elements.river.client.server.DistanceInfoServiceImpl - - distanceinfo - /flys/distanceinfo - - dischargeinfo org.dive4elements.river.client.server.DischargeInfoServiceImpl - - dischargeinfo - /flys/dischargeinfo - - DischargeInfoXML org.dive4elements.river.client.server.DischargeInfoXML - - DischargeInfoXML - /flys/dischargeinfoxml - - meta-data org.dive4elements.river.client.server.MetaDataServiceImpl - - meta-data - /flys/meta-data - - mainvalues org.dive4elements.river.client.server.WQInfoServiceImpl - - mainvalues - /flys/mainvalues - - gaugeinfo org.dive4elements.river.client.server.GaugeInfoServiceImpl - - gaugeinfo - /flys/gaugeinfo - - csv org.dive4elements.river.client.server.CSVExportServiceImpl - - csv - /flys/csv - - ChartOutputService org.dive4elements.river.client.server.ChartOutputServiceImpl - - ChartOutputService - /flys/chart - - DischargeTablesOverviewService org.dive4elements.river.client.server.DischargeTablesServiceImpl - - DischargeTablesOverviewService - /flys/dischargetablesoverview - - MapOutputService org.dive4elements.river.client.server.MapOutputServiceImpl - - MapOutputService - /flys/map - - mapfish.print org.mapfish.print.servlet.MapPrinterServlet @@ -347,11 +239,6 @@ - - mapfish.print - /flys/mapfish-print/* - - MapPrintService @@ -366,286 +253,397 @@ - - MapPrintService - /flys/map-print - - - FixingsKMChartService org.dive4elements.river.client.server.FixingsKMChartServiceImpl - - FixingsKMChartService - /flys/fixings-km-chart - - DistanceInfoXML org.dive4elements.river.client.server.DistanceInfoXML - - DistanceInfoXML - /flys/distanceinfoxml - - ExportService org.dive4elements.river.client.server.ExportServiceImpl - - ExportService - /flys/export - - CollectionAttributeService org.dive4elements.river.client.server.CollectionAttributeServiceImpl - - CollectionAttributeService - /flys/collection-attribute - - CollectionItemAttributeService org.dive4elements.river.client.server.CollectionItemAttributeServiceImpl - - CollectionItemAttributeService - /flys/collection-item-attribute - - ChartInfoService org.dive4elements.river.client.server.ChartInfoServiceImpl - - ChartInfoService - /flys/chart-info - - ReportService org.dive4elements.river.client.server.ReportServiceImpl - - ReportService - /flys/report - - SetCollectionNameService org.dive4elements.river.client.server.SetCollectionNameServiceImpl - - SetCollectionNameService - /flys/set-collectionname - - SetCollectionTTLService org.dive4elements.river.client.server.SetCollectionTTLServiceImpl - - SetCollectionTTLService - /flys/set-collectionttl - - DeleteCollectionService org.dive4elements.river.client.server.DeleteCollectionServiceImpl - - DeleteCollectionService - /flys/delete-collection - - MapInfoService org.dive4elements.river.client.server.MapInfoServiceImpl - - MapInfoService - /flys/map-info - - getfeatureinfo org.dive4elements.river.client.server.GFIServiceImpl - - getfeatureinfo - /flys/getfeatureinfo - - getcapabilities org.dive4elements.river.client.server.GCServiceImpl - - getcapabilities - /flys/getcapabilities - - DescribeArtifactService org.dive4elements.river.client.server.DescribeArtifactServiceImpl - - DescribeArtifactService - /flys/describe - - remove-artifact org.dive4elements.river.client.server.RemoveArtifactServiceImpl - - remove-artifact - /flys/remove-artifact - - GetWMSUrls org.dive4elements.river.client.server.MapUrlServiceImpl - - GetWMSUrls - /flys/map-urls - - FileUpload org.dive4elements.river.client.server.FileUploadServiceImpl - - FileUpload - /flys/fileupload - - themelisting org.dive4elements.river.client.server.ThemeListingServiceImpl - - themelisting - /flys/themelisting - - SQKMChart org.dive4elements.river.client.server.SQKMChartServiceImpl - - SQKMChart - /flys/sq-km-chart - - BedKMChart org.dive4elements.river.client.server.BedKMChartServiceImpl - - BedKMChart - /flys/bed-km-chart - - BedloadKMChart org.dive4elements.river.client.server.BedloadKMChartServiceImpl - - BedloadKMChart - /flys/bedload-km-chart - - SedimentLoadInfo org.dive4elements.river.client.server.SedimentLoadInfoServiceImpl - - SedimentLoadInfo - /flys/sedimentloadinfo - - login org.dive4elements.river.client.server.LoginServlet - - login - /flys/login - - saml org.dive4elements.river.client.server.SamlServlet - - saml - /flys/saml - - modules org.dive4elements.river.client.server.ModuleServiceImpl + user + /flys/user + + + + server-info + /flys/server-info + + + + artifact + /flys/artifact + + + + getartifact + /flys/getartifact + + + + cross-section-km + /flys/cross-section-km + + + + create-collection + /flys/create-collection + + + + rivers + /flys/rivers + + + + riverinfo + /flys/riverinfo + + + + forward + /flys/forward + + + + feed + /flys/feed + + + + fixings-overview + /flys/fixings-overview + + + + advance + /flys/advance + + + + add-artifact + /flys/add-artifact + + + + load-artifact + /flys/load-artifact + + + + describe-collection + /flys/describe-collection + + + + user-collections + /flys/user-collections + + + + distanceinfo + /flys/distanceinfo + + + + dischargeinfo + /flys/dischargeinfo + + + + DischargeInfoXML + /flys/dischargeinfoxml + + + + meta-data + /flys/meta-data + + + + mainvalues + /flys/mainvalues + + + + gaugeinfo + /flys/gaugeinfo + + + + csv + /flys/csv + + + + ChartOutputService + /flys/chart + + + + DischargeTablesOverviewService + /flys/dischargetablesoverview + + + + MapOutputService + /flys/map + + + + mapfish.print + /flys/mapfish-print/* + + + + MapPrintService + /flys/map-print + + + + + FixingsKMChartService + /flys/fixings-km-chart + + + + DistanceInfoXML + /flys/distanceinfoxml + + + + ExportService + /flys/export + + + + CollectionAttributeService + /flys/collection-attribute + + + + CollectionItemAttributeService + /flys/collection-item-attribute + + + + ChartInfoService + /flys/chart-info + + + + ReportService + /flys/report + + + + SetCollectionNameService + /flys/set-collectionname + + + + SetCollectionTTLService + /flys/set-collectionttl + + + + DeleteCollectionService + /flys/delete-collection + + + + MapInfoService + /flys/map-info + + + + getfeatureinfo + /flys/getfeatureinfo + + + + getcapabilities + /flys/getcapabilities + + + + DescribeArtifactService + /flys/describe + + + + remove-artifact + /flys/remove-artifact + + + + GetWMSUrls + /flys/map-urls + + + + FileUpload + /flys/fileupload + + + + themelisting + /flys/themelisting + + + + SQKMChart + /flys/sq-km-chart + + + + BedKMChart + /flys/bed-km-chart + + + + BedloadKMChart + /flys/bedload-km-chart + + + + SedimentLoadInfo + /flys/sedimentloadinfo + + + + login + /flys/login + + + + saml + /flys/saml + + + modules /flys/modules - - GGInAFilter - org.dive4elements.river.client.server.filter.GGInAFilter - - deactivate - false - - - - - GGInAFilter - /* - - - - NoCacheFilter - org.dive4elements.river.client.server.filter.NoCacheFilter - - - - NoCacheFilter - /* - -