[Dive4elements-commits] [PATCH] merged changes from default into double-precision branch
Wald Commits
scm-commit at wald.intevation.org
Wed Jun 26 16:40:28 CEST 2013
# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1372257625 -7200
# Branch double-precision
# Node ID 28c390debd9b89143d41cc64dcfb8b4d9b43a7ec
# Parent 9787773e7bee81d29220415842f842f0a4050964
# Parent f3078357ec65ada2af3a71fd70c260d31c3e5ce0
merged changes from default into double-precision branch
diff -r 9787773e7bee -r 28c390debd9b artifacts/doc/conf/artifacts/fixanalysis.xml
--- a/artifacts/doc/conf/artifacts/fixanalysis.xml Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/doc/conf/artifacts/fixanalysis.xml Wed Jun 26 16:40:25 2013 +0200
@@ -204,6 +204,8 @@
<facet name="fix_analysis_events_ls" description="Average values for Ws in Q sectors."/>
<facet name="fix_reference_events_ls" description="Average values for Ws in Q sectors."/>
<facet name="fix_longitudinal_section_curve.manualpoints" description="Manual points"/>
+ <facet name="other.wqkms.q" description="W-Type of data" />
+ <facet name="other.wqkms.w" description="W-Type of data" />
</facets>
</outputmode>
<outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart">
@@ -268,6 +270,8 @@
<facet name="w_differences" description="facet.w_differences"/>
<facet name="other.wkms" description="facet.other.wkms"/>
<facet name="other.wqkms" description="facet.other.wqkms"/>
+ <facet name="other.wqkms.q" description="W-Type of data" />
+ <facet name="other.wqkms.w" description="W-Type of data" />
<facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/>
<facet name="w_differences.manualpoints" description="Manuelle Punkte"/>
<facet name="longitudinal_section.manualpoints" description="Manuelle Punkte"/>
diff -r 9787773e7bee -r 28c390debd9b artifacts/doc/conf/artifacts/winfo.xml
--- a/artifacts/doc/conf/artifacts/winfo.xml Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/doc/conf/artifacts/winfo.xml Wed Jun 26 16:40:25 2013 +0200
@@ -266,6 +266,8 @@
<facet name="w_differences" description="facet.w_differences"/>
<facet name="other.wkms" description="facet.other.wkms"/>
<facet name="other.wqkms" description="facet.other.wqkms"/>
+ <facet name="other.wqkms.w" description="W-Type of data" />
+ <facet name="other.wqkms.q" description="Q-Type of data" />
<facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/>
<facet name="w_differences.manualpoints" description="Manuelle Punkte"/>
<facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
diff -r 9787773e7bee -r 28c390debd9b artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml Wed Jun 26 16:40:25 2013 +0200
@@ -164,7 +164,7 @@
<dc:call-macro name="discharge_fix_wq"/>
</dc:when>
<dc:when test="$out = 'fix_longitudinal_section_curve'">
- <dc:call-macro name="annotations"/>
+ <dc:call-macro name="longitudinal-section-prototype"/>
</dc:when>
<dc:when test="$out = 'map'">
<dc:call-macro name="flood-map-complete"/>
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation.java Wed Jun 26 16:40:25 2013 +0200
@@ -78,6 +78,21 @@
}
@Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("problem: ");
+ if (km != null) {
+ sb.append("km: ").append(km).append(' ');
+ }
+ sb.append(msg);
+ if (args != null) {
+ for (Object arg: args) {
+ sb.append(' ').append(arg);
+ }
+ }
+ return sb.toString();
+ }
+
+ @Override
public boolean equals(Object other) {
if (!(other instanceof Problem)) {
return false;
@@ -159,6 +174,18 @@
return problems;
}
+ public String problemsToString() {
+ StringBuilder sb = new StringBuilder("[");
+ for (int i = 0, N = problems.size(); i < N; ++i) {
+ if (i > 0) {
+ sb.append(", ");
+ }
+ sb.append(problems.get(i));
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
public void toXML(Document document, CallMeta meta) {
Element root = document.createElement("problems");
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation2.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation2.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/Calculation2.java Wed Jun 26 16:40:25 2013 +0200
@@ -8,6 +8,9 @@
package org.dive4elements.river.artifacts.model;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
import java.util.Arrays;
import org.apache.log4j.Logger;
@@ -28,12 +31,57 @@
this.km = km;
}
+ private void dump(double [][] wqs) {
+ double [] ws = wqs[0];
+ double [] qs = wqs[1];
+
+ String filename = "/tmp/computed-discharge-curve-" + km + "-" +
+ System.currentTimeMillis() + ".txt";
+
+ PrintWriter pw = null;
+ try {
+ pw =
+ new PrintWriter(
+ new FileWriter(filename));
+
+ for (int i = 0; i < ws.length; ++i) {
+ pw.println(ws[i] + " " + qs[i]);
+ }
+
+ pw.flush();
+ }
+ catch (IOException ioe) {
+ logger.error(ioe);
+ }
+ finally {
+ if (pw != null) {
+ pw.close();
+ }
+ }
+ }
+
public CalculationResult calculate(WstValueTable wst) {
- logger.debug("Calculation2.calculate");
+ boolean debug = logger.isDebugEnabled();
+
+ if (debug) {
+ logger.debug("Calculation2.calculate: km " + km);
+ }
double [][] wqs = wst.interpolateWQ(km, this);
+ if (debug) {
+ if (hasProblems()) {
+ logger.debug("problems: " + problemsToString());
+ }
+ logger.debug("wqs: " + wqs);
+ if (wqs != null && wqs[0] != null) {
+ logger.debug("wqs length: " + wqs[0].length);
+ // TODO: Uncomment to see the data externally.
+ //dump(wqs);
+ }
+ }
+
if (wqs == null || wqs[0].length == 0) {
addProblem("cannot.compute.discharge.curve");
return new CalculationResult(new WQKms[0], this);
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WstValueTable.java Wed Jun 26 16:40:25 2013 +0200
@@ -12,6 +12,7 @@
import org.dive4elements.river.artifacts.math.Linear;
import org.dive4elements.river.artifacts.math.Function;
+import org.dive4elements.river.utils.DoubleUtil;
import java.util.Arrays;
import java.util.ArrayList;
@@ -327,6 +328,8 @@
splineQs[i] = wqs;
}
+ DoubleUtil.sortByFirst(splineQs, splineWs);
+
SplineInterpolator interpolator = new SplineInterpolator();
try {
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -717,6 +717,15 @@
}
+ /**
+ * Gets the master artifact.
+ * @return the master artifact.
+ */
+ public Artifact getMaster() {
+ return master;
+ }
+
+
/** Sets the collection. */
@Override
public void setCollection(D4EArtifactCollection collection) {
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -20,13 +20,21 @@
import org.dive4elements.river.jfree.StickyAxisAnnotation;
import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.model.Gauge;
import org.dive4elements.river.utils.RiverUtils;
+import org.dive4elements.artifacts.Artifact;
+
+import java.awt.Font;
+
import java.util.ArrayList;
import java.util.List;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.data.xy.XYSeries;
+
import org.apache.log4j.Logger;
-import org.jfree.data.xy.XYSeries;
+
import org.w3c.dom.Document;
@@ -57,6 +65,7 @@
public static final String I18N_MAINVALUES_Q_LABEL = "Q (Haupt- und Extremwerte)";
public static final String I18N_MAINVALUES_W_LABEL = "W (Haupt- und Extremwerte)";
+ protected NumberAxis firstYAxis;
/** Trivial Constructor. */
public ComputedDischargeCurveGenerator () {
@@ -83,6 +92,20 @@
}
+ /**
+ * Returns the PNP (Datum) of gauge, if at gauge, 0 otherwise.
+ */
+ protected int getCurrentGaugeDatum() {
+ // Code borrowed from FixATWriter.
+ Gauge gauge = RiverUtils.getGauge((D4EArtifact) getMaster());
+ int subtractPNP = 0;
+ if (Math.abs(getRange()[0] - gauge.getStation().doubleValue()) < 1e-4) {
+ subtractPNP = (int) Math.round(gauge.getDatum().doubleValue() /** 100*/);
+ }
+ return subtractPNP;
+ }
+
+
@Override
protected String getDefaultYAxisLabel(int pos) {
D4EArtifact flys = (D4EArtifact) master;
@@ -94,6 +117,36 @@
/**
+ * Create Y (range) axis for given index.
+ * Shall be overriden by subclasses.
+ */
+ protected NumberAxis createYAxis(int index) {
+ if (index == 0) {
+ firstYAxis = super.createYAxis(0);
+ return firstYAxis;
+ }
+ YAxisWalker walker = getYAxisWalker();
+
+ Font labelFont = new Font(
+ DEFAULT_FONT_NAME,
+ Font.BOLD,
+ getYAxisFontSize(index));
+
+ SyncNumberAxis axis = new SyncNumberAxis(
+ walker.getId(index),
+ getYAxisLabel(index),
+ firstYAxis);
+
+ axis.setAutoRangeIncludesZero(false);
+ axis.setLabelFont(labelFont);
+ axis.setTickLabelFont(labelFont);
+ axis.setShift((double)-getCurrentGaugeDatum());
+
+ return axis;
+ }
+
+
+ /**
* Process data, build up plot.
*/
@Override
@@ -114,7 +167,7 @@
//XXX DEAD CODE // Facet facet = artifactFacet.getFacet();
if (name.equals(COMPUTED_DISCHARGE_Q)) {
- doQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
+ doDischargeQOut((WQKms) artifactFacet.getData(context), artifactFacet, attr, visible);
}
else if (name.equals(STATIC_WQ)) {
doWQOut(artifactFacet.getData(context), artifactFacet, attr, visible);
@@ -189,6 +242,38 @@
/**
+ * Add discharge Q-Series to plot, scale if at gauge.
+ * @param wqkms actual data
+ * @param theme theme to use.
+ */
+ protected void doDischargeQOut(
+ WQKms wqkms,
+ ArtifactAndFacet aaf,
+ Document theme,
+ boolean visible
+ ) {
+ logger.debug("ComputedDischargeCurveGenerator: doDischargeQOut");
+ XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+
+ int subtractPNP = getCurrentGaugeDatum();
+
+ if (subtractPNP == 0) {
+ StyledSeriesBuilder.addPointsQW(series, wqkms);
+ addAxisSeries(series, YAXIS.W.idx, visible);
+ }
+ else {
+ XYSeries series2 = new StyledXYSeries(aaf.getFacetDescription(), theme);
+ StyledSeriesBuilder.addPointsQW(series2, wqkms);
+ addAxisSeries(series2, YAXIS.W.idx, false);
+
+ // Use second axis...
+ StyledSeriesBuilder.addPointsQW(series, wqkms, -subtractPNP, 100d);
+ addAxisSeries(series, YAXIS.WCm.idx, visible);
+ }
+ }
+
+
+ /**
* Add Q-Series to plot.
* @param wqkms actual data
* @param theme theme to use.
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -37,7 +37,8 @@
implements FacetTypes {
public static enum YAXIS {
- W(0);
+ W(0),
+ WCm(1);
protected int idx;
private YAXIS(int c) {
idx = c;
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -85,6 +85,13 @@
artifactFacet,
attr, visible, YAXIS.W.idx);
}
+ else if (name.equals(STATIC_WQKMS_Q)) {
+ doQOut(
+ (WQKms) artifactFacet.getData(context),
+ artifactFacet,
+ attr,
+ visible);
+ }
else {
Processor processor = new WOutProcessor();
if (processor.canHandle(name)) {
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/IdentifiableNumberAxis.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/IdentifiableNumberAxis.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/IdentifiableNumberAxis.java Wed Jun 26 16:40:25 2013 +0200
@@ -10,7 +10,7 @@
import org.jfree.chart.axis.NumberAxis;
-
+/** Axis of which label and key differs. */
public class IdentifiableNumberAxis extends NumberAxis {
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -219,6 +219,13 @@
visible,
YAXIS.H.idx);
}
+ else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+ doAnnotations(
+ (RiverAnnotation) artifactAndFacet.getData(context),
+ artifactAndFacet,
+ attr,
+ visible);
+ }
else if (bedp.canHandle(name)) {
bedp.doOut(this, artifactAndFacet, attr, visible, YAXIS.P.idx);
}
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/StyledSeriesBuilder.java Wed Jun 26 16:40:25 2013 +0200
@@ -214,6 +214,26 @@
}
}
+ /**
+ * Add points to series (q to 1st dim, w to 2nd dim), adding wTrans to the
+ * W values and scaling it with wScale.
+ *
+ * @param series Series to add points to.
+ * @param wqkms WQKms to add to series.
+ * @param wAdd Value to add to each Q while adding to series.
+ * @param wScale multiply with
+ */
+ public static void addPointsQW(XYSeries series, WQKms wqkms, double wTrans, double wScale) {
+ if (wqkms == null) {
+ return;
+ }
+
+ int size = wqkms.size();
+
+ for (int i = 0; i < size; i++) {
+ series.add(wqkms.getQ(i), wScale * (wqkms.getW(i) + wTrans), false);
+ }
+ }
/**
* Add points to series (q to 1st dim, w to 2nd dim).
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/SyncNumberAxis.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/SyncNumberAxis.java Wed Jun 26 16:40:25 2013 +0200
@@ -0,0 +1,131 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * 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.exports;
+
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.event.AxisChangeEvent;
+import org.jfree.chart.event.AxisChangeListener;
+import org.jfree.data.Range;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Axis which is to be registered with other axis and tries
+ * to clone its range. The cloned range is transformed.
+ */
+public class SyncNumberAxis extends IdentifiableNumberAxis
+ implements AxisChangeListener
+{
+ /** The logger used in this generator. */
+ private static Logger logger =
+ Logger.getLogger(SyncNumberAxis.class);
+
+ /** The other axis to clone range from. */
+ protected NumberAxis proxyAxis;
+
+ /** Value to translate range by. */
+ protected double shift;
+
+
+ protected SyncNumberAxis(String key, String label, NumberAxis n) {
+ super(key, label);
+ this.proxyAxis = n;
+ }
+
+
+ /** Range of other axis changed, adjust own range. */
+ @Override
+ public void axisChanged(AxisChangeEvent event) {
+ logger.debug("SyncNumberAxis: axischange event");
+ this.setRange(
+ transRange(((NumberAxis)event.getAxis()).getRange()));
+ }
+
+ /** Set value by which to translate the range. */
+ protected void setShift(double shift) {
+ this.shift = shift;
+ }
+
+
+ /** Set other axis to relate to, register listener. */
+ public void setProxyAxis(NumberAxis ax) {
+ proxyAxis = ax;
+ proxyAxis.addChangeListener(this);
+ }
+
+ /** Translate range by shift, scale by 100. */
+ protected Range transRange(Range r) {
+ return new Range(100d*(r.getLowerBound()+shift),
+ 100d*(r.getUpperBound()+shift));
+ }
+
+ /** Set Range. */
+ @Override
+ public void setRange(Range r) {
+ super.setRange(r);
+ logger.debug("SyncAxis: setRange");
+ }
+
+
+ /*
+ @Override
+ public Range getRange() {
+ Range r = new Range(100d*(proxyAxis.getRange().getLowerBound()+shift),
+ 100d*(proxyAxis.getRange().getUpperBound()+shift));
+ return r;
+ }
+
+ @Override
+ public void setLowerBound(double max) {
+ }
+
+ @Override
+ public void setLowerMargin(double margin) {
+ }
+
+ @Override
+ public void setUpperBound(double max) {
+ }
+
+ @Override
+ public void setUpperMargin(double margin) {
+ }
+
+ @Override
+ public void setRange(double a, double b) {
+ }
+
+ @Override
+ public void setRange(Range range, boolean turnOffAutoRange, boolean notify){
+ }
+
+ @Override
+ public void setRangeAboutValue(double value, double length) {}
+
+ @Override
+ public void setRangeWithMargins(double lower, double upper) {}
+
+ @Override
+ public void setRangeWithMargins(Range range) {}
+
+ @Override
+ public void pan(double percent) {}
+
+ @Override
+ public void resizeRange(double p){}
+
+ @Override
+ public void resizeRange(double p, double a){}
+
+ @Override
+ public void resizeRange2(double p, double a){}
+
+ */
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -12,23 +12,29 @@
import java.awt.Color;
import org.apache.log4j.Logger;
+import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.FacetTypes;
+import org.dive4elements.river.artifacts.model.WKms;
+import org.dive4elements.river.artifacts.model.WQKms;
+import org.dive4elements.river.artifacts.model.fixings.AnalysisPeriod;
+import org.dive4elements.river.artifacts.model.fixings.QWD;
+import org.dive4elements.river.exports.ChartGenerator;
+import org.dive4elements.river.exports.StyledSeriesBuilder;
+import org.dive4elements.river.exports.process.KMIndexProcessor;
+import org.dive4elements.river.exports.process.Processor;
+import org.dive4elements.river.exports.process.WOutProcessor;
+import org.dive4elements.river.jfree.RiverAnnotation;
+import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
+import org.dive4elements.river.jfree.StyledXYSeries;
+import org.dive4elements.river.utils.DataUtil;
+import org.dive4elements.river.utils.KMIndex;
+import org.dive4elements.river.utils.RiverUtils;
import org.jfree.chart.plot.Marker;
import org.jfree.chart.plot.ValueMarker;
import org.jfree.data.xy.XYSeries;
import org.w3c.dom.Document;
-import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
-import org.dive4elements.river.artifacts.model.FacetTypes;
-import org.dive4elements.river.artifacts.model.fixings.AnalysisPeriod;
-import org.dive4elements.river.artifacts.model.fixings.QWD;
-import org.dive4elements.river.exports.ChartGenerator;
-import org.dive4elements.river.exports.process.KMIndexProcessor;
-import org.dive4elements.river.exports.process.Processor;
-import org.dive4elements.river.jfree.RiverAnnotation;
-import org.dive4elements.river.jfree.StyledAreaSeriesCollection;
-import org.dive4elements.river.jfree.StyledXYSeries;
-import org.dive4elements.river.utils.KMIndex;
-
public class FixLongitudinalSectionGenerator
extends FixChartGenerator
implements FacetTypes
@@ -57,8 +63,17 @@
public static final String I18N_DW_YAXIS_LABEL =
"chart.fixings.longitudinalsection.yaxis.label";
+ public static final String I18N_W_YAXIS_LABEL =
+ "chart.longitudinal.section.yaxis.label";
+
+ public static final String I18N_Q_YAXIS_LABEL =
+ "chart.longitudinal.section.yaxis.second.label";
+
+ public static final String I18N_W_YAXIS_LABEL_DEFAULT = "W [NN + m]";
+ public static final String I18N_Q_YAXIS_LABEL_DEFAULT = "Q [m\u00b3/s]";
+
public static enum YAXIS {
- dW(0);
+ dW(0), W(1), Q(2);
public int idx;
private YAXIS(int c) {
idx = c;
@@ -71,12 +86,23 @@
logger.debug("FixLongitudinalSectionGenerator: doOut: " + name);
Processor processor = new KMIndexProcessor();
+ Processor wProcessor = new WOutProcessor();
if (name.contains(FIX_SECTOR_AVERAGE_LS_DEVIATION)) {
doSectorAverageDeviationOut(aaf, doc, visible);
}
else if (processor.canHandle(name)) {
processor.doOut(this, aaf, doc, visible, YAXIS.dW.idx);
}
+ else if (wProcessor.canHandle(name)) {
+ wProcessor.doOut(this, aaf, doc, visible, YAXIS.W.idx);
+ }
+ else if (name.equals(STATIC_WQKMS_Q)) {
+ doQOut(
+ (WQKms) aaf.getData(context),
+ aaf,
+ doc,
+ visible);
+ }
else if (name.equals(FIX_DEVIATION_LS)) {
doReferenceDeviationOut(aaf, doc, visible);
}
@@ -97,6 +123,64 @@
}
}
+ /**
+ * Process the output for Q facets in a longitudinal section curve.
+ *
+ * @param wqkms An array of WQKms values.
+ * @param aandf The facet and artifact. This facet does NOT support any data objects. Use
+ * D4EArtifact.getNativeFacet() instead to retrieve a Facet which supports
+ * data.
+ * @param theme The theme that contains styling information.
+ * @param visible The visibility of the curve.
+ */
+ protected void doQOut(
+ WQKms wqkms,
+ ArtifactAndFacet aandf,
+ Document theme,
+ boolean visible
+ ) {
+ logger.debug("LongitudinalSectionGenerator.doQOut");
+
+ XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+ StyledSeriesBuilder.addStepPointsKmQ(series, wqkms);
+
+ addAxisSeries(series, YAXIS.Q.idx, visible);
+
+ if (needInvertAxis(wqkms)) {
+ setInverted(true);
+ }
+ }
+
+ /**
+ * This method determines - taking JFreeCharts auto x value ordering into
+ * account - if the x axis need to be inverted. Waterlines in these charts
+ * should decrease.
+ *
+ * @param wkms The data object that stores the x and y values used for this
+ * chart.
+ */
+ public boolean needInvertAxis(WKms wkms) {
+ boolean wsUp = wkms.guessWaterIncreasing();
+ boolean kmUp = DataUtil.guessWaterIncreasing(wkms.allKms());
+ boolean inv = (wsUp && kmUp) || (!wsUp && !kmUp);
+
+ int size = wkms.size();
+
+ if (logger.isDebugEnabled()) {
+ logger.debug("(Wkms)Values : " + size);
+ if (size > 0) {
+ logger.debug("Start km: " + wkms.getKm(0));
+ logger.debug("End km: " + wkms.getKm(size-1));
+ }
+ logger.debug("wsUp: " + wsUp);
+ logger.debug("kmUp: " + kmUp);
+ logger.debug("inv: " + inv);
+ }
+
+ return inv;
+ }
+
@SuppressWarnings("unchecked")
protected void doSectorAverageDeviationOut(
ArtifactAndFacet aaf,
@@ -199,7 +283,21 @@
@Override
protected String getDefaultYAxisLabel(int pos) {
- return msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT);
+ if (pos == YAXIS.dW.idx) {
+ return msg(I18N_DW_YAXIS_LABEL, I18N_DW_YAXIS_LABEL_DEFAULT);
+ }
+ else if (pos == YAXIS.W.idx) {
+ D4EArtifact flys = (D4EArtifact) master;
+ String unit = RiverUtils.getRiver(flys).getWstUnit().getName();
+ return msg(
+ I18N_W_YAXIS_LABEL,
+ I18N_W_YAXIS_LABEL_DEFAULT,
+ new Object[] { unit });
+ }
+ else if (pos == YAXIS.Q.idx) {
+ return msg(I18N_Q_YAXIS_LABEL, I18N_Q_YAXIS_LABEL_DEFAULT);
+ }
+ return "";
}
@Override
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Wed Jun 26 16:40:25 2013 +0200
@@ -94,8 +94,7 @@
public static final double EPSILON = 0.001d;
public static enum YAXIS {
- W(0),
- Q(1);
+ W(0);
public int idx;
private YAXIS(int c) {
idx = c;
@@ -120,7 +119,7 @@
public boolean prepareChartData(ArtifactAndFacet aaf, Document doc, boolean visible) {
String name = aaf.getFacetName();
- this.artifact = (D4EArtifact)aaf.getArtifact();
+ this.artifact = (D4EArtifact) aaf.getArtifact();
if(name.startsWith(FIX_SECTOR_AVERAGE_WQ)) {
doSectorAverageOut(aaf, doc, visible);
@@ -184,7 +183,7 @@
}
- /** Add sector average points to chart */
+ /** Add sector average points to chart. */
protected void doSectorAverageOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
logger.debug("doSectorAverageOut");
@@ -199,7 +198,7 @@
}
}
- /** Add analysis event points to chart */
+ /** Add analysis event points to chart. */
protected void doAnalysisEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
logger.debug("doAnalysisEventsOut");
@@ -219,7 +218,7 @@
qwd.getW());
textAnnos.add(anno);
- addAxisSeries(series, 0, visible);
+ addAxisSeries(series, YAXIS.W.idx, visible);
if(visible && ThemeUtil.parseShowPointLabel(doc)) {
RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
flysAnno.setTextAnnotations(textAnnos);
@@ -232,7 +231,7 @@
}
- /** Add reference event points to chart */
+ /** Add reference event points to chart. */
protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
logger.debug("doReferenceEventsOut");
@@ -252,7 +251,7 @@
qwd.getW());
textAnnos.add(anno);
- addAxisSeries(series, 0, visible);
+ addAxisSeries(series, YAXIS.W.idx, visible);
if(visible && ThemeUtil.parseShowPointLabel(doc)) {
RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc);
flysAnno.setTextAnnotations(textAnnos);
@@ -317,7 +316,7 @@
0.0 , // start
maxQ); // end
- addAxisSeries(series, 0, visible);
+ addAxisSeries(series, YAXIS.W.idx, visible);
}
else {
logger.warn("doWQCurveOut: maxQ <= 0");
@@ -529,7 +528,7 @@
textAnnos.add(anno);
}
- addAxisSeries(series, 0, visible);
+ addAxisSeries(series, YAXIS.W.idx, visible);
if (visible && ThemeUtil.parseShowPointLabel(theme)) {
RiverAnnotation flysAnno =
new RiverAnnotation(null, null, null, theme);
diff -r 9787773e7bee -r 28c390debd9b artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java Tue Jun 25 13:34:03 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/DoubleUtil.java Wed Jun 26 16:40:25 2013 +0200
@@ -13,6 +13,7 @@
import gnu.trove.TDoubleArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import org.apache.log4j.Logger;
@@ -24,6 +25,17 @@
public static final double DEFAULT_STEP_PRECISION = 1e6;
+ public static final Comparator<double []> DOUBLE_PAIR_CMP =
+ new Comparator<double []>() {
+ @Override
+ public int compare(double [] a, double [] b) {
+ double diff = a[0] - b[0];
+ if (diff < 0d) return -1;
+ if (diff > 0d) return +1;
+ return 0;
+ }
+ };
+
/** EPSILON for comparison of double precision values. */
public static final double EPSILON = 1e-4;
@@ -225,6 +237,26 @@
return max;
}
+
+
+ /** Sort a and b with a as key. b is ordered accordingly */
+ public static final void sortByFirst(double [] a, double [] b) {
+ // XXX: Not efficient but bulletproof.
+ double [][] pairs = new double[a.length][2];
+ for (int i = 0; i < a.length; ++i) {
+ double [] p = pairs[i];
+ p[0] = a[i];
+ p[1] = b[i];
+
+ }
+ Arrays.sort(pairs, DOUBLE_PAIR_CMP);
+ for (int i = 0; i < a.length; ++i) {
+ double [] p = pairs[i];
+ a[i] = p[0];
+ b[i] = p[1];
+ }
+ }
+
public static void removeNaNs(TDoubleArrayList [] arrays) {
int dest = 0;
diff -r 9787773e7bee -r 28c390debd9b backend/contrib/import_river.sh
--- a/backend/contrib/import_river.sh Tue Jun 25 13:34:03 2013 +0200
+++ b/backend/contrib/import_river.sh Wed Jun 26 16:40:25 2013 +0200
@@ -215,6 +215,7 @@
-Dflys.backend.importer.skip.prfs=false \
-Dflys.backend.importer.skip.w80s=false \
-Dflys.backend.importer.skip.wst=true \
+ -Dflys.backend.importer.skip.measurement.stations=true \
-Dflys.backend.importer.skip.waterlevel.differences=true \
-Dflys.backend.importer.skip.waterlevels=true \
-Dflys.backend.importer.skip.sq.relation=true \
@@ -260,6 +261,7 @@
-Dflys.backend.importer.skip.prfs=true \
-Dflys.backend.importer.skip.w80s=true \
-Dflys.backend.importer.skip.wst=true \
+ -Dflys.backend.importer.skip.measurement.stations=false \
-Dflys.backend.importer.skip.waterlevel.differences=false \
-Dflys.backend.importer.skip.waterlevels=false \
-Dflys.backend.importer.skip.sq.relation=false \
@@ -305,6 +307,7 @@
-Dflys.backend.importer.skip.prfs=true \
-Dflys.backend.importer.skip.w80s=true \
-Dflys.backend.importer.skip.wst=false \
+ -Dflys.backend.importer.skip.measurement.stations=true \
-Dflys.backend.importer.skip.waterlevel.differences=true \
-Dflys.backend.importer.skip.waterlevels=true \
-Dflys.backend.importer.skip.sq.relation=true \
diff -r 9787773e7bee -r 28c390debd9b backend/contrib/run_hydr_morph.sh
--- a/backend/contrib/run_hydr_morph.sh Tue Jun 25 13:34:03 2013 +0200
+++ b/backend/contrib/run_hydr_morph.sh Wed Jun 26 16:40:25 2013 +0200
@@ -42,6 +42,7 @@
IMPORTER_SKIP_W80_CSVS=false
IMPORTER_SKIP_WST=false
+IMPORTER_SKIP_MEASUREMENT_STATIONS=false
IMPORTER_SKIP_BED_HEIGHT_SINGLE=false
IMPORTER_SKIP_BED_HEIGHT_EPOCH=false
IMPORTER_SKIP_FLOW_VELOCITY=false
@@ -85,6 +86,7 @@
-Dflys.backend.importer.skip.fixations=$IMPORTER_SKIP_FIXATIONS \
-Dflys.backend.importer.skip.flood.water=$IMPORTER_SKIP_FLOOD_WATER \
-Dflys.backend.importer.skip.flood.protection=$IMPORTER_SKIP_FLOOD_PROTECTION \
+ -Dflys.backend.importer.skip.measurement.stations=$IMPORTER_SKIP_MEASUREMENT_STATIONS \
-Dflys.backend.importer.skip.flow.velocity=$IMPORTER_SKIP_FLOW_VELOCITY \
-Dflys.backend.importer.skip.gauges=$IMPORTER_SKIP_GAUGES \
-Dflys.backend.importer.skip.historical.discharge.tables=$IMPORTER_SKIP_HISTORICAL_DISCHARGE_GAUGES \
diff -r 9787773e7bee -r 28c390debd9b backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java Tue Jun 25 13:34:03 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/PRFParser.java Wed Jun 26 16:40:25 2013 +0200
@@ -342,7 +342,7 @@
return false;
}
- int skip = lineSkipCount;
+ int skip = 0;
while ((line = in.readLine()) != null) {
// Expecting dummy lines.
diff -r 9787773e7bee -r 28c390debd9b contrib/make_flys_release/make_release.sh
--- a/contrib/make_flys_release/make_release.sh Tue Jun 25 13:34:03 2013 +0200
+++ b/contrib/make_flys_release/make_release.sh Wed Jun 26 16:40:25 2013 +0200
@@ -196,6 +196,9 @@
-e "s at http://localhost:8888 at http://localhost:$TOMCAT_PORT at g" \
$FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/web.xml
+sed -i -e "s at https://flys3-devel.bafg.de/wiki@${WIKI_URL}@g" \
+ $FLYS_SOURCE_DIR/river/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml
+
sed -i -e "s@/tmp/flys-client.log@${LOG_DIR}/client-${VERSION}.log at g" \
$FLYS_SOURCE_DIR/river/gwt-client/src/main/webapp/WEB-INF/log4j.properties
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/Config.java Wed Jun 26 16:40:25 2013 +0200
@@ -9,7 +9,6 @@
package org.dive4elements.river.client.client;
import com.google.gwt.i18n.client.LocaleInfo;
-
import com.google.gwt.xml.client.Document;
import com.google.gwt.xml.client.Node;
@@ -81,6 +80,17 @@
/**
+ * Returns the URL of the FLYS/d4e-Wiki.
+ *
+ * @return wiki base URL
+ */
+ public String getWikiUrl() {
+ Node server = config.getElementsByTagName("wiki").item(0);
+ return server.getFirstChild().getNodeValue();
+ }
+
+
+ /**
* Returns the name of the current locale.
*
* @return the name of the current locale.
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants.properties Wed Jun 26 16:40:25 2013 +0200
@@ -632,8 +632,8 @@
gauge_q_unit = m\u00b3/s
gauge_river_info_link = Riverinfo
gauge_info_link = Gaugeinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
gauge_curve_link = Dischargecurve/-table
discharge_timeranges = DC-Timeranges
discharge_chart = W/Q-Preview
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_de.properties Wed Jun 26 16:40:25 2013 +0200
@@ -631,8 +631,8 @@
gauge_q_unit = m\u00b3/s
gauge_river_info_link = Gew\u00e4sserinfo
gauge_info_link = Pegelinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
gauge_curve_link = Abflusskurve/-tafel
discharge_timeranges = AK-Zeitr\u00e4ume
discharge_chart = W/Q-Vorschau
@@ -640,7 +640,7 @@
measurement_station_type = Messstellenart
measurement_station_operator = Betreiber
measurement_station_start_time = Beginn der Aufzeichnung
-measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
+measurement_station_url = /MessstellenInfo/
measurement_station_info_link = Messstelleninfo
measurement_station_gauge_name = hydrologischer Bezugspegel
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/FLYSConstants_en.properties Wed Jun 26 16:40:25 2013 +0200
@@ -606,8 +606,8 @@
gauge_q_unit = m\u00b3/s
gauge_river_info_link = Riverinfo
gauge_info_link = Gaugeinfo
-gauge_url = https://flys-intern.intevation.de/PegelInfo/
-gauge_river_url = https://flys-intern.intevation.de/GewaesserInfo/
+gauge_url = /PegelInfo/
+gauge_river_url = /GewaesserInfo/
gauge_curve_link = Dischargecurve/-table
discharge_timeranges = DC-Timeranges
discharge_chart = W/Q-Preview
@@ -615,7 +615,7 @@
measurement_station_type = Type of Measurement Station
measurement_station_operator = Operator
measurement_station_start_time = Observation Start Time
-measurement_station_url = https://flys-intern.intevation.de/MessstellenInfo/
+measurement_station_url = /MessstellenInfo/
measurement_station_info_link = Measurement Station Info
measurement_station_gauge_name = Reference Gauge
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/config.xml Wed Jun 26 16:40:25 2013 +0200
@@ -1,5 +1,7 @@
<config>
<server>http://localhost:8181</server>
+
+ <wiki>https://flys3-devel.bafg.de/wiki</wiki>
<projectlist>
<!-- The interval to update the user's projects (in ms) -->
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FLYSHeader.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FLYSHeader.java Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/FLYSHeader.java Wed Jun 26 16:40:25 2013 +0200
@@ -12,7 +12,6 @@
import com.google.gwt.i18n.client.LocaleInfo;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
-
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.BooleanCallback;
@@ -20,10 +19,11 @@
import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+import org.dive4elements.river.client.client.Config;
import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.client.services.UserService;
@@ -32,12 +32,14 @@
/**
+ * Header of the FLYS webpage/app.
+ *
* @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
*/
public class FLYSHeader extends HLayout {
/** The interface that provides the message resources. */
- private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
+ private final FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
/** The height used for this header.*/
public static final int HEIGHT = 56;
@@ -49,25 +51,25 @@
private User currentUser;
/** The label that displays the current logged in user. */
- private Label userText;
+ private final Label userText;
/** The button to log the current user out.*/
- private Button logout;
+ private final Button logout;
/** The button to open the project list.*/
- private Button projectList;
+ private final Button projectList;
/** The button to switch between the english and german version.*/
- private Button language;
+ private final Button language;
/** The button to open an info panel.*/
- private Button info;
+ private final Button info;
- private UserServiceAsync userService =
+ private final UserServiceAsync userService =
GWT.create(UserService.class);
/** An instance to FLYS.*/
- private FLYS flys;
+ private final FLYS flys;
public FLYSHeader(FLYS flys) {
@@ -94,9 +96,11 @@
public void onClick(ClickEvent event) {
GWT.log("Clicked 'logout' button.");
userService.logoutCurrentUser(new AsyncCallback<Void>() {
+ @Override
public void onFailure(Throwable caught) {
}
+ @Override
public void onSuccess(Void result) {
/* Just reload the page. GGInAFilter is goint to redirect
* to the correct login page */
@@ -132,7 +136,8 @@
@Override
public void onClick(ClickEvent event) {
GWT.log("Clicked 'info' button.");
- GWT.log("IMPLEMENT the 'open info panel' function.");
+ String wikiLink = Config.getInstance().getWikiUrl() + "/Info";
+ Window.open(wikiLink, "_blank", null);
}
});
init();
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RiverInfoPanel.java Wed Jun 26 16:40:25 2013 +0200
@@ -8,12 +8,6 @@
package org.dive4elements.river.client.client.ui;
-import java.util.Iterator;
-
-import org.dive4elements.river.client.client.FLYS;
-import org.dive4elements.river.client.client.FLYSConstants;
-import org.dive4elements.river.client.shared.model.RiverInfo;
-
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -22,6 +16,13 @@
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.LinkItem;
+import java.util.Iterator;
+
+import org.dive4elements.river.client.client.Config;
+import org.dive4elements.river.client.client.FLYS;
+import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.shared.model.RiverInfo;
+
/**
* Panel to display information about a river.
* @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
@@ -97,7 +98,8 @@
String url = number != null ?
MSG.gauge_river_url() + number :
MSG.gauge_river_url();
- DynamicForm infoLink = WikiLinks.linkHTML(this.flys, url,
+ String wikiBaseUrl = Config.getInstance().getWikiUrl();
+ DynamicForm infoLink = WikiLinks.linkHTML(this.flys, wikiBaseUrl + url,
MSG.gauge_river_info_link());
infoLink.setTop(5);
LinkItem item = (LinkItem)infoLink.getField("saml");
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeRecord.java Wed Jun 26 16:40:25 2013 +0200
@@ -11,6 +11,7 @@
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import org.dive4elements.river.client.client.Config;
import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.shared.model.GaugeInfo;
@@ -20,15 +21,17 @@
public class GaugeRecord extends ListGridRecord implements GaugeInfo {
/** The message class that provides i18n strings.*/
- private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+ private final FLYSConstants MSG = GWT.create(FLYSConstants.class);
public GaugeRecord(GaugeInfo gauge) {
+ String wikiBaseUrl = Config.getInstance().getWikiUrl();
+
setCanExpand(true);
Long number = gauge.getOfficialNumber();
String url = number != null ?
MSG.gauge_url() + number :
MSG.gauge_url();
- setLink(url);
+ setLink(wikiBaseUrl + url);
setLinkText(MSG.gauge_info_link());
setName(gauge.getName());
setKmStart(gauge.getKmStart());
@@ -59,6 +62,7 @@
return this.getAttributeAsString("link");
}
+ @Override
public String getName() {
return this.getAttributeAsString("name");
}
@@ -67,6 +71,7 @@
this.setAttribute("name", value);
}
+ @Override
public Double getKmStart() {
return this.getAttributeAsDouble("kmstart");
}
@@ -75,6 +80,7 @@
this.setAttribute("kmstart", value);
}
+ @Override
public Double getKmEnd() {
return this.getAttributeAsDouble("kmend");
}
@@ -83,6 +89,7 @@
this.setAttribute("kmend", value);
}
+ @Override
public Double getMinQ() {
return this.getAttributeAsDouble("minq");
}
@@ -91,6 +98,7 @@
this.setAttribute("minq", value);
}
+ @Override
public Double getMaxQ() {
return this.getAttributeAsDouble("maxq");
}
@@ -99,6 +107,7 @@
this.setAttribute("maxq", value);
}
+ @Override
public Double getMinW() {
return this.getAttributeAsDouble("minw");
}
@@ -107,6 +116,7 @@
this.setAttribute("minw", value);
}
+ @Override
public Double getMaxW() {
return this.getAttributeAsDouble("maxw");
}
@@ -115,6 +125,7 @@
this.setAttribute("maxw", value);
}
+ @Override
public Double getDatum() {
return this.getAttributeAsDouble("datum");
}
@@ -123,6 +134,7 @@
this.setAttribute("datum", value);
}
+ @Override
public Double getAeo() {
return this.getAttributeAsDouble("aeo");
}
@@ -131,6 +143,7 @@
this.setAttribute("aeo", value);
}
+ @Override
public boolean isKmUp() {
return this.getAttributeAsBoolean("kmup");
}
@@ -139,6 +152,7 @@
this.setAttribute("kmup", value);
}
+ @Override
public Double getStation() {
return this.getAttributeAsDouble("station");
}
@@ -147,6 +161,7 @@
this.setAttribute("station", value);
}
+ @Override
public String getWstUnit() {
return this.getAttributeAsString("wstunit");
}
@@ -155,6 +170,7 @@
this.setAttribute("wstunit", value);
}
+ @Override
public Long getOfficialNumber() {
return this.getAttributeAsLong("officialnumber");
}
@@ -163,6 +179,7 @@
this.setAttribute("officialnumber", number);
}
+ @Override
public String getRiverName() {
return this.getAttributeAsString("rivername");
}
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/MeasurementStationRecord.java Wed Jun 26 16:40:25 2013 +0200
@@ -8,11 +8,12 @@
package org.dive4elements.river.client.client.ui.stationinfo;
-import java.util.Date;
-
import com.google.gwt.core.client.GWT;
import com.smartgwt.client.widgets.grid.ListGridRecord;
+import java.util.Date;
+
+import org.dive4elements.river.client.client.Config;
import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.shared.model.MeasurementStation;
@@ -24,16 +25,18 @@
implements MeasurementStation {
/** The message class that provides i18n strings.*/
- private FLYSConstants MSG = GWT.create(FLYSConstants.class);
+ private final FLYSConstants MSG = GWT.create(FLYSConstants.class);
public MeasurementStationRecord(MeasurementStation station) {
this.setCanExpand(true);
+ String wikiBaseUrl = Config.getInstance().getWikiUrl();
+
Integer number = station.getID();
String stationName = station.getName();
String stationIdent = stationName.replaceAll("\\W", "");
String stationType = station.getMeasurementType();
- String link = MSG.measurement_station_url() +
+ String link = wikiBaseUrl + MSG.measurement_station_url() +
stationIdent + stationType;
this.setLink(link);
this.setLinkText(MSG.measurement_station_info_link());
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html
--- a/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html Tue Jun 25 13:34:03 2013 +0200
+++ b/gwt-client/src/main/webapp/images/FLYS_Karte_interactive.html Wed Jun 26 16:40:25 2013 +0200
@@ -71,15 +71,15 @@
<area id="main_area" shape="poly" onmouseover="highlight('Main'); highlightList('Main')" onmouseout="unHighlight('Main'); unHighlightList('Main')" onclick="selectRiver('Main')" coords="240,492,240,466,303,462,335,445,375,444,454,469,468,501,394,500,381,480,350,480,337,493,344,541,308,529,272,524,269,504" />
<area id="main_limbach_area" shape="poly" onmouseover="highlight('Main (Wehrarm Limbach)'); highlightList('Main (Wehrarm Limbach)')" onmouseout="unHighlight('Main (Wehrarm Limbach)'); unHighlightList('Main (Wehrarm Limbach)')" onclick="selectRiver('Main (Wehrarm Limbach)')" coords="360,480,381,480,393,500,383,519,368,520" />
<area id="main_volkach_area" shape="poly" onmouseover="highlight('Main (Wehrarm Volkach)'); highlightList('Main (Wehrarm Volkach)')" onmouseout="unHighlight('Main (Wehrarm Volkach)'); unHighlightList('Main (Wehrarm Volkach)')" onclick="selectRiver('Main (Wehrarm Volkach)')" coords="350,480,360,480,368,522,343,541,337,493" />
- <area id="mosel_area" shape="poly" onmouseover="highlight('Mosel'); highlightList('Mosel')" onmouseout="unHighlight('Mosel'); unHighlightList('Mosel')" onclick="selectRiver('Mosel')" coords="190,467,170,461,138,453,102,466,103,494,98,537,86,600,125,604,149,583,130,543,140,518,162,515,194,511" />
+ <area id="mosel_area" shape="poly" onmouseover="highlight('Mosel'); highlightList('Mosel')" onmouseout="unHighlight('Mosel'); unHighlightList('Mosel')" onclick="selectRiver('Mosel')" coords="190,466,170,460,138,452,102,465,103,493,98,536,93,589,119,587,128,542,130,528,140,517,162,512,194,510" />
<area id="neckar_area" shape="poly" onmouseover="highlight('Neckar'); highlightList('Neckar')" onmouseout="unHighlight('Neckar'); unHighlightList('Neckar')" onclick="selectRiver('Neckar')" coords="231,641,253,653,288,640,386,577,357,559,342,541,319,540,292,547,290,583,308,590,306,615,250,604,226,630" />
<area id="neckar_wehrarm_area" shape="poly" onmouseover="highlight('Neckar (über Wehrarme)'); highlightList('Neckar (über Wehrarme)')" onmouseout="unHighlight('Neckar (über Wehrarme)'); unHighlightList('Neckar (über Wehrarme)')" onclick="selectRiver('Neckar (über Wehrarme)')" coords="272,524,248,540,253,561,259,570,254,605,306,615,308,590,290,583,292,546,320,540,309,529" />
<area id="oder_area" shape="poly" onmouseover="highlight('Oder'); highlightList('Oder')" onmouseout="unHighlight('Oder'); unHighlightList('Oder')" onclick="selectRiver('Oder')" coords="572,143,542,155,542,178,529,203,541,238,565,252,583,273,570,307,603,327,641,320,639,286,633,275,614,269,619,246,635,236,637,195,606,160" />
<area id="rhein_area" shape="poly" onmouseover="highlight('Rhein'); highlightList('Rhein')" onmouseout="unHighlight('Rhein'); unHighlightList('Rhein')" onclick="selectRiver('Rhein')" coords="86,301,138,317,157,334,153,355,177,381,185,407,198,450,197,464,219,471,224,478,240,473,241,492,269,502,273,523,249,539,254,561,260,570,256,597,227,628,229,639,252,653,277,644,279,668,236,670,237,690,265,687,281,696,283,717,248,728,188,737,170,718,167,669,203,569,222,545,213,521,195,521,193,467,171,459,145,444,122,403,49,391,52,352,23,344,4,304" />
- <area id="saale_area" shape="poly" onmouseover="highlight('Saale'); highlightList('Saale')" onmouseout="unHighlight('Saale'); unHighlightList('Saale')" onclick="selectRiver('Saale')" coords="445,314,414,311,366,299,366,342,395,346,404,356,477,371,463,341" />
- <area id="saale_thueringen_area" shape="poly" onmouseover="highlight('Saale-Thüringen'); highlightList('Saale-Thüringen')" onmouseout="unHighlight('Saale-Thüringen'); unHighlightList('Saale-Thüringen')" onclick="selectRiver('Saale-Thüringen')" coords="430,365,462,377,477,385,430,461,375,444,387,415,402,408,420,387,435,383" />
- <area id="saar_area" shape="poly" onmouseover="highlight('Saar'); highlightList('Saar')" onmouseout="unHighlight('Saar'); unHighlightList('Saar')" onclick="selectRiver('Saar')" coords="150,539,129,544,139,564,155,588,181,593,187,565,201,536,195,526,195,512,154,516" />
- <area id="saar_wiltingerbogen_area" shape="poly" onmouseover="highlight('Saar (Wiltinger Bogen)'); highlightList('Saar (Wiltinger Bogen)')" onmouseout="unHighlight('Saar (Wiltinger Bogen)'); unHighlightList('Saar (Wiltinger Bogen)')" onclick="selectRiver('Saar (Wiltinger Bogen)')" coords="139,518,155,516,149,540,130,542" />
+ <area id="saale_area" shape="poly" onmouseover="highlight('Saale'); highlightList('Saale')" onmouseout="unHighlight('Saale'); unHighlightList('Saale')" onclick="selectRiver('Saale')" coords="445,314,414,311,366,299,366,342,395,346,404,356,469,350,463,341" />
+ <area id="saale_thueringen_area" shape="poly" onmouseover="highlight('Saale-Thüringen'); highlightList('Saale-Thüringen')" onmouseout="unHighlight('Saale-Thüringen'); unHighlightList('Saale-Thüringen')" onclick="selectRiver('Saale-Thüringen')" coords="460,395,430,461,375,444,387,415,402,408,420,387,435,383" />
+ <area id="saar_area" shape="poly" onmouseover="highlight('Saar'); highlightList('Saar')" onmouseout="unHighlight('Saar'); unHighlightList('Saar')" onclick="selectRiver('Saar')" coords="152,515,193,511,193,545,180,599,151,589,146,566,147,559,143,544,153,535" />
+ <area id="saar_wiltingerbogen_area" shape="poly" onmouseover="highlight('Saar (Wiltinger Bogen)'); highlightList('Saar (Wiltinger Bogen)')" onmouseout="unHighlight('Saar (Wiltinger Bogen)'); unHighlightList('Saar (Wiltinger Bogen)')" onclick="selectRiver('Saar (Wiltinger Bogen)')" coords="130,528,139,517,152,515,152,536,142,543,147,560,134,570,126,558" />
<area id="werra_sommer_area" shape="poly" onmouseover="highlight('Werra (Sommer)'); highlightList('Werra (Sommer)')" onmouseout="unHighlight('Werra (Sommer)'); unHighlightList('Werra (Sommer)')" onclick="selectRiver('Werra (Sommer)')" coords="316,361,334,351,360,342,387,345,398,354,384,372,381,389,371,400,350,390,345,382,336,378,334,372,329,368" />
<area id="werra_winter_area" shape="poly" onmouseover="highlight('Werra (Winter)'); highlightList('Werra (Winter)')" onmouseout="unHighlight('Werra (Winter)'); unHighlightList('Werra (Winter)')" onclick="selectRiver('Werra (Winter)')" coords="315,362,326,388,334,398,350,409,370,400,353,391,347,388,346,385,344,382,335,378,333,372,329,368" />
<area id="weser_area" shape="poly" onmouseover="highlight('Weser'); highlightList('Weser')" onmouseout="unHighlight('Weser'); unHighlightList('Weser')" onclick="selectRiver('Weser')" coords="255,166,227,172,232,227,268,237,241,279,246,298,247,313,275,313,282,330,289,353,314,363,332,351,318,328,316,308,299,280,303,255,300,217,263,203,273,176" />
@@ -97,6 +97,7 @@
<area id="Ems_area" shape="poly" onmouseover="highlight('Ems')" onmouseout="unHighlight('Ems')" onclick="selectRiver('Ems')" coords="175,170,144,199,176,306,156,337,154,357,171,374,245,349,229,309,226,262,208,227,215,169" />
<area id="Main_Donau_area" shape="poly" onmouseover="highlight('Main_Donau')" onmouseout="unHighlight('Main_Donau')" onclick="selectRiver('Main_Donau')" coords="384,519,371,521,343,541,355,558,396,578,433,576,442,556,426,500,392,500" />
<area id="Saale_1_area" shape="poly" onmouseover="highlight('Saale_1')" onmouseout="unHighlight('Saale_1')" onclick="selectRiver('Saale_1')" coords="423,358,395,356,382,375,381,390,402,407,419,387,435,383" />
+ <area id="Saale_z_area" shape="poly" onmouseover="highlight('Saale_Zwischen')" onmouseout="unHighlight('Saale_Zwischen')" onclick="selectRiver('Saale_Zwischen')" coords="423,354,469,351,483,382,461,395,435,382" />
<area id="Spree_area" shape="poly" onmouseover="highlight('Spree')" onmouseout="unHighlight('Spree')" onclick="selectRiver('Spree')" coords="530,234,550,244,563,251,582,274,573,295,516,283" />
<area id="Weser_1_area" shape="poly" onmouseover="highlight('Weser_1')" onmouseout="unHighlight('Weser_1')" onclick="selectRiver('Weser_1')" coords="260,202,274,183,299,201,299,217,285,216" />
<area id="Weser_2_area" shape="poly" onmouseover="highlight('Weser_2')" onmouseout="unHighlight('Weser_2')" onclick="selectRiver('Weser_2')" coords="300,216,333,231,352,343,329,346,318,327,317,307,300,279,304,252" />
@@ -158,6 +159,7 @@
<img src="images/FLYS_Neckar_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Neckar (über Wehrarme)_inactive" >
<img src="images/FLYS_Saale_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Saale_inactive" >
<img src="images/FLYS_Saale_Thueringen_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Saale-Thüringen_inactive" >
+ <img src="images/FLYS_Saale_Zwischen_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Saale_Zwischen_inactive" >
<img src="images/FLYS_Saar_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Saar_inactive" >
<img src="images/FLYS_Werra_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Werra (Sommer)_inactive" >
<img src="images/FLYS_Werra_inactive.png" style="position: absolute; left: 8px; top: 8px; visibility: hidden; z-index: 50;" id="Werra (Winter)_inactive" >
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/webapp/images/FLYS_Saale_Zwischen_inactive.png
Binary file gwt-client/src/main/webapp/images/FLYS_Saale_Zwischen_inactive.png has changed
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/webapp/images/FLYS_Saar.png
Binary file gwt-client/src/main/webapp/images/FLYS_Saar.png has changed
diff -r 9787773e7bee -r 28c390debd9b gwt-client/src/main/webapp/images/FLYS_Saar_WiltingerBogen.png
Binary file gwt-client/src/main/webapp/images/FLYS_Saar_WiltingerBogen.png has changed
More information about the Dive4elements-commits
mailing list