Mercurial > dive4elements > river
changeset 5110:ab2f1e0be311 dami
Merge branch default into dami
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 27 Feb 2013 11:38:36 +0100 |
parents | 357938c64967 (current diff) cf50783542a1 (diff) |
children | 5c07ec3e9e25 |
files | |
diffstat | 18 files changed, 81 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/CollectionMonitor.java Wed Feb 27 11:38:36 2013 +0100 @@ -22,10 +22,12 @@ import de.intevation.flys.artifacts.datacage.Recommendations; +/** Monitors collection changes. */ public class CollectionMonitor implements Hook { public static final String XPATH_RESULT = "/art:result"; + @Override public void setup(Node cfg) { }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java Wed Feb 27 11:38:36 2013 +0100 @@ -7,6 +7,7 @@ import org.apache.log4j.Logger; +/** Access for Fixation related data. */ public class FixAccess extends RangeAccess {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixRealizingAccess.java Wed Feb 27 11:38:36 2013 +0100 @@ -9,6 +9,8 @@ import org.apache.log4j.Logger; + +/** Fix-Realizing (Volmer/Ausgelagerte Wasserspiegellage) access. */ public class FixRealizingAccess extends FixAccess {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java Wed Feb 27 11:38:36 2013 +0100 @@ -53,6 +53,7 @@ return from < to; } + /** Checks whether given km lies inside the to/from bounds of this segment. */ public boolean inside(double km) { return from < to ? km >= from && km <= to @@ -120,6 +121,7 @@ return referencePoint; } + /** Use DoubleUtil to parse Segments. */ public static List<Segment> parseSegments(String input) { final List<Segment> segments = new ArrayList<Segment>();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/InputDoubleState.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/InputDoubleState.java Wed Feb 27 11:38:36 2013 +0100 @@ -6,7 +6,7 @@ /** - * State to keep a double value and validate it against a range + * State to keep a double value and validate it against a range. */ public class InputDoubleState extends MinMaxState {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java Wed Feb 27 11:38:36 2013 +0100 @@ -59,6 +59,7 @@ public static final GaugeOrder GAUGE_UP = new GaugeOrder(true); public static final GaugeOrder GAUGE_DOWN = new GaugeOrder(false); + /** Trivial, empty constructor. */ public WQAdapted() { } @@ -117,6 +118,7 @@ } + /** Create the items for input to the ranges per mode. */ protected Element[] createValueItems( XMLUtils.ElementCreator cr, Artifact artifact, @@ -165,7 +167,7 @@ double[] mmW = gauge.determineMinMaxW(); elements.add(createItem( - cr, new String[] { from + ";" + to, ""}, mmQ, mmW)); + cr, new String[] { from + ";" + to, gauge.getName()}, mmQ, mmW)); } } else { @@ -186,7 +188,7 @@ double[] mmW = gauge.determineMinMaxW(); elements.add(createItem( - cr, new String[] { to + ";" + from, ""}, mmQ, mmW)); + cr, new String[] { to + ";" + from, gauge.getName()}, mmQ, mmW)); } } @@ -449,7 +451,7 @@ double lower = Double.parseDouble(parts[0]); double upper = Double.parseDouble(parts[1]); - String[] values = parts[2].split(","); + String[] values = parts[3].split(","); int num = values.length; double[] res = new double[num];
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ATWriter.java Wed Feb 27 11:38:36 2013 +0100 @@ -25,6 +25,7 @@ import org.apache.log4j.Logger; +/** Write AT files. */ public class ATWriter { private static Logger logger = Logger.getLogger(ATWriter.class); @@ -156,7 +157,7 @@ { PrintWriter out = new PrintWriter(writer); - // a header is required, because the desktop version of FLYS will skip + // A header is required, because the desktop version of FLYS will skip // the first row. if (gName != null) { printGaugeHeader(out, meta, river, km, gName, datum, date);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java Wed Feb 27 11:38:36 2013 +0100 @@ -116,6 +116,12 @@ this.master = master; } + /** Get the callcontext that this exporter has been initialized + * with. */ + public CallContext getCallContext() { + return this.context; + } + @Override public void setCollection(FLYSArtifactCollection collection) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java Wed Feb 27 11:38:36 2013 +0100 @@ -32,10 +32,13 @@ import de.intevation.flys.model.Gauge; +import de.intevation.flys.artifacts.access.FixRealizingAccess; import de.intevation.flys.artifacts.access.RangeAccess; +import de.intevation.flys.artifacts.FixationArtifact; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.model.CalculationResult; +import de.intevation.flys.artifacts.model.Segment; import de.intevation.flys.artifacts.model.WQCKms; import de.intevation.flys.artifacts.model.WQKms; import de.intevation.flys.artifacts.model.WKmsJRDataSource; @@ -107,7 +110,6 @@ public static final String CSV_NOT_IN_GAUGE_RANGE = "export.waterlevel.csv.not.in.gauge.range"; - public static final Pattern NUMBERS_PATTERN = Pattern.compile("\\D*(\\d++.\\d*)\\D*"); @@ -493,16 +495,31 @@ long startTime = System.currentTimeMillis(); String colDesc = desc; + List<Segment> segments = null; if (flys instanceof WINFOArtifact) { if (wqkms != null && wqkms.getRawValue() != null) { WINFOArtifact winfo = (WINFOArtifact) flys; colDesc = FLYSUtils.getNamedMainValue(winfo, wqkms.getRawValue()); } } + else if (flys instanceof FixationArtifact) { + // Get W/Q input per gauge for this case. + FixRealizingAccess fixAccess = new FixRealizingAccess(flys, getCallContext()); + segments = fixAccess.getSegments(); + } for (int i = 0; i < size; i ++) { result = wqkms.get(i, result); + // Check if there has been W input per Gauge and use it. + if (segments != null) { + for (Segment segment: segments) { + if (segment.inside(result[2])) { + colDesc = "" + segment.getValues()[0]; + } + } + } + if (atGauge) { writer.writeNext(new String[] { kmf.format(result[2]), @@ -559,6 +576,9 @@ for (WQKms[] tmp: data) { for (WQKms wqkms: tmp) { + if (wqkms instanceof ConstantWQKms) { + continue; + } int size = wqkms != null ? wqkms.size() : 0; addWSTColumn(writer, wqkms);
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java Wed Feb 27 11:38:36 2013 +0100 @@ -177,7 +177,7 @@ vs.resetQuick(); - for (String valueStr: parts[2].split(",")) { + for (String valueStr: parts[3].split(",")) { vs.add(round(Double.parseDouble(valueStr.trim()))); }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BundesWasserStrassenParser.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BundesWasserStrassenParser.java Wed Feb 27 11:38:36 2013 +0100 @@ -49,9 +49,13 @@ @Override protected void handleLine(int lineNum, String line) { String[] vals = line.split(","); + // Try both "," and ";" as separator. if (vals.length != 2) { - logger.warn("Invalid bwastr-id line:\n" + line); - return; + vals = line.split(";"); + if (vals.length != 2) { + logger.warn("Invalid bwastr-id line:\n" + line); + return; + } } try{ String name = unwrap(vals[0].toLowerCase());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed Feb 27 11:38:36 2013 +0100 @@ -252,6 +252,8 @@ String wqQ(); + String wqQatGauge(); + String wqQGauge(); String wqSingle();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed Feb 27 11:38:36 2013 +0100 @@ -166,6 +166,7 @@ measurementStationPanelTitle = Measurement Station Information wqW = W at Gauge [cm] wqQ = Q [m\u00b3/s] +wqQatGauge = Q at Gauge [m\u00b3/s] wqWFree = W free position [m+NHN] wqQGauge = Discharge at Gauge wqSingle = Single values @@ -231,11 +232,11 @@ historical_discharge_export = Historical Discharge Curve Export showextramark = Show begin of extrapolation extreme_wq_curve = W/Q -fix_wq_curve = W/Q +fix_wq_curve = W/Q-Diagram fix_deltawt_curve = \u0394 W/t fix_longitudinal_section_curve = Longitudinal Section fix_derivate_curve = Derivate -fix_vollmer_wq_curve = W/Q +fix_vollmer_wq_curve = W/Q-Diagram datacage_add_pair = Add difference pair load_diameter = Bedload Diameter bed_diameter = Bed Diameter @@ -572,7 +573,7 @@ sq_overview=Overview -gauge_zero = Gauge zero ground +gauge_zero = GZG gauge_q_unit = m\u00b3/s gauge_river_info_link = Riverinfo gauge_info_link = Gaugeinfo
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed Feb 27 11:38:36 2013 +0100 @@ -154,6 +154,7 @@ measurementStationPanelTitle = Gew\u00e4sser/Messstellen-Info wqW = W am Pegel [cm] wqQ = Q [m\u00b3/s] +wqQatGauge = Q am Pegel [m\u00b3/s] wqWFree = W auf freier Strecke [m+NHN] wqQGauge = Kennzeichnender Abfluss am Pegel wqSingle = Einzelwerte @@ -232,11 +233,11 @@ historical_discharge_export = Historische Abflusskurven Export showextramark = Zeige Anfang der Extrapolation extreme_wq_curve = W/Q -fix_wq_curve = W/Q +fix_wq_curve = W/Q-Diagram fix_deltawt_curve = \u0394 W/t fix_longitudinal_section_curve = L\u00e4ngsschnitt fix_derivate_curve = Ableitungskurve -fix_vollmer_wq_curve = W/Q +fix_vollmer_wq_curve = W/Q-Diagramm datacage_add_pair = Differenzenpaar hinzuf\u00fcgen load_diameter = Geschiebedurchmesser bed_diameter = Sohldurchmesser @@ -572,7 +573,7 @@ fix_parameters = CSV sq_overview=\u00dcbersicht -gauge_zero = Pegelnullpunkt +gauge_zero = PNP gauge_q_unit = m\u00b3/s gauge_river_info_link = Gew\u00e4sserinfo gauge_info_link = Pegelinfo
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed Feb 27 11:38:36 2013 +0100 @@ -167,6 +167,7 @@ measurementStationPanelTitle = Measurement Station Information wqW = W at Gauge [cm] wqQ = Q [m\u00b3/s] +wqQatGauge = Q at Gauge [m\u00b3/s] wqWFree = W at free position [m+NHN] wqQGauge = Discharge at Gauge wqSingle = Single values @@ -232,11 +233,11 @@ historical_discharge_export = Historical Discharge Curve Export showextramark = Show begin of extrapolation extreme_wq_curve = W/Q -fix_wq_curve = W/Q +fix_wq_curve = W/Q-Diagram fix_deltawt_curve = \u0394 W/t fix_longitudinal_section_curve = Longitudinal Section fix_derivate_curve = Derivate -fix_vollmer_wq_curve = W/Q +fix_vollmer_wq_curve = W/Q-Diagram datacage_add_pair = Add difference pair load_diameter = Bedload Diameter bed_diameter = Bed Diameter @@ -572,7 +573,7 @@ fix_parameters = CSV sq_overview=Overview -gauge_zero = Gauge zero ground +gauge_zero = GZG gauge_q_unit = m\u00b3/s gauge_river_info_link = Riverinfo gauge_info_link = Gaugeinfo
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Wed Feb 27 11:38:36 2013 +0100 @@ -22,6 +22,8 @@ protected TextItem ti; + private String title; + /** The constant input field name. */ public static final String FIELD_NAME = "doublearray"; @@ -50,6 +52,7 @@ BlurHandler handler, TitleOrientation titleOrientation) { + this.title = title; ti = new TextItem(FIELD_NAME); StaticTextItem sti = new StaticTextItem("staticarray"); @@ -263,5 +266,9 @@ public double[] getInputValues() { return getInputValues(ti); } + + public String getItemTitle() { + return this.title; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/QSegmentedInputPanel.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/QSegmentedInputPanel.java Wed Feb 27 11:38:36 2013 +0100 @@ -180,7 +180,7 @@ HLayout h = new HLayout(); String[] parts = gauge.split(GAUGE_PART_SEPARATOR); - String[] values = parts[2].split(VALUE_SEPARATOR); + String[] values = parts[3].split(VALUE_SEPARATOR); Label l = new Label(parts[0] + " - " + parts[1] + ": "); @@ -361,10 +361,10 @@ double[] values = dap.getInputValues(); if (wqvalue == null) { - wqvalue = createValueString(key, values); + wqvalue = createValueString(key + "; ", values); } else { - wqvalue += GAUGE_SEPARATOR + createValueString(key, values); + wqvalue += GAUGE_SEPARATOR + createValueString(key + "; ", values); } }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Wed Feb 27 11:17:42 2013 +0100 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java Wed Feb 27 11:38:36 2013 +0100 @@ -202,9 +202,9 @@ HLayout h = new HLayout(); String[] parts = gauge.split(GAUGE_PART_SEPARATOR); - String[] values = parts[2].split(VALUE_SEPARATOR); + String[] values = parts[3].split(VALUE_SEPARATOR); - Label l = new Label(parts[0] + " - " + parts[1] + ": "); + Label l = new Label(parts[2] + ": "); StringBuilder sb = new StringBuilder(); boolean first = true; @@ -464,9 +464,9 @@ for (DataItem item: items) { String title = item.getLabel(); - + String label = item.getStringValue(); DoubleArrayPanel dap = new DoubleArrayPanel( - createLineTitle(title), null, this, TitleOrientation.LEFT); + label, null, this, TitleOrientation.LEFT); wqranges.put(title, dap); @@ -513,7 +513,7 @@ LinkedHashMap wqValues = new LinkedHashMap(); wqValues.put(FIELD_WQ_W, MSG.wqW()); - wqValues.put(FIELD_WQ_Q, MSG.wqQ()); + wqValues.put(FIELD_WQ_Q, MSG.wqQatGauge()); wq.setValueMap(wqValues); @@ -587,13 +587,14 @@ while (iter.hasNext()) { String key = iter.next(); DoubleArrayPanel dap = wqranges.get(key); + String label = dap.getItemTitle(); double[] values = dap.getInputValues(); if (wqvalue == null) { - wqvalue = createValueString(key, values); + wqvalue = createValueString(key + ";" + label, values); } else { - wqvalue += GAUGE_SEPARATOR + createValueString(key, values); + wqvalue += GAUGE_SEPARATOR + createValueString(key + ";" + label, values); } }