# HG changeset patch # User Felix Wolfsteller # Date 1328276956 0 # Node ID c9c788eea200c5f80810ea26f326c09c4f63c523 # Parent 40608c82e9cbdd6b963b1492a552dd3bbbb63f70 Improved reference curve. flys-artifacts/trunk@3900 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/ChangeLog Fri Feb 03 13:49:16 2012 +0000 @@ -1,3 +1,33 @@ +2012-02-03 Felix Wolfsteller + + Improved Reference Curves. + + * doc/conf/artifacts/winfo.xml: Add start/end input step for reference + curves. + + * doc/conf/themes.xml: Add theme for reference curve. + + * src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java: + Disable start/end point-hack for reference curve. Go with 'live' + values. + + * src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java: + i18n. + + * src/main/java/de/intevation/flys/artifacts/states/EnterLocationState.java: + New. State to enter location. + + * src/main/java/de/intevation/flys/artifacts/states/InputDoubleState.java: + New. + + * src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java: + Take WW name to display in themepanel. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: Added translations. + 2012-02-03 Ingo Weinzierl * src/main/java/de/intevation/flys/artifacts/model/Calculation6.java: Use diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/doc/conf/artifacts/winfo.xml --- a/flys-artifacts/doc/conf/artifacts/winfo.xml Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Fri Feb 03 13:49:16 2012 +0000 @@ -64,7 +64,7 @@ - + @@ -173,13 +173,24 @@ - - - - - + + + + + + + + + + + + + + + + @@ -190,11 +201,6 @@ - - - - - diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/doc/conf/themes.xml --- a/flys-artifacts/doc/conf/themes.xml Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/doc/conf/themes.xml Fri Feb 03 13:49:16 2012 +0000 @@ -602,6 +602,16 @@ + + + + + + + + + + @@ -958,5 +968,6 @@ + diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java Fri Feb 03 13:49:16 2012 +0000 @@ -685,19 +685,18 @@ } + /** Get reference (start) km. */ protected Double getReferenceStartKm() { - if (true) { - return FLYSUtils.getLocations(this)[0]; - } - - StateData sd = getData("reference_start"); + StateData sd = getData("reference.startpoint"); if (sd == null) { logger.warn("no reference start given."); return null; } - String input = (String)sd.getValue(); + logger.debug("Reference start km given: " + sd.getValue()); + + String input = (String) sd.getValue(); if (input == null | (input = input.trim()).length() == 0) { logger.warn("reference start string is empty."); @@ -714,18 +713,19 @@ return null; } + protected double [] getReferenceEndKms() { - StateData sd = getData("reference_end"); - - if(true) - return new double[] {getReferenceStartKm() + 2.0d}; + StateData sd = getData("reference.endpoint"); if (sd == null) { logger.warn("no reference end given."); return null; } + else { + logger.debug("Reference end km : " + sd.getValue()); + } - String input = (String)sd.getValue(); + String input = (String) sd.getValue(); if (input == null | (input = input.trim()).length() == 0) { logger.warn("reference end string is empty."); diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterLocationState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/EnterLocationState.java Fri Feb 03 13:49:16 2012 +0000 @@ -0,0 +1,53 @@ +package de.intevation.flys.artifacts.states; + +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; + +import org.hibernate.Session; +import org.hibernate.SQLQuery; +import org.hibernate.type.StandardBasicTypes; + +import de.intevation.flys.model.Gauge; +import de.intevation.flys.backend.SessionHolder; + +import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.utils.FLYSUtils; + + +/** + * Get me a double startpoint. + */ +public class EnterLocationState extends InputDoubleState { + + private static final Logger logger = + Logger.getLogger(EnterLocationState.class); + + + @Override + protected String getUIProvider() { + return "location_panel"; + } + + + @Override + protected Object getLower(FLYSArtifact flys) { + double[] lowerUpper = FLYSUtils.getRiverMinMax(flys); + + return lowerUpper != null + ? lowerUpper[0] + : 0; + } + + + @Override + protected Object getUpper(FLYSArtifact flys) { + double[] lowerUpper = FLYSUtils.getRiverMinMax(flys); + + return lowerUpper != null + ? lowerUpper[1] + : 0; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/InputDoubleState.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/InputDoubleState.java Fri Feb 03 13:49:16 2012 +0000 @@ -0,0 +1,39 @@ +package de.intevation.flys.artifacts.states; + +import org.apache.log4j.Logger; + +import de.intevation.flys.artifacts.FLYSArtifact; + + +/** + * State to keep a double value and validate it against a range + */ +public class InputDoubleState extends MinMaxState { + + private static final Logger logger = Logger.getLogger(InputDoubleState.class); + + + @Override + protected String getUIProvider() { + return "location_panel"; + } + + + @Override + protected Object getLower(FLYSArtifact flys) { + return 0; + } + + + @Override + protected Object getUpper(FLYSArtifact flys) { + return 0; + } + + + @Override + protected String getType() { + return "double"; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceCurveState.java Fri Feb 03 13:49:16 2012 +0000 @@ -13,10 +13,13 @@ import de.intevation.flys.artifacts.model.ReportFacet; import de.intevation.flys.artifacts.model.WW; +import de.intevation.flys.artifacts.resources.Resources; + import java.util.List; import org.apache.log4j.Logger; + public class ReferenceCurveState extends DefaultState implements FacetTypes @@ -52,8 +55,9 @@ WW [] wws = (WW [])res.getData(); for (int i = 0; i < wws.length; ++i) { - // TODO: Add data facets. - facets.add(new ReferenceCurveFacet(i, REFERENCE_CURVE, REFERENCE_CURVE)); + facets.add(new ReferenceCurveFacet(i, + REFERENCE_CURVE, + Resources.getMsg(context.getMeta(), REFERENCE_CURVE, REFERENCE_CURVE))); } if (wws.length > 0) { diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java --- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ReferenceCurveGenerator.java Fri Feb 03 13:49:16 2012 +0000 @@ -178,9 +178,9 @@ Document theme, boolean visible ) { - XYSeries series = new StyledXYSeries("TODO-RCG", theme); + ApplyFunctionIterator iter = (ApplyFunctionIterator) data; - ApplyFunctionIterator iter = (ApplyFunctionIterator)data; + XYSeries series = new StyledXYSeries(iter.getWW().getName(), theme); double [] values = new double[2]; diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/resources/messages.properties --- a/flys-artifacts/src/main/resources/messages.properties Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Fri Feb 03 13:49:16 2012 +0000 @@ -42,6 +42,8 @@ cross_section = Cross Section +reference_curve = Reference Curve + scenario.current = Current scenario.potentiel = Potentiel scenario.scenario = Scenario diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/resources/messages_de.properties --- a/flys-artifacts/src/main/resources/messages_de.properties Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Fri Feb 03 13:49:16 2012 +0000 @@ -42,6 +42,8 @@ cross_section = Querprofil +reference_curve = Bezugslinie + scenario.current = Aktuell scenario.potentiel = Potentiell scenario.scenario = Szenario diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/resources/messages_de_DE.properties --- a/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Fri Feb 03 13:49:16 2012 +0000 @@ -42,6 +42,8 @@ cross_section = Querprofil +reference_curve = Bezugslinie + scenario.current = Aktuell scenario.potentiel = Potentiell scenario.scenario = Szenario diff -r 40608c82e9cb -r c9c788eea200 flys-artifacts/src/main/resources/messages_en.properties --- a/flys-artifacts/src/main/resources/messages_en.properties Fri Feb 03 13:46:03 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Fri Feb 03 13:49:16 2012 +0000 @@ -40,6 +40,8 @@ cross_section = Cross Section +reference_curve = Reference Curve + scenario.current = Current scenario.potentiel = Potentiel scenario.scenario = Scenario