changeset 3974:22cd60315e08

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:45 +0200
parents 86106b4fc464 (diff) 69d19995bc3c (current diff)
children f68d6dcaea94
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/default-themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java
diffstat 167 files changed, 5888 insertions(+), 1300 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/ChangeLog	Fri Sep 28 12:15:45 2012 +0200
@@ -1,3 +1,479 @@
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java:
+	  Also add the artifact name to the artifact description.
+
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* doc/conf/conf.xml,
+	  src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/AbstractStaticStateArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java:
+	  Implement new Artifacts and State for displaying discharge curves at a
+	  gauge.
+
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/StaticState.java:
+	  Make addOuput public. Allow StaticArtifacts to add static outputs to the
+	  state.
+
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java:
+	  Add protected method addFacets to allow child classes to add facets
+	  without accessing the member variable.
+
+2012-09-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/meta-data.xml: Added 'info' column to the dem section of the
+	  datacage.
+
+2012-09-28	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Work on issue724 (i18n in minfo).
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  i18n strings.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java,
+	  src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java:
+	  Whitespace-cosmetics.
+
+	* src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java:
+	  Doc.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Work on issue724 (i18n in minfo).
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  i18n strings.
+
+	* src/main/java/de/intevation/flys/exports/MiddleBedHeightGenerator.java:
+	  Fix typo.
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java:
+	  Removed invalid entries of the SQL projection.
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java,
+	  Added more data fields from SedDB to calculate the fraction parts.
+
+	  src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java:
+	  Have now previous and next Measurement attached.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix part of issue871 (selected flow-veloc- parameter shown wrong).
+
+	* src/main/java/de/intevation/flys/artifacts/states/DischargeState.java:
+	  Fix conditional.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue863 (gaps in middle height bed data).
+
+	* src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java:
+	  Handle missing data.
+
+2012-09-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/wsplgen/FacetCreator.java: Set
+	  missing 'originalExtent' attribute of the WSPLGEN layer.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Towards fix issue863 (gaps in middle height bed data).
+
+	* src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightData.java
+	  (addAll): Do not expose single add*-Methods, instead always add a full
+	  set of data.
+	  Added new isEmpty-data and query it before exporting data as
+	  double[][] to e.g. ChartGenerator.
+	  
+	* src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java:
+	  Do not use single add()*-Methods, instead call new addAll method.
+	  Find out whether a gap-value is present.
+	  
+	* src/main/java/de/intevation/flys/exports/MiddleBedHeightGenerator.java:
+	  Prevent skipping of NaNs (gaps).
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java:
+	  Removed trailing whitespace.
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java
+	* src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java:
+	  Add more symbols.
+
+	* src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java:
+	  Adjust symbols.
+
+2012-09-26	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java:
+	Change createOutputModes method to be private. It is not used in a child
+	class.
+
+2012-09-26	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java:
+	  Mark FLYSArtifact data member as private and add setter method.
+
+2012-09-26	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml:
+	  Enable line labels for Delta W/t sector average lines (#896).
+
+2012-09-26  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/mapserver/db_layer.vm: Set initial projection of the database
+	  to "epsg:31467".
+
+	* doc/conf/mapserver/mapfile.vm: Set initial projection of the database to
+	  "epsg:31467". Set the max extent to the extent of the river Saar.
+
+	    TODO: Set the max extent to the extent of germany!
+
+	* src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSFloodmapsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSBuildingsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSGaugeLocationArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/MapArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java:
+	  Added a parameter "reproject" to the getExtent() method. If reproject is
+	  set, the method should return the extent of the layer in the projection
+	  that is specified for the relevant river in the configuration.
+	  Otherwise, this method should return the extent in the projection that
+	  is used by the database.
+
+	* src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java:
+	  Added new attributes and methods for the original extent of a layer. The
+	  original extent is used in the XML document that is generated by
+	  toXML().
+
+	* src/main/java/de/intevation/flys/exports/MapGenerator.java: Use the
+	  getOriginalExtent() method of WMSLayerFacet to determine the max extent
+	  for the map (maps should be in the river projection specified in the
+	  configuration).
+
+2012-09-26	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/artifacts/manualpoints.xml,
+	  doc/conf/themes.xml,
+	  src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
+	  src/main/java/de/intevation/flys/artifacts/FixationArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java,
+	  src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java:
+	  Rename fix_derivate facet to enable manual points in the derived curve chart.
+
+2012-09-25	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* doc/conf/artifacts/manualpoints.xml: Re-enable manualpoints
+	  compatibility.
+
+2012-09-24	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java:
+	  Fix for #825 ?
+
+2012-09-24  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java:
+	  Fixed SQL statement. Exclude data where km is null.
+
+2012-09-24	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java:
+	  Fixing analysis longitudinal section chart has now initially
+	  deactivated A1/B facets. W/Q and W(t) has activated facets. (#874)
+
+2012-09-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Remove info-url from gauge and river in the response and add official
+	  number to the river.
+
+2012-09-23	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java:
+	  W(Q) chart: q sectors are now black and labeled by default (#875).
+
+2012-09-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java:
+	  Cosmetics.
+
+2012-09-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java:
+	  Removed trailing whitespace.
+
+2012-09-23	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Themes and i18n of Delta W/t's A1/B facets (#876).
+
+2012-09-23	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/themes.xml,
+	  doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Add reference period facet to delta W/t chart (#877).
+
+2012-09-22	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java,
+	  src/main/java/de/intevation/flys/exports/XYChartGenerator.java:
+	  Longitudinal section chart does now respect the bounds of the drawn
+	  areas, so that no clipping occurs (#878).
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties:
+	  i18n corrections.
+
+2012-09-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java:
+	  Cosmetics, doc.
+
+2012-09-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java:
+	  Prevent ArrayIndexOutOfBounds.
+
+2012-09-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Document issue880 (extrapolation of wkms).
+
+	* src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java:
+	  Do not extrapolate, mention further issues with the code.
+
+2012-09-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java,
+	  src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java:
+	  Removed trailing whitespace.
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* 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 i18n strings for bedheight difference charts.
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* doc/conf/themes.xml,
+	  doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml:
+	  Added themes for bedheight difference charts.
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* doc/conf/meta-data.xml:
+	  Add river annotations to bedheight difference charts.
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearInfoGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDiffEpochInfoGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDiffYearInfoGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java:
+	  New. Chart generators for bedheight diff calculation charts.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java:
+	  Add facets to generate outputs.
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedDifferencesAccess.java:
+	  Extract calculation relevant data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java:
+	  Updated result set data fields.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffCalculation.java:
+	  Updated the bedheight difference calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
+	  Added new facet types.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java:
+	  New facets for bedheight differences.
+
+	* doc/conf/conf.xml:
+	  Added ouput generators.
+
+	* doc/conf/artifacts/minfo.xml:
+	  Added facets to outputmodes.
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeight.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightSingle.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightEpoch.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java:
+	  Updated data fields to fit the needs of bedheight difference calculation.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Return also the gauge official number in a service response.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Use Gauge and River fetchInfoURL instead of getInfoURL until the URLs are
+	  fetched from the db.
+
+2012-09-21	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue887 (HYKs in New Chart).
+
+	* src/main/java/de/intevation/flys/artifacts/HYKArtifact.java:
+	  Lower the Casting requirement to FLYSArtifact instead of
+	  WINFOArtifact.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Return also the gauge and river info-url in a service response.
+
+2012-09-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Fix issue886 (do not show waterline if out of range).
+
+	* src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Do not extrapolate waterlines.
+
+2012-09-21	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Better Partial issue880 (diverse DC).
+
+	* doc/conf/meta-data.xml: Remove double entry for annotations in
+	  longitudinal section case but keep recommending it.
+
+2012-09-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Partial issue880 (diverse DC).
+
+	* doc/conf/meta-data.xml: Remove double entry for annotations in
+	  longitudinal section case.
+
+2012-09-20	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java,
+	  src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java:
+	  Theme area transparency fixed for longitudinal section chart (#879).
+
+2012-09-20	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Improvements for manual points in fixation diags.
+
+	* doc/conf/artifacts/fixanalysis.xml: Add LS-manual points.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
+	  Add missing ChartTypes.
+
+2012-09-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffCalculation.java:
+	  New. Calcuation for bed height differences.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java:
+	  New. Bed height calculation results.
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedDifferencesAccess.java:
+	  New. Access object to get bed height difference parameters from artifact.
+
+2012-09-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java:
+	  Create separate objects for bed height epochs and single bed heights.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeight.java:
+	  Added morph. width.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightEpoch.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightSingle.java:
+	  New. Separate classes for bed height epochs and single bed heights.
+
+2012-09-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java:
+	  Add dates to csv header.
+
+2012-09-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* 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 i18n string for bed quality CSV export.
+
+2012-09-20	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/artifacts/manualpoints.xml,
+	  src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
+	  src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java,
+	  src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java:
+	  Work on manual points in fix analysis charts (not yet working).
+
 2012-09-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java:
@@ -152,6 +628,10 @@
 
 2012-09-17  Ingo Weinzierl <ingo@intevation.de>
 
+	Tagged RELEASE 2.9.1
+
+2012-09-17  Ingo Weinzierl <ingo@intevation.de>
+
 	* src/main/resources/messages.properties,
 	  src/main/resources/messages_de_DE.properties,
 	  src/main/resources/messages_en.properties,
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -172,6 +172,7 @@
                         <facet name="fix_analysis_periods_dwt" description="Dateranges of analysis periods."/>
                         <facet name="fix_deviation_dwt" description="The standard variance"/>
                         <facet name="fix_deltawt_curve.manualpoints" description="Manual points"/>
+                        <facet name="fix_reference_period_dwt" description="Reference period"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_longitudinal_section_curve" description="output.fix_longitudinal_section_curve" mine-type="image/png" type="chart">
@@ -193,7 +194,7 @@
                 </outputmode>
                 <outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart">
                     <facets>
-                        <facet name="fix_derivate" description="Derivate curve"/>
+                        <facet name="fix_derivate_curve" description="Derivate curve"/>
                         <facet name="fix_derivate_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
@@ -251,6 +252,7 @@
                         <facet name="other.wqkms" description="facet.other.wqkms"/>
                         <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"/>
                         <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                     </facets>
                 </outputmode>
--- a/flys-artifacts/doc/conf/artifacts/manualpoints.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/manualpoints.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -19,9 +19,9 @@
             <facet name="historical_discharge.manualpoints" description="Points provided by user." />
             <facet name="cross_section.manualline" description="Lines provided by user." />
             <facet name="fix_wq_curve.manualpoints" description="Points provided by user." />
-            <facet name="fix_deltawt_curve.manualpoints" description="Points provided by user." />
-            <facet name="fix_longitudinal_section_curve.manualpoints" description="Points provided by user." />
-            <facet name="fix_derivate_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_deltawt_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_longitudinal_section_curve.manualpoints" description="Points provided by user." />
+            <facet name="fix_derivate_curve.manualpoints" description="Points provided by user." />
           </facets>
         </outputmode>
       </outputmodes>
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -182,12 +182,27 @@
 
         <state id="state.minfo.bed.differences" description="state.minfo.bed.differences" state="de.intevation.flys.artifacts.states.minfo.DifferencesState" helpText="help.minfo.bed.differences">
             <outputmodes>
-                <outputmode name="absolute_height" description="output.absolute_height" mime-type="image/png" type="chart">
+                <outputmode name="bed_difference_height_year" description="output.absolute_height" mime-type="image/png" type="chart">
                     <facets>
+                        <facet name="bedheight_difference.height_year" description="A facet for absolute heights"/>
+                        <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                     </facets>
                 </outputmode>
-                <outputmode name="difference_year" description="output.difference_year" mime-type="img/png" type="chart">
+                <outputmode name="bed_difference_year" description="output.difference_year" mime-type="img/png" type="chart">
                     <facets>
+                        <facet name="bedheight_difference.year" description="A facet for bed height differences"/>
+                        <facet name="bedheight_difference.morph_width" description="A facet for morphologic width"/>
+                        <facet name="bedheight_difference.year.height1" description="A facet for raw heights."/>
+                        <facet name="bedheight_difference.year.height2" description="A facet for raw heights."/>
+                        <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
+                    </facets>
+                </outputmode>
+                <outputmode name="bed_difference_epoch" description="output.difference_epoch" mime-type="img/png" type="chart">
+                    <facets>
+                        <facet name="bedheight_difference.epoch" description="A facet for bed height differences"/>
+                        <facet name="bedheight_difference.epoch.height1" description="A facet for raw heights."/>
+                        <facet name="bedheight_difference.epoch.height2" description="A facet for raw heights."/>
+                        <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                     </facets>
                 </outputmode>
             </outputmodes>
--- a/flys-artifacts/doc/conf/conf.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/conf.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -121,6 +121,10 @@
             <artifact-factory name="bedheight" description="Factory to create an artifact used in minfo datacage."
                 ttl="3600000"
                 artifact="de.intevation.flys.artifacts.BedHeightsArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+
+            <artifact-factory name="gaugedischargecurve" description="Factory to create an artifact to show a discharge curve for a gauge."
+                ttl="3600000"
+                artifact="de.intevation.flys.artifacts.GaugeDischargeCurveArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
         </artifact-factories>
 
         <user-factory name="default" description="Factory to create new users">de.intevation.artifactdatabase.DefaultUserFactory</user-factory>
@@ -289,6 +293,12 @@
         <output-generator name="bed_longitudinal_section">de.intevation.flys.exports.minfo.BedQualityGenerator</output-generator>
         <output-generator name="bed_longitudinal_section_chartinfo">de.intevation.flys.exports.minfo.BedQualityInfoGenerator</output-generator>
         <output-generator name="bed_quality_export">de.intevation.flys.exports.minfo.BedQualityExporter</output-generator>
+        <output-generator name="bed_difference_year">de.intevation.flys.exports.minfo.BedDifferenceYearGenerator</output-generator>
+        <output-generator name="bed_difference_year_chartinfo">de.intevation.flys.exports.minfo.BedDiffYearInfoGenerator</output-generator>
+        <output-generator name="bed_difference_epoch">de.intevation.flys.exports.minfo.BedDifferenceEpochGenerator</output-generator>
+        <output-generator name="bed_difference_epoch_chartinfo">de.intevation.flys.exports.minfo.BedDiffEpochInfoGenerator</output-generator>
+        <output-generator name="bed_difference_height_year">de.intevation.flys.exports.minfo.BedDiffHeightYearGenerator</output-generator>
+        <output-generator name="bed_difference_height_year_chartinfo">de.intevation.flys.exports.minfo.BedDiffHeightYearInfoGenerator</output-generator>
         <output-generator name="sq_relation_a">de.intevation.flys.exports.sq.SQRelationGeneratorA</output-generator>
         <output-generator name="sq_relation_b">de.intevation.flys.exports.sq.SQRelationGeneratorB</output-generator>
         <output-generator name="sq_relation_c">de.intevation.flys.exports.sq.SQRelationGeneratorC</output-generator>
--- a/flys-artifacts/doc/conf/default-themes.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/default-themes.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -1144,6 +1144,73 @@
         </fields>
     </theme>
 
+    <!-- Bedheight differences -->
+    <theme name="BedheightDiffYear">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 204, 204" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffMorphWidth">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 204, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffEpoch">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 204" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffAbsHeight1">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 204" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffAbsHeight2">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="255, 100, 100" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffHeightYear">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 0" />
+        </fields>
+    </theme>
+
 
     <!-- FLOW VELOCITY -->
     <theme name="FlowVelocityVMainChannel">
@@ -1351,7 +1418,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0, 128, 0" />
             <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
@@ -1363,7 +1430,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0, 0, 255" />
             <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
@@ -1375,7 +1442,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="255, 0, 255" />
             <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
@@ -1387,7 +1454,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="255, 0, 0" />
             <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
@@ -1401,6 +1468,8 @@
         <fields>
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="true"/>
             <field name="showlines" type="boolean" default="false" />
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
@@ -1456,10 +1525,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 128, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS1">
@@ -1467,10 +1534,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS2">
@@ -1478,10 +1543,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS3">
@@ -1489,10 +1552,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 0, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSDeviation">
@@ -1500,10 +1561,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="100, 100, 100" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSAnalysis">
@@ -1544,12 +1603,22 @@
             <field name="backgroundcolor" type="Color" default="255, 0, 0" display="Füllfarbe" />
     	</fields>
     </theme>
+    
+    <theme name="FixingReferencePeriod">
+        <inherits>
+    		<inherit from="Areas"/>
+    	</inherits>
+    	<fields>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
+            <field name="backgroundcolor" type="Color" default="0, 0, 255" display="Füllfarbe" />
+    	</fields>
+    </theme>
 
     <theme name="QSectors">
         <fields>
-            <field name="linecolor" type="Color" default="227, 27, 162" />
+            <field name="linecolor" type="Color" default="0, 0, 0" />
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linetype" type="Dash" display="Linienart"
                 default="10" hidden="true" />
             <field name="linesize" type="int" display="Liniendicke"
--- a/flys-artifacts/doc/conf/mapserver/db_layer.vm	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/mapserver/db_layer.vm	Fri Sep 28 12:15:45 2012 +0200
@@ -22,7 +22,7 @@
     #end
 
     PROJECTION
-        "init=epsg:$LAYER.getSrid()"
+        "init=epsg:31467"
     END
 
     METADATA
--- a/flys-artifacts/doc/conf/mapserver/mapfile.vm	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/mapserver/mapfile.vm	Fri Sep 28 12:15:45 2012 +0200
@@ -3,14 +3,14 @@
     STATUS ON
     SIZE 600 400
     MAXSIZE 4000
-    EXTENT -90 -180 90 180
+    EXTENT 3233232.55407617 5303455.37850183 3421524.44644752 5585825.50888523
     UNITS DD
     SHAPEPATH "$SHAPEFILEPATH"
     FONTSET "$CONFIGDIR/mapserver/fontset.txt"
     SYMBOLSET "$CONFIGDIR/mapserver/symbols.sym"
     IMAGECOLOR 255 255 255
     PROJECTION
-        "init=epsg:31466"
+        "init=epsg:31467"
     END
 
     DEBUG 5
--- a/flys-artifacts/doc/conf/meta-data.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -606,6 +606,15 @@
                <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')">
                  <dc:call-macro name="annotations"/>
                </dc:if>
+               <dc:if test="dc:contains($artifact-outs, 'bed_difference_epoch')">
+                 <dc:call-macro name="annotations"/>
+               </dc:if>
+               <dc:if test="dc:contains($artifact-outs, 'bed_difference_year')">
+                 <dc:call-macro name="annotations"/>
+               </dc:if>
+               <dc:if test="dc:contains($artifact-outs, 'bed_difference_height_year')">
+                 <dc:call-macro name="annotations"/>
+               </dc:if>
             </dc:when>
             <dc:otherwise>
               <dc:comment>
@@ -641,7 +650,6 @@
                  <dc:call-macro name="basedata_4_heightmarks-points"/>
                  <dc:comment comment=" AMTL LINIEN  ---------------------------"/>
                  <dc:call-macro name="basedata_3_officials"/>
-                 <dc:call-macro name="annotations"/>
               </dc:if>
                <dc:if test="dc:contains($artifact-outs, 'reference_curve')">
                  <dc:call-macro name="annotations"/>
@@ -797,12 +805,13 @@
               </discharge_table_nn>
           </dc:if>
 
-          <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
+          <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
 
-              <longitudinal_section>
-                <dc:call-macro name="annotations"/>
-              </longitudinal_section>
-          </dc:if>
+              <longitudinal_section>
+                <dc:call-macro name="annotations"/>
+              </longitudinal_section>
+          </dc:if>
+
           <dc:if test="dc:contains($artifact-outs, 'map')">
               <map>
               <dc:choose>
@@ -851,14 +860,17 @@
                     <dc:statement>
                       SELECT id    AS dem_id,
                              lower AS dem_lower,
-                             upper AS dem_upper
+                             upper AS dem_upper,
+                             name AS name,
+                             projection || ' | ' || year_from || ' - ' || year_to AS info
                       FROM dem WHERE river_id = ${river_id}
                     </dc:statement>
                     <dc:elements>
                         <dem>
                           <dc:attribute name="factory" value="demfactory"/>
                           <dc:attribute name="ids" value="${dem_id}"/>
-                          <dc:attribute name="description" value="${dem_lower}-${dem_upper}"/>
+                          <dc:attribute name="name" value="${name}"/>
+                          <dc:attribute name="info" value="${info}"/>
                         </dem>
                     </dc:elements>
                   </dc:context>
--- a/flys-artifacts/doc/conf/second-themes.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/second-themes.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -1066,7 +1066,74 @@
         </fields>
     </theme>
     
-    
+    <!-- Bedheight differences -->
+    <theme name="BedheightDiffYear">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 204, 204" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffMorphWidth">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 204, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffEpoch">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffAbsHeight1">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffAbsHeight2">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="100, 255, 100" />
+        </fields>
+    </theme>
+
+    <theme name="BedheightDiffHeightYear">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+            <inherit from="MinMaxPoints" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="204, 0, 100" />
+        </fields>
+    </theme>
+
+
     <!-- Bed Quality -->
     <theme name="PorosityTopLayer">
     	<inherits>
@@ -1353,7 +1420,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0, 128, 128" />
             <field name="linesize" type="int" display="Liniendicke"
@@ -1367,7 +1434,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="128, 0, 255" />
             <field name="linesize" type="int" display="Liniendicke"
@@ -1381,7 +1448,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="255, 128, 255" />
             <field name="linesize" type="int" display="Liniendicke"
@@ -1395,7 +1462,7 @@
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
+                display="Beschriftung anzeigen" default="true" hints="h" />
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="255, 0, 0" />
             <field name="linesize" type="int" display="Liniendicke"
@@ -1412,6 +1479,8 @@
         <fields>
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="true" />
             <field name="showlines" type="boolean" default="false" />
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
@@ -1467,10 +1536,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="0, 128, 64" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS1">
@@ -1478,10 +1545,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="64, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS2">
@@ -1489,10 +1554,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 64, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS3">
@@ -1500,10 +1563,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
                 default="255, 64, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
         </fields>
     </theme>
     <theme name="FixLSDeviation">
@@ -1554,6 +1615,16 @@
     		<field name="transparency" type="int" default="90" display="Transparenz"/>
     	</fields>
     </theme>
+    
+    <theme name="FixingReferencePeriod">
+        <inherits>
+    		<inherit from="Areas"/>
+    	</inherits>
+    	<fields>
+    		<field name="transparency" type="int" default="70" display="Transparenz"/>
+            <field name="backgroundcolor" type="Color" default="0, 128, 200" display="Füllfarbe" />
+    	</fields>
+    </theme>
 
     <theme name="QSectors">
         <fields>
--- a/flys-artifacts/doc/conf/themes.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/doc/conf/themes.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -196,6 +196,14 @@
 		<mapping from="bed_longitudinal_section.bed_diameter_toplayer" to="BedDiameterTopLayer" />
 		<mapping from="bed_longitudinal_section.bed_diameter_sublayer" to="BedDiameterSubLayer" />
 		<mapping from="bed_longitudinal_section.bedload_diameter" to="BedLoadDiameter" />
+		<mapping from="bedheight_difference.year" to="BedheightDiffYear"/>
+		<mapping from="bedheight_difference.morph_width" to="BedheightDiffMorphWidth"/>
+		<mapping from="bedheight_difference.epoch" to="BedheightDiffEpoch"/>
+		<mapping from="bedheight_difference.year.height1" to="BedheightDiffAbsHeight1"/>
+		<mapping from="bedheight_difference.year.height2" to="BedheightDiffAbsHeight2"/>
+		<mapping from="bedheight_difference.epoch.height1" to="BedheightDiffAbsHeight1"/>
+		<mapping from="bedheight_difference.epoch.height2" to="BedheightDiffAbsHeight2"/>
+		<mapping from="bedheight_difference.height_year" to="BedheightDiffHeightYear"/>
 		<mapping from="relativepoint" to="RelativePoint" />
 		<mapping from="sq_a_measurement" to="SQMeasurements" />
 		<mapping from="sq_a_outlier" to="SQOutliers" />
@@ -242,6 +250,7 @@
 		<mapping from="fix_analysis_events_dwt" to="FixingDeltaWtAnalysis" />
 		<mapping from="fix_analysis_periods_dwt" to="FixingDeltaWtAnalysisPeriods" />
 		<mapping from="fix_reference_events_dwt" to="FixingReferenceEvents" />
+        <mapping from="fix_reference_period_dwt" to="FixingReferencePeriod" />
 		<mapping from="fix_sector_average_ls_deviation_0" to="FixingSectorDeviationLS0" />
 		<mapping from="fix_sector_average_ls_deviation_1" to="FixingSectorDeviationLS1" />
 		<mapping from="fix_sector_average_ls_deviation_2" to="FixingSectorDeviationLS2" />
@@ -254,8 +263,8 @@
 		<mapping from="fix_deviation_dwt" to="FixDeltaWtDeviation" />
 		<mapping from="fix_analysis_events_ls" to="FixLSAnalysis" />
 		<mapping from="fix_reference_events_ls" to="FixLSReference" />
-		<mapping from="fix_derivate" to="FixingDerivedCurve" />
-		<mapping from="fix_derivate.manualpoints" to="ManualPoints" />
+		<mapping from="fix_derivate_curve" to="FixingDerivedCurve" />
+		<mapping from="fix_derivate_curve.manualpoints" to="ManualPoints" />
 		<mapping from="qsectors" to="QSectors" />
 	</mappings>
 </themes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/AbstractStaticStateArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,69 @@
+package de.intevation.flys.artifacts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import de.intevation.artifactdatabase.state.State;
+
+/**
+ * A abstract baseclass for Artifacts which are using only one static state.
+ *
+ * This class is intended to be used without the config/stateengine to generate
+ * the static state.
+ *
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public abstract class AbstractStaticStateArtifact extends StaticFLYSArtifact {
+
+    private transient State staticstate;
+
+    /**
+     * Get a list containing the one and only State.
+     * @param  context ignored.
+     * @return list with one and only state.
+     */
+    @Override
+    protected List<State> getStates(Object context) {
+        ArrayList<State> states = new ArrayList<State>();
+        states.add(getStaticState());
+        return states;
+    }
+
+
+    /**
+     * Get the "current" state.
+     * @param cc ignored.
+     * @return always the set static state.
+     */
+    @Override
+    public State getCurrentState(Object cc) {
+        return getStaticState();
+    }
+
+    /**
+     * A child class must override this method to set its static state
+     */
+    protected abstract void initStaticState();
+
+    protected void setStaticState(State state) {
+        this.staticstate = state;
+    }
+
+    protected State getStaticState() {
+        if (staticstate == null) {
+            initStaticState();
+        }
+        return staticstate;
+    }
+
+    /**
+     * Get the state.
+     * @param context ignored.
+     * @param stateID ignored.
+     * @return the state.
+     */
+    @Override
+    protected State getState(Object context, String stateID) {
+        return getStaticState();
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,5 +1,25 @@
 package de.intevation.flys.artifacts;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.xml.xpath.XPathConstants;
+
+import net.sf.ehcache.Cache;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
 import de.intevation.artifactdatabase.ArtifactDatabaseImpl;
 import de.intevation.artifactdatabase.DefaultArtifact;
 import de.intevation.artifactdatabase.ProtocolUtils;
@@ -29,26 +49,6 @@
 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
 import de.intevation.flys.utils.FLYSUtils;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
-
-import javax.xml.xpath.XPathConstants;
-
-import net.sf.ehcache.Cache;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
 /**
  * The default FLYS artifact with convenience added.
  * (Subclass to get fully functional artifacts).
@@ -92,7 +92,7 @@
     protected String name;
 
     /** The data that have been inserted into this artifact. */
-    protected Map<String, StateData> data;
+    private Map<String, StateData> data;
 
     /** Mapping of state names to created facets. */
     protected Map<String, List<Facet>> facets;
@@ -189,7 +189,7 @@
         String name = getName();
 
         if (debug) {
-            log.debug("Set initial state for artifact '" + name + "'");
+            log.debug("setup(): Set initial state for artifact '" + name + "'");
         }
 
         if (states == null) {
@@ -757,6 +757,12 @@
         return data.get(name);
     }
 
+    /**
+     * A derived Artifact class can use this method to set the data
+     */
+    protected void setData(Map<String, StateData> data) {
+        this.data = data;
+    }
 
     /** Return named data item, null if not found. */
     public String getDataAsString(String name) {
@@ -869,7 +875,10 @@
         addData(name, new DefaultStateData(name, null, null, value));
     }
 
-
+    /**
+     * This method returns all stored StateData in this artifact as a Collection
+     * @return a Collection of all StateData objects in this artifact
+     */
     public Collection<StateData> getAllData() {
         return data.values();
     }
@@ -1387,12 +1396,24 @@
                     facets.remove(stateID);
                 }
                 else {
-                    facets.put(stateID, fs);
+                    addFacets(stateID, fs);
                 }
             }
         }
     }
 
+    /**
+     * Sets the facets for an ID
+     *
+     * Normally the id is a state ID.
+     *
+     * @param id ID to map the facets to
+     * @param facets List of facets to be stored
+     */
+    protected void addFacets(String id, List<Facet> facets) {
+        this.facets.put(id, facets);
+    }
+
 
     /**
      * Method to dump the artifacts state/data.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -20,6 +20,7 @@
      * The default constructor.
      */
     public FixationArtifact() {
+        logger.debug("ctor()");
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/GaugeDischargeCurveArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,99 @@
+package de.intevation.flys.artifacts;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
+import de.intevation.artifactdatabase.state.DefaultOutput;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.artifacts.common.ArtifactNamespaceContext;
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.flys.artifacts.states.StaticState;
+import de.intevation.flys.artifacts.StaticFLYSArtifact;
+import de.intevation.flys.artifacts.model.GaugeDischargeCurveFacet;
+
+import de.intevation.flys.model.Gauge;
+
+import de.intevation.flys.utils.FLYSUtils;
+
+/**
+ * Artifact to calculate a discharge curve from a gauge overview info
+ *
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class GaugeDischargeCurveArtifact
+extends      AbstractStaticStateArtifact
+{
+
+    private static final Logger logger =
+        Logger.getLogger(GaugeDischargeCurveArtifact.class);
+
+    public static final String XPATH_RIVER = "/art:action/art:river/@name";
+    public static final String XPATH_GAUGE = "/art:action/art:gauge/@reference";
+    public static final String NAME = "gaugedischargecurve";
+    public static final String STATIC_STATE_NAME = "state.gaugedischargecurve.static";
+
+    /**
+     * Setup initializes the data by extracting the river and gauge from
+     * the XML Document.
+     */
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        callmeta,
+        Document        data)
+    {
+        logger.debug("GaugeDischargeCurveArtifact.setup");
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("GaugeDischargeCurveState.setup" + XMLUtils.toString(data));
+        }
+        String gaugeref = XMLUtils.xpathString(data, XPATH_GAUGE,
+                ArtifactNamespaceContext.INSTANCE);
+        String rivername = XMLUtils.xpathString(data, XPATH_RIVER,
+                ArtifactNamespaceContext.INSTANCE);
+
+        addStringData("river", rivername);
+        addStringData("reference_gauge", gaugeref);
+
+        Gauge gauge = FLYSUtils.getReferenceGauge(this);
+
+        Facet gfacet = new GaugeDischargeCurveFacet(rivername, gauge);
+
+        List<Facet> fs = new ArrayList<Facet>(1);
+        fs.add(gfacet);
+
+        addFacets(STATIC_STATE_NAME, fs);
+
+        super.setup(identifier, factory, context, callmeta, data);
+    }
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    protected void initStaticState() {
+        StaticState state = new StaticState(STATIC_STATE_NAME);
+        List<Facet> fs = facets.get(STATIC_STATE_NAME);
+        DefaultOutput output = new DefaultOutput(
+            "discharge_curve",
+            "output.discharge_curve", "image/png",
+            fs,
+            "chart");
+
+        state.addOutput(output);
+        setStaticState(state);
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -105,8 +105,7 @@
         CallMeta callMeta)
     {
         logger.debug("HYKArtifact.initialize");
-        WINFOArtifact winfo = (WINFOArtifact) artifact;
-        importData(winfo, "river");
+        importData((FLYSArtifact)artifact, "river");
 
         List<Facet> fs = new ArrayList<Facet>();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -174,7 +174,8 @@
             String name = type + "-" + artifact.identifier();
 
             facet.addLayer(name);
-            facet.setExtent(getExtent());
+            facet.setExtent(getExtent(false));
+            facet.setOriginalExtent(getExtent(true));
             facet.setSrid(getSrid());
             facet.setData(getDataString());
             facet.setFilter(getFilter());
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -119,11 +119,20 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             River river = RiverFactory.getRiver(getRiverId());
-            return GeometryUtils.transform(
-                GeometryUtils.getRiverBoundary(river.getName()),
-                getSrid());
+
+            if (reproject) {
+                logger.debug("Query extent for RiverAxis with Srid: " + getSrid());
+                return GeometryUtils.transform(
+                    GeometryUtils.getRiverBoundary(river.getName()),
+                    getSrid());
+            }
+            else {
+                return GeometryUtils.transform(
+                    GeometryUtils.getRiverBoundary(river.getName()),
+                    "31467");
+            }
         }
 
         @Override
@@ -133,13 +142,11 @@
 
         @Override
         protected String getDataString() {
-            String srid = getSrid();
-
             if (FLYSUtils.isUsingOracle()) {
-                return "geom FROM river_axes USING SRID " + srid;
+                return "geom FROM river_axes";
             }
             else {
-                return "geom FROM river_axes USING UNIQUE id USING SRID " + srid;
+                return "geom FROM river_axes USING UNIQUE id";
             }
         }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -50,11 +50,18 @@
         Element root = ProtocolUtils.createRootNode(creator);
         desc.appendChild(root);
 
+        Element name = ProtocolUtils.createArtNode(
+            creator, "name",
+            new String[] { "value" },
+            new String[] { getName() });
+
+        root.appendChild(name);
+
         ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash());
         root.appendChild(createOutputModes(cc, desc, creator));
 
         // Add the data to an anonymous state.
-        Collection<StateData> datas = this.data.values();
+        Collection<StateData> datas = getAllData();
         if (datas.size() > 0) {
             Element ui = creator.create("ui");
             Element staticE = creator.create("static");
@@ -90,7 +97,7 @@
     }
 
 
-    protected Element createOutputModes(
+    private Element createOutputModes(
         CallContext    cc,
         Document       doc,
         ElementCreator creator)
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -303,12 +303,36 @@
      * @return W in wkms that is closer to km than to next and prev, or Double.NaN.
      */
     public double getWAtCloseKm(WKms wkms, double km, double next, double prev) {
+        // TODO symbolic "-1" pr next/prev is a bad idea (tm), as we compare
+        //      distances to these values later.
+        // TODO issue888
+
         int size = wkms.size();
         for (int i = 0; i < size; i++) {
             double wkmsKm = wkms.getKm(i);
             double dist = Distance.distance(wkmsKm, km);
-            if ((prev == -1d || dist <= Distance.distance(wkmsKm, prev))
-                && (next == -1d || dist <= Distance.distance(wkmsKm, next))) {
+            if (dist == 0d) {
+                return wkms.getW(i);
+            }
+
+            // Problematic Cases:
+            // X == km , | and | == prev and next, (?) == wkmsKm
+            //
+            // Standard case:
+            // ----------|----X-----|-------
+            //     (1)    (2)    (3)   (4)
+            //
+            // With prev==-1
+            // -1 ------X-------|------
+            //    (5)      (6)     (7)
+            //
+            // With next==-1
+            //
+            // ---|-----X----- -1
+            // (8)  (9)   (10)
+
+            if (dist <= Distance.distance(wkmsKm, prev)
+                && dist <= Distance.distance(wkmsKm, next)) {
                 return wkms.getW(i);
             }
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -647,18 +647,28 @@
         // Find W at km, linear naive approach.
         WQKms triple = wqkms[idx];
 
-        int old_idx = 0;
-
         if (triple.size() == 0) {
             logger.warn("Calculation of waterline is empty.");
             return Lines.createWaterLines(points, 0.0f);
         }
 
+        // Early abort if we would need to extrapolate.
+        int T = triple.size();
+        double max_km = triple.getKm(T-1), min_km = triple.getKm(0);
+        if (wishKM < min_km || wishKM > max_km) {
+            // TODO Does this have to be done in the other WaterlineArtifact
+            //      implementations, too?
+            logger.warn("Will not extrapolate waterlevels.");
+            return Lines.createWaterLines(points, 0.0f);
+        }
+
+        int old_idx = 0;
+
         // Linear seach in WQKms for closest km.
         double old_dist_wish = Math.abs(wishKM - triple.getKm(0));
         double last_w = triple.getW(0);
 
-        for (int i = 0, T = triple.size(); i < T; i++) {
+        for (int i = 0; i < T; i++) {
             double diff = Math.abs(wishKM - triple.getKm(i));
             if (diff > old_dist_wish) {
                 break;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSBuildingsArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSBuildingsArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -101,7 +101,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Building> buildings =
                 Building.getBuildings(getRiverId(), getName());
 
@@ -118,7 +118,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -117,7 +117,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Catchment> catchments =
                 Catchment.getCatchments(getRiverId(), getName());
 
@@ -134,7 +134,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -43,6 +43,9 @@
     public static final Pattern DB_URL_PATTERN =
         Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z]+)");
 
+    public static final Pattern DB_PSQL_URL_PATTERN =
+        Pattern.compile("(.*)\\/\\/(.*):([0-9]+)\\/([a-zA-Z0-9]+)");
+
 
     @Override
     public void setup(
@@ -148,6 +151,7 @@
 
             facet.addLayer(name);
             facet.setExtent(getExtent());
+            facet.setOriginalExtent(getExtent(true));
             facet.setSrid(getSrid());
             facet.setData(getDataString());
             facet.setFilter(getFilter());
@@ -179,8 +183,10 @@
 
             Matcher m = DB_URL_PATTERN.matcher(url);
             if (!m.matches()) {
-                logger.warn("Could not parse Connection string.");
-                return null;
+                logger.warn("Could not parse Connection string." +
+                	"Try to parse PostgreSQL string.");
+                // maybe this is a PostgreSQL connection...
+                return getPostgreSQLConnection();
             }
 
             logger.debug("Groups for connection string: " + m.groupCount());
@@ -228,6 +234,55 @@
             return connection;
         }
 
+        protected String getPostgreSQLConnection() {
+            SessionFactoryImpl sf = (SessionFactoryImpl)
+                SessionFactoryProvider.getSessionFactory();
+
+            String user = SessionFactoryProvider.getUser(sf);
+            String pass = SessionFactoryProvider.getPass(sf);
+            String url  = SessionFactoryProvider.getURL(sf);
+
+            Matcher m = DB_PSQL_URL_PATTERN.matcher(url);
+            if (!m.matches()) {
+                logger.warn("Could not parse PostgreSQL Connection string.");
+                return null;
+            }
+
+            int groups = m.groupCount();
+            logger.debug("Groups for PostgreSQL connection string: " + groups);
+
+            if (logger.isDebugEnabled()) {
+                for (int i = 0; i <= groups; i++) {
+                    logger.debug("Group " + i + ": " + m.group(i));
+                }
+            }
+
+            String connection = null;
+
+            if (groups < 4) {
+                logger.warn("Could only partially parse connection string.");
+                return null;
+            }
+
+            String host = m.group(2);
+            String port = m.group(3);
+            String db   = m.group(4);
+
+            StringBuilder sb = new StringBuilder();
+            sb.append("dbname=" + db);
+            sb.append(" host='" + host + "'");
+            sb.append(" port=" + port);
+            sb.append(" user=" + user);
+            sb.append(" password='" + pass + "'");
+            sb.append(" sslmode=disable");
+
+            connection = sb.toString();
+
+            logger.debug("Created connection: '" + connection + "'");
+
+            return connection;
+        }
+
         protected String getConnectionType() {
             return FLYSUtils.isUsingOracle() ? "oraclespatial" : "postgis";
         }
@@ -310,6 +365,16 @@
             }
         }
 
+        /**
+         * This method returns the extent of a DB layer in the projection of the
+         * database.
+         *
+         * @return the extent of the DB layer in the projection of the database.
+         */
+        protected Envelope getExtent() {
+            return getExtent(false);
+        }
+
 
         protected abstract String getFacetType();
 
@@ -317,7 +382,19 @@
 
         protected abstract String getSrid();
 
-        protected abstract Envelope getExtent();
+        /**
+         * This method returns the extent of the DB layer. The projection of the
+         * extent depends on the <i>reproject</i> parameter. If reproject is set,
+         * the extent is reprojected into the original projection which is
+         * specified in the configuration. Otherwise, the projection of the
+         * database is used.
+         *
+         * @param reproject True, to reproject the extent into the projection
+         * specified in the configuration.
+         *
+         * @return the extent of the database layer.
+         */
+        protected abstract Envelope getExtent(boolean reproject);
 
         protected abstract String getFilter();
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -101,7 +101,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Fixpoint> fixpoints = Fixpoint.getFixpoints(getRiverId());
 
             Envelope max = null;
@@ -117,7 +117,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodmapsArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodmapsArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -101,7 +101,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Floodmaps> floodmaps =
                 Floodmaps.getFloodmaps(getRiverId(), getName());
 
@@ -118,7 +118,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -120,13 +120,15 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             River      river = getRiver();
             Floodplain plain = Floodplain.getFloodplain(river.getName());
 
-            return GeometryUtils.transform(
-                plain.getGeom().getEnvelopeInternal(),
-                getSrid());
+            Envelope e = plain.getGeom().getEnvelopeInternal();
+
+            return e != null && reproject
+                ? GeometryUtils.transform(e, getSrid())
+                : e;
         }
 
         @Override
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSGaugeLocationArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSGaugeLocationArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -103,7 +103,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<GaugeLocation> gauges =
                 GaugeLocation.getGaugeLocations(getRiverId(), getName());
 
@@ -120,7 +120,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -117,7 +117,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Hws> hws = Hws.getHws(getRiverId(), getName());
 
             Envelope max = null;
@@ -133,7 +133,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -101,7 +101,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<HydrBoundary> boundaries = HydrBoundary.getHydrBoundaries(
                 getRiverId(), getName());
 
@@ -118,7 +118,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -101,7 +101,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<HydrBoundaryPoly> boundaries = HydrBoundaryPoly.getHydrBoundaries(
                 getRiverId(), getName());
 
@@ -118,7 +118,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -118,7 +118,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<RiverAxisKm> kms = RiverAxisKm.getRiverAxisKms(getRiverId());
 
             Envelope max = null;
@@ -134,7 +134,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -117,7 +117,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             List<Line> lines = Line.getLines(getRiverId(), getName());
 
             Envelope max = null;
@@ -133,7 +133,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -116,7 +116,7 @@
         }
 
         @Override
-        protected Envelope getExtent() {
+        protected Envelope getExtent(boolean reproject) {
             River river = RiverFactory.getRiver(getRiverId());
 
             List<CrossSectionTrack> qps =
@@ -135,7 +135,7 @@
                 max.expandToInclude(env);
             }
 
-            return max != null
+            return max != null && reproject
                 ? GeometryUtils.transform(max, getSrid())
                 : max;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -88,7 +88,7 @@
         CallMeta meta)
     {
         WINFOArtifact winfo = (WINFOArtifact) artifact;
-        this.data = winfo.cloneData();
+        setData(winfo.cloneData());
         logger.debug("Cloned data of winfo artifact.");
         // Statically add Facets.
         List<Facet> fs = new ArrayList<Facet>();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedDifferencesAccess.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,52 @@
+package de.intevation.flys.artifacts.access;
+
+import java.util.Arrays;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.utils.FLYSUtils;
+import de.intevation.flys.utils.StringUtil;
+
+
+public class BedDifferencesAccess
+extends RiverAccess
+{
+    private static Logger logger = Logger.getLogger(BedDifferencesAccess.class);
+    private String yearEpoch;
+    private String[] diffs;
+
+    private CallContext context;
+
+    public BedDifferencesAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact);
+        this.context = context;
+    }
+
+    public String getYearEpoch() {
+        yearEpoch = getString("ye_select");
+        return yearEpoch;
+    }
+
+    public FLYSArtifact[][] getDifferenceArtifacts() {
+        diffs = getString("diffids").split("#");
+        logger.debug("diffs: " + Arrays.toString(diffs));
+        FLYSArtifact[][] artifacts = new FLYSArtifact[diffs.length/2][2];
+        for (int i = 0; i < diffs.length; i += 2) {
+            String diff1 = StringUtil.unbracket(diffs[0 + 2*i]);
+            String diff2 = StringUtil.unbracket(diffs[1 + 2*i]);
+            String[] diff1parts = diff1.split(";");
+            String[] diff2parts = diff2.split(";");
+            logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]);
+            artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context);
+            artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[0], context);
+        }
+        return artifacts;
+    }
+
+    public static int getHeightId(FLYSArtifact artifact) {
+        Access a = new Access(artifact);
+        return a.getInteger("height_id");
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Fri Sep 28 12:15:45 2012 +0200
@@ -3,6 +3,7 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 
+/** Access to data that deals with flow velocity stuff. */
 public class FlowVelocityAccess extends RiverAccess {
 
     private int[] mainChannels;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 28 12:15:45 2012 +0200
@@ -104,6 +104,7 @@
     };
 
     public enum ChartType {
+        FD("fix_derivate_curve"),
         LS("longitudinal_section"),
         CS("cross_section"),
         DLS("discharge_longitudinal_section"),
@@ -113,6 +114,10 @@
         RC("reference_curve"),
         RCN("reference_curve_normalized"),
         WD("wdifferences"),
+        FWQC("fix_wq_curve"),
+        FDWC("fix_deltawt_curve"),
+        FLSC("fix_longitudinal_section_curve"),
+        FDC("fix_derivate_curve"),
         HD("historical_discharge");
 
         private String chartTypeString;
@@ -121,6 +126,7 @@
             this.chartTypeString = description;
         }
 
+        @Override
         public String toString() {
             return chartTypeString;
         }
@@ -223,6 +229,15 @@
     String BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER = "bed_longitudinal_section.sediment_density_sublayer";
     String BED_QUALITY_BEDLOAD_DIAMETER          = "bed_longitudinal_section.bedload_diameter";
 
+    String BED_DIFFERENCE_YEAR          = "bedheight_difference.year";
+    String BED_DIFFERENCE_HEIGHT_YEAR   = "bedheight_difference.height_year";
+    String BED_DIFFERENCE_EPOCH         = "bedheight_difference.epoch";
+    String BED_DIFFERENCE_MORPH_WIDTH   = "bedheight_difference.morph_width";
+    String BED_DIFFERENCE_YEAR_HEIGHT1  = "bedheight_difference.year.height1";
+    String BED_DIFFERENCE_YEAR_HEIGHT2  = "bedheight_difference.year.height2";
+    String BED_DIFFERENCE_EPOCH_HEIGHT1 = "bedheight_difference.epoch.height1";
+    String BED_DIFFERENCE_EPOCH_HEIGHT2 = "bedheight_difference.epoch.height2";
+
     String SQ_OVERVIEW       = "sq_overview";
 
     String SQ_A_CURVE       = "sq_a_curve";
@@ -270,7 +285,9 @@
     String FIX_REFERENCE_EVENTS_DWT = "fix_reference_events_dwt";
     String FIX_REFERENCE_EVENTS_LS = "fix_reference_events_ls";
     String FIX_REFERENCE_EVENTS_WQ = "fix_reference_events_wq";
+    String FIX_REFERENCE_PERIOD_DWT = "fix_reference_period_dwt";
 
+    // Note that AVERAGE_DWT will get a postfix (e.g. ..._dwt_1)
     String FIX_SECTOR_AVERAGE_DWT = "fix_sector_average_dwt";
     String FIX_SECTOR_AVERAGE_LS = "fix_sector_average_ls";
     String FIX_SECTOR_AVERAGE_WQ = "fix_sector_average_wq";
@@ -283,7 +300,7 @@
     String FIX_ANALYSIS_PERIODS_LS = "fix_analysis_periods_ls";
     String FIX_ANALYSIS_PERIODS_WQ = "fix_analysis_periods_wq";
 
-    String FIX_DERIVATE = "fix_derivate";
+    String FIX_DERIVATE_CURVE = "fix_derivate_curve";
 
     String FIX_DEVIATION_DWT = "fix_deviation_dwt";
     String FIX_DEVIATION_LS = "fix_deviation_ls";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/GaugeDischargeCurveFacet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,57 @@
+package de.intevation.flys.artifacts.model;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.artifactdatabase.state.DefaultFacet;
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.flys.artifacts.model.WQKms;
+
+import de.intevation.flys.model.Gauge;
+
+/**
+ * A Facet that returns discharge curve data at a gauge
+ *
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class GaugeDischargeCurveFacet
+extends      DefaultFacet
+{
+    private Gauge gauge;
+    private String river;
+
+    public GaugeDischargeCurveFacet(String river, Gauge gauge) {
+        super(0, "facet.gauge.discharge_curve", "facet.gauge.discharge_curve");
+        this.river = river;
+        this.gauge = gauge;
+    }
+
+    @Override
+    public Object getData(Artifact art, CallContext context) {
+
+        DischargeTables dt = new DischargeTables(river, gauge.getName());
+
+        Map<String, double [][]> map = dt.getValues(100d);
+
+        double [][] values = map.get(name);
+        if (values == null) {
+            return null;
+        }
+        double [] kms = new double[values[0].length];
+        Arrays.fill(kms, gauge.getStation().doubleValue());
+        return new WQKms(kms, values[0], values[1], gauge.getName());
+    }
+
+    @Override
+    public Facet deepCopy() {
+        GaugeDischargeCurveFacet copy =
+            new GaugeDischargeCurveFacet(this.river, this.gauge);
+        copy.set(this);
+        return copy;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java	Fri Sep 28 12:15:45 2012 +0200
@@ -63,7 +63,7 @@
                 singles.add(s);
             }
             else {
-                logger.warn("Cannot find Sngle by id: " + id);
+                logger.warn("Cannot find Single by id: " + id);
                 // TODO ADD WARNING
             }
         }
@@ -95,7 +95,7 @@
 
 
     protected CalculationResult buildCalculationResult(
-        BedHeightAccess          access,
+        BedHeightAccess       access,
         List<BedHeightSingle> singles,
         List<BedHeightEpoch>  epochs
     ) {
@@ -146,12 +146,24 @@
             single.getDescription());
 
         for (BedHeightSingleValue value: values) {
-            data.addKM(value.getStation().doubleValue());
-            data.addMiddleHeight(value.getHeight().doubleValue());
-            data.addUncertainty(value.getUncertainty().doubleValue());
-            data.addSoundingWidth(value.getSoundingWidth().doubleValue());
-            data.addDataGap(value.getDataGap().doubleValue());
-            data.addWidth(value.getWidth().doubleValue());
+            if (value.getHeight() != null) {
+                data.addAll(value.getStation().doubleValue(),
+                    value.getHeight().doubleValue(),
+                    value.getUncertainty().doubleValue(),
+                    value.getSoundingWidth().doubleValue(),
+                    value.getDataGap().doubleValue(),
+                    value.getWidth().doubleValue(),
+                    false);
+             }
+            else {
+                data.addAll(value.getStation().doubleValue(),
+                    0,
+                    0,
+                    0,
+                    0,
+                    0,
+                    true);
+            }
         }
 
         logger.debug("Single contains " + values.size() + " values");
@@ -160,6 +172,7 @@
     }
 
 
+    /** Create MiddleBedHeightData to return. */
     protected MiddleBedHeightData prepareEpochData(
         BedHeightEpoch epoch,
         double kmLo,
@@ -181,7 +194,14 @@
 
         for (BedHeightEpochValue value: values) {
             data.addKM(value.getStation().doubleValue());
-            data.addMiddleHeight(value.getHeight().doubleValue());
+            if (value.getHeight() != null) {
+                data.addMiddleHeight(value.getHeight().doubleValue());
+                data.addIsEmpty(false);
+            }
+            else {
+                data.addMiddleHeight(Double.NaN);
+                data.addIsEmpty(true);
+            }
         }
 
         logger.debug("Epoch contains " + values.size() + " values");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightData.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightData.java	Fri Sep 28 12:15:45 2012 +0200
@@ -2,15 +2,22 @@
 
 import java.io.Serializable;
 
+import java.util.ArrayList;
+
 import gnu.trove.TDoubleArrayList;
 
 import de.intevation.artifacts.CallContext;
 
 import de.intevation.flys.artifacts.resources.Resources;
 
+import org.apache.log4j.Logger;
+
 
 public class MiddleBedHeightData implements Serializable {
 
+    /** Very private logger. */
+    private static final Logger logger = Logger.getLogger(MiddleBedHeightData.class);
+
     public static final String I18N_SINGLE_NAME = "facet.bedheight_middle.single";
     public static final String I18N_EPOCH_NAME  = "facet.bedheight_middle.epoch";
 
@@ -25,6 +32,7 @@
     private TDoubleArrayList soundingWidth;
     private TDoubleArrayList dataGap;
     private TDoubleArrayList width;
+    private ArrayList empty;
 
 
     protected MiddleBedHeightData(int start, int end, String eval, String desc) {
@@ -39,6 +47,18 @@
         this.soundingWidth = new TDoubleArrayList();
         this.dataGap       = new TDoubleArrayList();
         this.width         = new TDoubleArrayList();
+        this.empty         = new ArrayList();
+    }
+
+    public void addAll(double station, double height, double uncertainty,
+        double soundingWidth, double dataGap, double width, boolean isEmpty) {
+        addKM(station);
+        addMiddleHeight(height);
+        addUncertainty(uncertainty);
+        addSoundingWidth(soundingWidth);
+        addDataGap(dataGap);
+        addWidth(width);
+        addIsEmpty(isEmpty);
     }
 
 
@@ -59,7 +79,7 @@
     }
 
 
-    public void addKM(double km) {
+    protected void addKM(double km) {
         this.km.add(km);
     }
 
@@ -67,7 +87,7 @@
         return km.get(idx);
     }
 
-    public void addMiddleHeight(double middleHeight) {
+    protected void addMiddleHeight(double middleHeight) {
         this.middleHeight.add(middleHeight);
     }
 
@@ -75,7 +95,7 @@
         return middleHeight.get(idx);
     }
 
-    public void addUncertainty(double uncertainty) {
+    protected void addUncertainty(double uncertainty) {
         this.uncertainty.add(uncertainty);
     }
 
@@ -83,7 +103,7 @@
         return uncertainty.get(idx);
     }
 
-    public void addSoundingWidth(double soundingWidth) {
+    protected void addSoundingWidth(double soundingWidth) {
         this.soundingWidth.add(soundingWidth);
     }
 
@@ -91,7 +111,7 @@
         return soundingWidth.get(idx);
     }
 
-    public void addDataGap(double gap) {
+    protected void addDataGap(double gap) {
         this.dataGap.add(gap);
     }
 
@@ -99,7 +119,16 @@
         return dataGap.get(idx);
     }
 
-    public void addWidth(double width) {
+    protected void addIsEmpty(boolean empty) {
+        this.empty.add(empty);
+    }
+
+    public boolean isEmpty(int idx) {
+        return (Boolean) empty.get(idx);
+    }
+
+
+    protected void addWidth(double width) {
         this.width.add(width);
     }
 
@@ -112,12 +141,22 @@
     }
 
 
+    /**
+     * Get the points, ready to be drawn
+     * @return [[km1, km2,...],[height1,height2,...]]
+     */
     public double[][] getMiddleHeightsPoints() {
         double[][] points = new double[2][size()];
 
         for (int i = 0, n = size(); i < n; i++) {
-            points[0][i] = getKM(i);
-            points[1][i] = getMiddleHeight(i);
+            if (isEmpty(i)) {
+                points[0][i] = getKM(i);
+                points[1][i] = Double.NaN;
+            }
+            else {
+                points[0][i] = getKM(i);
+                points[1][i] = getMiddleHeight(i);
+            }
         }
 
         return points;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -29,6 +29,7 @@
     protected String       hash;
     protected String       url;
     protected Envelope     extent;
+    protected Envelope     originalExtent;
     protected String       srid;
 
 
@@ -108,6 +109,16 @@
     }
 
 
+    public void setOriginalExtent(Envelope originalExtent) {
+        this.originalExtent = originalExtent;
+    }
+
+
+    public Envelope getOriginalExtent() {
+        return originalExtent;
+    }
+
+
     public void setSrid(String srid) {
         if (srid != null) {
             this.srid = srid;
@@ -140,8 +151,8 @@
         ec.addAttr(facet, "url", url, true);
         ec.addAttr(facet, "layers", layers.get(0), true);
         ec.addAttr(facet, "srid", srid != null ? srid : "", true);
-        ec.addAttr(facet, "extent", extent != null
-            ? GeometryUtils.jtsBoundsToOLBounds(extent)
+        ec.addAttr(facet, "extent", originalExtent != null
+            ? GeometryUtils.jtsBoundsToOLBounds(originalExtent)
             : "", true);
         ec.addAttr(facet, "queryable", String.valueOf(isQueryable()), true);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffCalculation.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,187 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.BedDifferencesAccess;
+import de.intevation.flys.artifacts.model.Calculation;
+import de.intevation.flys.artifacts.model.CalculationResult;
+
+
+public class BedDiffCalculation
+extends Calculation
+{
+
+    private static final Logger logger = Logger
+        .getLogger(BedDiffCalculation.class);
+
+    protected String river;
+    protected String yearEpoch;
+    protected FLYSArtifact[][] artifacts;
+
+    public BedDiffCalculation() {
+    }
+
+    public CalculationResult calculate(BedDifferencesAccess access) {
+        logger.info("BedDiffCalculation.calculate");
+
+        String river = access.getRiver();
+        String yearEpoch = access.getYearEpoch();
+        FLYSArtifact[][] artifacts = access.getDifferenceArtifacts();
+
+        logger.debug("got artifacts: " + artifacts.length + "; " + artifacts[0].length);
+        if (river == null) {
+            // TODO: i18n
+            addProblem("minfo.missing.river");
+        }
+
+        if (yearEpoch == null) {
+            addProblem("minfo.missing.year_epoch");
+        }
+
+        if (artifacts == null) {
+            addProblem("minfo.missing.differences");
+        }
+
+        if (!hasProblems()) {
+            this.river = river;
+            this.yearEpoch = yearEpoch;
+            this.artifacts = artifacts;
+            return internalCalculate();
+        }
+
+        return new CalculationResult();
+    }
+
+    private CalculationResult internalCalculate() {
+
+        if (yearEpoch.equals("year")) {
+            List<BedDiffYearResult> results =
+                new LinkedList<BedDiffYearResult>();
+
+            for (int i = 0; i < artifacts.length; i++) {
+                BedHeight[] pair =
+                    getHeightPair(artifacts[i][0], artifacts[i][1], "single");
+                BedDiffYearResult res = calculateYearDifference(pair);
+                results.add(res);
+            }
+            return new CalculationResult(
+                results.toArray(new BedDiffYearResult[results.size()]), this);
+        }
+        if (yearEpoch.equals("epoch")) {
+            List<BedDiffEpochResult> results =
+                new LinkedList<BedDiffEpochResult>();
+            for (int i = 0; i < artifacts.length; i++) {
+                BedHeight[] pair =
+                    getHeightPair(artifacts[i][0], artifacts[i][1], "epoch");
+                BedDiffEpochResult res = calculateEpochDifference(pair);
+                results.add(res);
+            }
+            return new CalculationResult(
+                results.toArray(new BedDiffEpochResult[results.size()]), this);
+        }
+
+       return new CalculationResult();
+    }
+
+    private BedHeight[] getHeightPair(
+        FLYSArtifact art1,
+        FLYSArtifact art2,
+        String type
+    ) {
+        int id1 = BedDifferencesAccess.getHeightId(art1);
+        int id2 = BedDifferencesAccess.getHeightId(art2);
+
+        BedHeight[] heights = new BedHeight[2];
+        heights[0] = BedHeightFactory.getHeight(type, id1, 0);
+        heights[1] = BedHeightFactory.getHeight(type, id2, 0);
+        return heights;
+    }
+
+    private BedDiffEpochResult calculateEpochDifference(BedHeight[] pair) {
+
+        TDoubleArrayList stations = pair[0].getStations();
+        TDoubleArrayList diffRes = new TDoubleArrayList();
+        TDoubleArrayList kms = new TDoubleArrayList();
+        TDoubleArrayList heights1 = new TDoubleArrayList();
+        TDoubleArrayList heights2 = new TDoubleArrayList();
+
+        for (int i = 0; i < stations.size(); i++) {
+            if (!Double.isNaN(pair[0].getHeight(stations.get(i))) &&
+                !Double.isNaN(pair[1].getHeight(stations.get(i)))) {
+                double hDiff =
+                    pair[0].getHeight(stations.get(i)) -
+                    pair[1].getHeight(stations.get(i));
+                diffRes.add(hDiff);
+                kms.add(stations.get(i));
+                heights1.add(pair[0].getHeight(stations.get(i)));
+                heights2.add(pair[1].getHeight(stations.get(i)));
+            }
+        }
+        Date start = ((BedHeightEpoch)pair[0]).getStart();
+        Date end = ((BedHeightEpoch)pair[1]).getEnd();
+        return new BedDiffEpochResult(kms, diffRes, heights1, heights2, start, end);
+    }
+
+    private BedDiffYearResult calculateYearDifference(BedHeight[] pair) {
+
+        TDoubleArrayList stations = pair[0].getStations();
+        TDoubleArrayList diffRes = new TDoubleArrayList();
+        TDoubleArrayList kms = new TDoubleArrayList();
+        TDoubleArrayList morphs = new TDoubleArrayList();
+        TDoubleArrayList absolute = new TDoubleArrayList();
+        TDoubleArrayList gap = new TDoubleArrayList();
+        TDoubleArrayList heights1 = new TDoubleArrayList();
+        TDoubleArrayList heights2 = new TDoubleArrayList();
+
+        BedHeightSingle s1 = (BedHeightSingle)pair[0];
+        BedHeightSingle s2 = (BedHeightSingle)pair[1];
+        int range = s1.getYear() - s2.getYear();
+        if (range  < 0) {
+            range = range * -1;
+        }
+        for (int i = 0; i < stations.size(); i++) {
+            if (!Double.isNaN(s1.getHeight(stations.get(i))) &&
+                !Double.isNaN(s2.getHeight(stations.get(i)))) {
+                double hDiff =
+                    s1.getHeight(stations.get(i)) -
+                    s2.getHeight(stations.get(i));
+                diffRes.add(hDiff);
+                double km = stations.get(i);
+                kms.add(km);
+                if (s1.getMorphWidth(km) >
+                    s2.getMorphWidth(km)) {
+                    morphs.add(s1.getMorphWidth(km));
+                }
+                else {
+                    morphs.add(s2.getMorphWidth(km));
+                }
+                if (s1.getDataGap(km) > s2.getDataGap(km)) {
+                    gap.add(s1.getDataGap(km));
+                }
+                else {
+                    gap.add(s2.getDataGap(km));
+                }
+                absolute.add((hDiff / range) * 100);
+                heights1.add(s1.getHeight(km));
+                heights2.add(s2.getHeight(km));
+            }
+        }
+        return new BedDiffYearResult(
+            kms,
+            diffRes,
+            heights1,
+            heights2,
+            morphs,
+            absolute,
+            gap,
+            s1.getYear(),
+            s2.getYear());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochFacet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,52 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffEpochFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDensityFacet.class);
+
+    public BedDiffEpochFacet() {
+    }
+
+    public BedDiffEpochFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        Object[] data =
+            (BedDiffEpochResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        return data != null && data.length > index ? data[index] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffEpochFacet copy = new BedDiffEpochFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffEpochResult.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,39 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.Date;
+
+import gnu.trove.TDoubleArrayList;
+
+
+public class BedDiffEpochResult
+extends BedDifferencesResult
+{
+
+    protected Date start;
+    protected Date end;
+
+    public BedDiffEpochResult () {
+        super();
+    }
+
+    public BedDiffEpochResult (
+        TDoubleArrayList kms,
+        TDoubleArrayList differences,
+        TDoubleArrayList heights1,
+        TDoubleArrayList heights2,
+        Date start,
+        Date end
+    ) {
+        super(kms, differences, heights1, heights2);
+        this.start = start;
+        this.end = end;
+    }
+
+    public Date getStart() {
+        return this.start;
+    }
+
+    public Date getEnd() {
+        return this.end;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearFacet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,52 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+
+
+public class BedDiffYearFacet
+extends DataFacet
+{
+    private static Logger logger = Logger.getLogger(BedDiffYearFacet.class);
+
+    public BedDiffYearFacet() {
+    }
+
+    public BedDiffYearFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash) {
+        super(idx, name, description, type, hash, stateId);
+    }
+
+    public Object getData(Artifact artifact, CallContext context) {
+        logger.debug("Get data for bed density at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        Object[] data =
+            (BedDiffYearResult[]) res.getData(); // TODO CAST TO SPECIFIC CLASS
+
+        return data != null && data.length > index ? data[index] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiffYearFacet copy = new BedDiffYearFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        return copy;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiffYearResult.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,77 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+
+public class BedDiffYearResult
+extends BedDifferencesResult
+{
+
+    protected TDoubleArrayList bedHeights;
+    protected TDoubleArrayList dataGap;
+    protected TDoubleArrayList morphWidth;
+    protected int start;
+    protected int end;
+
+    public BedDiffYearResult () {
+        super();
+        this.bedHeights = new TDoubleArrayList();
+        this.dataGap = new TDoubleArrayList();
+        this.morphWidth = new TDoubleArrayList();
+        this.start = -1;
+        this.end = -1;
+    }
+
+    public BedDiffYearResult(
+        TDoubleArrayList kms,
+        TDoubleArrayList differences,
+        TDoubleArrayList heights1,
+        TDoubleArrayList heights2,
+        TDoubleArrayList morphWidth,
+        TDoubleArrayList bedHeights,
+        TDoubleArrayList dataGap,
+        int start,
+        int end
+    ) {
+        super(kms, differences, heights1, heights2);
+        this.bedHeights = bedHeights;
+        this.dataGap = dataGap;
+        this.morphWidth = morphWidth;
+        this.start = start;
+        this.end = end;
+    }
+
+    public TDoubleArrayList getBedHeights() {
+        return this.bedHeights;
+    }
+
+    public TDoubleArrayList getDataGap() {
+        return this.dataGap;
+    }
+
+    public TDoubleArrayList getMorphWidth() {
+        return this.morphWidth;
+    }
+
+    public int getStart() {
+        return this.start;
+    }
+
+    public int getEnd() {
+        return this.end;
+    }
+
+    public double[][] getMorphWidthData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            morphWidth.toNativeArray()
+        };
+    }
+
+    public double[][] getHeightPerYearData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            bedHeights.toNativeArray()
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedDifferencesResult.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,71 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.io.Serializable;
+
+
+public class BedDifferencesResult
+implements Serializable
+{
+
+    protected TDoubleArrayList kms;
+    protected TDoubleArrayList differences;
+    protected TDoubleArrayList height1;
+    protected TDoubleArrayList height2;
+
+    public BedDifferencesResult () {
+        kms = new TDoubleArrayList();
+        differences = new TDoubleArrayList();
+
+    }
+
+    public BedDifferencesResult(
+        TDoubleArrayList kms,
+        TDoubleArrayList differences,
+        TDoubleArrayList heights1,
+        TDoubleArrayList heights2
+    ) {
+        this.kms = kms;
+        this.differences = differences;
+        this.height1 = heights1;
+        this.height2 = heights2;
+    }
+
+    public TDoubleArrayList getKms() {
+        return this.kms;
+    }
+
+    public TDoubleArrayList getDifferences() {
+        return this.differences;
+    }
+
+    public double[][] getDifferencesData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            differences.toNativeArray()
+        };
+    }
+
+    public TDoubleArrayList getHeights1() {
+        return this.height1;
+    }
+
+    public TDoubleArrayList getHeights2() {
+        return this.height2;
+    }
+
+    public double[][] getHeights1Data() {
+        return new double[][] {
+            kms.toNativeArray(),
+            height1.toNativeArray()
+        };
+    }
+
+    public double[][] getHeights2Data() {
+        return new double[][] {
+            kms.toNativeArray(),
+            height2.toNativeArray()
+        };
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeight.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeight.java	Fri Sep 28 12:15:45 2012 +0200
@@ -12,19 +12,16 @@
 
     protected TDoubleArrayList heights;
     protected TDoubleArrayList station;
-    protected TDoubleArrayList data_gap;
 
     public BedHeight() {
         heights = new TDoubleArrayList();
         station = new TDoubleArrayList();
-        data_gap = new TDoubleArrayList();
     }
 
     public BedHeight(String name) {
         super(name);
         heights = new TDoubleArrayList();
         station = new TDoubleArrayList();
-        data_gap = new TDoubleArrayList();
     }
 
     public BedHeight(int capacity) {
@@ -35,13 +32,11 @@
         super(name);
         heights = new TDoubleArrayList(capacity);
         station = new TDoubleArrayList(capacity);
-        data_gap = new TDoubleArrayList(capacity);
     }
 
-    public void add(double value, double station, double gap) {
+    public void add(double value, double station) {
         this.heights.add(value);
         this.station.add(station);
-        this.data_gap.add(gap);
     }
 
     public int size() {
@@ -63,14 +58,25 @@
     public double [] get(int idx, double [] dst) {
         dst[0] = heights.getQuick(idx);
         dst[1] = station.getQuick(idx);
-        dst[2] = data_gap.getQuick(idx);
         return dst;
     }
 
-    public double minHeights() {
+   public double minHeights() {
         return heights.min();
     }
 
+    public TDoubleArrayList getStations() {
+        return this.station;
+    }
+
+    public double getHeight(double station) {
+        if (this.station.indexOf(station) >= 0) {
+            return this.heights.get(this.station.indexOf(station));
+        }
+        return Double.NaN;
+    }
+
+
     public static void removeNaNs(TDoubleArrayList [] arrays) {
 
         int dest = 0;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightEpoch.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,42 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.Date;
+
+
+public class BedHeightEpoch
+extends BedHeight
+{
+
+    protected Date start;
+    protected Date end;
+
+    public BedHeightEpoch() {
+        this.start = new Date();
+        this.end = new Date();
+    }
+
+    public BedHeightEpoch(String name) {
+        super(name);
+        this.start = new Date();
+        this.end = new Date();
+    }
+
+    public void add(
+        double value,
+        double station,
+        Date start,
+        Date end
+    ) {
+        super.add(value, station);
+        this.start = start;
+        this.end = end;
+    }
+
+    public Date getStart() {
+        return start;
+    }
+
+    public Date getEnd() {
+        return end;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,6 +1,7 @@
 package de.intevation.flys.artifacts.model.minfo;
 
 
+import java.util.Date;
 import java.util.List;
 
 import net.sf.ehcache.Cache;
@@ -21,13 +22,18 @@
 
     /** Query to get km and ws for wst_id and column_pos. */
     public static final String SQL_SELECT_SINGLE =
-        "SELECT height, station, data_gap FROM bed_height_single_values " +
-        "WHERE id = :height_id";
+        "SELECT bhsv.height, bhsv.station, bhsv.data_gap, bhsv.sounding_width, bhs.year " +
+        "   FROM bed_height_single bhs" +
+        "       JOIN bed_height_single_values bhsv on bhsv.bed_height_single_id = bhs.id" +
+        "   WHERE bhs.id = :height_id";
 
     /** Query to get name for wst_id and column_pos. */
     public static final String SQL_SELECT_EPOCH =
-        "SELECT height, station FROM bed_height_epoch_values "+
-        "WHERE id = :height_id";
+        "SELECT bv.height, bv.station, ti.start_time, ti.stop_time" +
+        "   FROM bed_height_epoch b" +
+        "       JOIN bed_height_epoch_values bv ON b.id = bv.bed_height_epoch_id" +
+        "       JOIN time_intervals ti ON b.time_interval_id = ti.id" +
+        "   WHERE b.id = :height_id";
 
     /** Query to get name (description) for wst_id. */
     public static final String SQL_SELECT_DESCR_SINGLE =
@@ -120,37 +126,54 @@
             log.debug("BedHeightFactory.getBedHeightUncached");
         }
 
-        BedHeight height = new BedHeight(getHeightName(type, height_id));
-
         Session session = SessionHolder.HOLDER.get();
         SQLQuery sqlQuery = null;
         if (type.equals("single")) {
+            BedHeightSingle height =
+                new BedHeightSingle(getHeightName(type, height_id));
             sqlQuery = session.createSQLQuery(SQL_SELECT_SINGLE)
                 .addScalar("height", StandardBasicTypes.DOUBLE)
                 .addScalar("station", StandardBasicTypes.DOUBLE)
-                .addScalar("data_gap", StandardBasicTypes.DOUBLE);
+                .addScalar("data_gap", StandardBasicTypes.DOUBLE)
+                .addScalar("sounding_width", StandardBasicTypes.DOUBLE)
+                .addScalar("year", StandardBasicTypes.INTEGER);
             sqlQuery.setInteger("height_id", height_id);
             List<Object []> results = sqlQuery.list();
 
-            for (int i = 0; i <= results.size(); i++) {
+            for (int i = 0; i < results.size(); i++) {
                 Object[] row = results.get(i);
-                height.add((Double) row[0], (Double) row[1], (Double) row[2]);
+                log.debug("got station: " + (Double)row[1]);
+                height.add(
+                    (Double) row[0],
+                    (Double) row[1],
+                    (Double) row[2],
+                    (Double) row[3],
+                    (Integer) row[4]);
             }
+            return height;
         }
         else if (type.equals("epoch")) {
+            BedHeightEpoch height =
+                new BedHeightEpoch(getHeightName(type, height_id));
             sqlQuery = session.createSQLQuery(SQL_SELECT_EPOCH)
                 .addScalar("height", StandardBasicTypes.DOUBLE)
-                .addScalar("station", StandardBasicTypes.DOUBLE);
+                .addScalar("station", StandardBasicTypes.DOUBLE)
+                .addScalar("start_time", StandardBasicTypes.DATE)
+                .addScalar("stop_time", StandardBasicTypes.DATE);
             sqlQuery.setInteger("height_id", height_id);
             List<Object []> results = sqlQuery.list();
 
-            for (int i = 0; i <= results.size(); i++) {
+            for (int i = 0; i < results.size(); i++) {
                 Object[] row = results.get(i);
-                height.add((Double) row[0], (Double) row[1], 0);
+                height.add(
+                    (Double) row[0],
+                    (Double) row[1],
+                    (Date) row[2],
+                    (Date)row[3]);
             }
+            return height;
         }
-
-        return height;
+        return new BedHeight();
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightSingle.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,66 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+
+public class BedHeightSingle
+extends BedHeight
+{
+
+    protected int year;
+    protected TDoubleArrayList data_gap;
+    protected TDoubleArrayList morphWidth;
+
+    public BedHeightSingle() {
+        super();
+        this.year = -1;
+        data_gap = new TDoubleArrayList();
+        morphWidth = new TDoubleArrayList();
+    }
+
+    public BedHeightSingle(String name) {
+        super(name);
+        this.year = -1;
+        data_gap = new TDoubleArrayList();
+        morphWidth = new TDoubleArrayList();
+    }
+
+    public void add(
+        double value,
+        double station,
+        double gap,
+        double width,
+        int year
+    ) {
+        super.add(value, station);
+        this.year = year;
+        this.data_gap.add(gap);
+        this.morphWidth.add(width);
+    }
+
+    public int getYear() {
+        return this.year;
+    }
+
+    public double getMorphWidth(int idx) {
+        return this.morphWidth.get(idx);
+    }
+
+    public double getDataGap(int idx) {
+        return this.data_gap.get(idx);
+    }
+
+    public double getMorphWidth(double station) {
+        if (this.station.indexOf(station) >= 0) {
+            return this.morphWidth.get(this.station.indexOf(station));
+        }
+        return Double.NaN;
+    }
+
+    public double getDataGap(double station) {
+        if (this.station.indexOf(station) >= 0) {
+            return this.getDataGap(this.station.indexOf(station));
+        }
+        return Double.NaN;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java	Fri Sep 28 12:15:45 2012 +0200
@@ -85,7 +85,8 @@
         "    JOIN gewaesser g " +
         "       ON s.gewaesserid = g.gewaesserid " +
         "WHERE" +
-        "    g.name = :name " +
+        "    g.name = :name AND " +
+        "    m.km IS NOT NULL " +
         "ORDER by" +
         "    m.km, m.datum";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Fri Sep 28 12:15:45 2012 +0200
@@ -6,6 +6,9 @@
 {
     protected Map<String, Object> data;
 
+    protected Measurement prev;
+    protected Measurement next;
+
     public Measurement() {
     }
 
@@ -31,33 +34,34 @@
     }
 
     public double TOTAL_BL() {
-        // TODO: Implement me!
-        return Double.NaN;
+        return get("TGESCHIEBE");
     }
 
-    public double SAND() {
+    public double BL_G() {
         // TODO: Implement me!
         return Double.NaN;
     }
 
-
-    public double S_BL_S() {
-        return SAND() * TOTAL_BL();
-    }
-
-    public double S_BL_FG() {
+    public double BL_C() {
         // TODO: Implement me!
         return Double.NaN;
     }
 
-    public double S_BL_CG() {
+    public double BL_S() {
         // TODO: Implement me!
         return Double.NaN;
     }
 
-    public double S_BL() {
-        // TODO: Implement me!
-        return Double.NaN;
+    public double S_BL_S() {
+        return TOTAL_BL() * BL_S();
+    }
+
+    public double S_BL_FG() {
+        return TOTAL_BL() * BL_G();
+    }
+
+    public double S_BL_CG() {
+        return TOTAL_BL() * BL_C();
     }
 
     public double S_BL_1() {
@@ -84,5 +88,41 @@
     public String toString() {
         return "Measurement: " + data;
     }
+
+    /**
+     * Gets the prev for this instance.
+     *
+     * @return The prev.
+     */
+    public Measurement getPrev() {
+        return this.prev;
+    }
+
+    /**
+     * Sets the prev for this instance.
+     *
+     * @param prev The prev.
+     */
+    public void setPrev(Measurement prev) {
+        this.prev = prev;
+    }
+
+    /**
+     * Gets the next for this instance.
+     *
+     * @return The next.
+     */
+    public Measurement getNext() {
+        return this.next;
+    }
+
+    /**
+     * Sets the next for this instance.
+     *
+     * @param next The next.
+     */
+    public void setNext(Measurement next) {
+        this.next = next;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,5 +1,7 @@
 package de.intevation.flys.artifacts.model.sq;
 
+import java.util.List;
+
 import de.intevation.flys.artifacts.model.DateRange;
 
 import de.intevation.flys.backend.SedDBSessionHolder;
@@ -21,62 +23,52 @@
     private static final Logger log =
         Logger.getLogger(MeasurementFactory.class);
 
-    public static final String [] GSIEBSATZ = {
-        "SIEB01", "SIEB02", "SIEB03", "SIEB04",
-        "SIEB05", "SIEB06", "SIEB07", "SIEB08",
-        "SIEB09", "SIEB10", "SIEB11", "SIEB13",
-        "SIEB13", "SIEB14", "SIEB15", "SIEB16",
-        "SIEB17", "SIEB18", "SIEB19", "SIEB20",
-        "SIEB21"
-    };
-
-    public static final String [] SSIEBUNG = {
-        "RSIEB01", "RSIEB02", "RSIEB03", "RSIEB04",
-        "RSIEB05", "RSIEB06", "RSIEB07", "RSIEB08",
-        "RSIEB09", "RSIEB10", "RSIEB11", "RSIEB13",
-        "RSIEB13", "RSIEB14", "RSIEB15", "RSIEB16",
-        "RSIEB17", "RSIEB18", "RSIEB19", "RSIEB20",
-        "RSIEB21", "REST"
-    };
-
     public static final String SQL_MEASSURE =
-        ("SELECT " +
-            "m.TSAND    AS TSAND,"   +
-            "m.TSCHWEB  AS TSCHWEB," +
-            "m.CSCHWEB  AS CSCHWEB," +
-            "m.Q_BPEGEL AS Q_BPEGEL " +
-        //    ", %GSIEBSATZ% " +
-        //    "%SSIEBUNG% " +
-        "FROM messung m " +
-            "JOIN station   s ON m.stationid   = s.stationid " +
-            "JOIN gewaesser g ON s.gewaesserid = g.gewaesserid " +
-          //  "LEFT JOIN GSIEBSATZ gs ON m.gsiebsatzid = gs.gsiebsatzid " +
-          //  "LEFT JOIN SSIEBUNG  ss ON gs.gsiebsatzid = ss.gsiebsatzid " +
+        "SELECT m.datum        AS DATUM," +
+               "g.UFERABST     AS UFERABST," +
+               "g.UFERABLINKS  AS UFERABLINKS," +
+               "m.TSCHWEB      AS TSCHWEB," +
+               "m.TSAND        AS TSAND," +
+               "gp.MESSDAUER   AS MESSDAUER," +
+               "gp.MENGE       AS MENGE," +
+               "gp.GTRIEB      AS GTRIEB," +
+               "gp.LFDNR       AS LFDNR," +
+               "m.TGESCHIEBE   AS TGESCHIEBE," +
+               "gs.RSIEB01     AS RSIEB01," +
+               "gs.RSIEB02     AS RSIEB02," +
+               "gs.RSIEB03     AS RSIEB03," +
+               "gs.RSIEB04     AS RSIEB04," +
+               "gs.RSIEB05     AS RSIEB05," +
+               "gs.RSIEB06     AS RSIEB06," +
+               "gs.RSIEB07     AS RSIEB07," +
+               "gs.RSIEB08     AS RSIEB08," +
+               "gs.RSIEB09     AS RSIEB09," +
+               "gs.RSIEB10     AS RSIEB10," +
+               "gs.RSIEB11     AS RSIEB11," +
+               "gs.RSIEB12     AS RSIEB12," +
+               "gs.RSIEB13     AS RSIEB13," +
+               "gs.RSIEB14     AS RSIEB14," +
+               "gs.RSIEB15     AS RSIEB15," +
+               "gs.RSIEB16     AS RSIEB16," +
+               "gs.RSIEB17     AS RSIEB17," +
+               "gs.RSIEB18     AS RSIEB18," +
+               "gs.RSIEB19     AS RSIEB19," +
+               "gs.RSIEB20     AS RSIEB20," +
+               "gs.RSIEB21     AS RSIEB21," +
+               "gs.REST        AS REST," +
+               "g.GLOTRECHTEID AS GLOTRECHTEID " +
+        "FROM MESSUNG m " +
+            "JOIN STATION    s ON m.STATIONID    = s.STATIONID " +
+            "JOIN glotrechte g ON m.MESSUNGID    = g.MESSUNGID " +
+            "JOIN gprobe    gp ON g.GLOTRECHTEID = gp.GLOTRECHTEID " +
+            "JOIN GSIEBUNG  gs ON g.GLOTRECHTEID = gs.GLOTRECHTEID " +
         "WHERE " +
-            "g.name = :river_name " +
+            "g.NAME = :river_name " +
             "AND m.Q_BPEGEL IS NOT NULL " +
-            "AND s.km BETWEEN :location - 0.001 AND :location + 0.001 " +
-            "AND m.datum BETWEEN :from AND :to ");
-        //.replace("%GSIEBSATZ%", projection("gs", GSIEBSATZ));
-        //.replace("%SSIEBUNG%",  projection("ss", SSIEBUNG));
-
-    private static final String projection(
-        String    prefix,
-        String [] columnNames
-    ) {
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < columnNames.length; ++i) {
-            if (i > 0) {
-                sb.append(',');
-            }
-            sb.append(prefix)
-              .append('.')
-              .append(columnNames[i])
-              .append(" AS ")
-              .append(columnNames[i]);
-        }
-        return sb.toString();
-    }
+            "AND s.KM BETWEEN :location - 0.001 AND :location + 0.001 " +
+            "AND m.DATUM BETWEEN :from AND :to " +
+            "AND m.TGESCHIEBE IS NOT NULL " +
+        "ORDER BY m.DATUM";
 
     public static final class MeasurementResultTransformer
     extends                   BasicTransformerAdapter
@@ -115,20 +107,40 @@
         }
 
         SQLQuery query = session.createSQLQuery(SQL_MEASSURE)
-            .addScalar("TSAND",    StandardBasicTypes.DOUBLE)
-            .addScalar("TSCHWEB",  StandardBasicTypes.DOUBLE)
-            .addScalar("CSCHWEB",  StandardBasicTypes.DOUBLE)
-            .addScalar("Q_BPEGEL", StandardBasicTypes.DOUBLE);
-
-        /*
-        for (String siebsatz: GSIEBSATZ) {
-            query.addScalar(siebsatz, StandardBasicTypes.DOUBLE);
-        }
-
-        for (String siebung: SSIEBUNG) {
-            query.addScalar(siebung, StandardBasicTypes.DOUBLE);
-        }
-        */
+            .addScalar("Q_BPEGEL",     StandardBasicTypes.DOUBLE)
+            .addScalar("DATUM",        StandardBasicTypes.DATE)
+            .addScalar("UFERABST",     StandardBasicTypes.DOUBLE)
+            .addScalar("UFERABLINKS",  StandardBasicTypes.DOUBLE)
+            .addScalar("TSCHWEB",      StandardBasicTypes.DOUBLE)
+            .addScalar("TSAND",        StandardBasicTypes.DOUBLE)
+            .addScalar("MESSDAUER",    StandardBasicTypes.DOUBLE)
+            .addScalar("MENGE",        StandardBasicTypes.DOUBLE)
+            .addScalar("GTRIEB",       StandardBasicTypes.DOUBLE)
+            .addScalar("LFDNR",        StandardBasicTypes.DOUBLE)
+            .addScalar("TGESCHIEBE",   StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB01",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB02",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB03",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB04",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB05",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB06",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB07",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB08",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB09",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB10",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB11",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB12",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB13",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB14",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB15",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB16",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB17",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB18",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB19",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB20",      StandardBasicTypes.DOUBLE)
+            .addScalar("RSIEB21",      StandardBasicTypes.DOUBLE)
+            .addScalar("REST",         StandardBasicTypes.DOUBLE)
+            .addScalar("GLOTRECHTEID", StandardBasicTypes.DOUBLE);
 
         query.setString("river_name", river);
         query.setDouble("location", location);
@@ -137,7 +149,18 @@
 
         query.setResultTransformer(MeasurementResultTransformer.INSTANCE);
 
-        return new Measurements(query.list());
+        @SuppressWarnings("unchecked")
+		List<Measurement> measuments = (List<Measurement>)query.list();
+
+        for (int i = 0, N = measuments.size(); i < N; ++i) {
+            Measurement m = measuments.get(i);
+            Measurement p = i >   0 ? measuments.get(i-1) : null;
+            Measurement n = i < N-1 ? measuments.get(i+1) : null;
+            m.setPrev(p);
+            m.setNext(n);
+        }
+
+        return new Measurements(measuments);
     }
 
     public static Measurements getMeasurements(
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java	Fri Sep 28 12:15:45 2012 +0200
@@ -51,7 +51,7 @@
     public static final SExtractor S_BL_EXTRACTOR = new SExtractor() {
         @Override
         public double getS(Measurement measument) {
-            return measument.S_BL();
+            return measument.BL_S();
         }
     };
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java	Fri Sep 28 12:15:45 2012 +0200
@@ -32,7 +32,7 @@
     }
 
 
-    protected class ReferenceNumberFilter implements Filter {
+    private static final class ReferenceNumberFilter implements Filter {
         private long refNr;
 
         public ReferenceNumberFilter(long refNr) {
@@ -41,14 +41,11 @@
 
         @Override
         public boolean apply(Gauge  gauge) {
-            logger.debug("Test gauge '" + gauge.getName() + "'");
+            if (logger.isDebugEnabled()) {
+                logger.debug("Test gauge '" + gauge.getName() + "'");
+            }
 
-            if (gauge != null && gauge.getOfficialNumber() == refNr) {
-                return true;
-            }
-            else {
-                return false;
-            }
+            return gauge != null && gauge.getOfficialNumber() == refNr;
         }
     } // end of ReferenceNumberFilter class
 
@@ -120,7 +117,8 @@
 
         if (refNr != null && refNr.length() > 0) {
             try {
-                filters.add(new ReferenceNumberFilter(Long.valueOf(refNr)));
+                filters.add(
+                    new ReferenceNumberFilter(Long.parseLong(refNr)));
             }
             catch (NumberFormatException nfe) {
                 logger.warn(nfe, nfe);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java	Fri Sep 28 12:15:45 2012 +0200
@@ -67,6 +67,8 @@
         ec.addAttr(r, "kmup", Boolean.toString(river.getKmUp()), true);
         ec.addAttr(r, "minq", Double.toString(minmaxq[0]), true);
         ec.addAttr(r, "maxq", Double.toString(minmaxq[1]), true);
+        ec.addAttr(r, "official", Long.toString(river.getOfficialNumber()),
+                    true);
 
         Element egs = ec.create("gauges");
 
@@ -132,6 +134,11 @@
                 ec.addAttr(eg, "station", station, true);
             }
 
+            Long official = gauge.getOfficialNumber();
+            if (official != null) {
+                ec.addAttr(eg, "official", official.toString(), true);
+            }
+
             egs.appendChild(eg);
         }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Fri Sep 28 12:15:45 2012 +0200
@@ -25,6 +25,7 @@
     private static final Logger logger = Logger.getLogger(DischargeState.class);
 
 
+    /** Let client display a matrix. */
     @Override
     public String getUIProvider() {
         return "parameter-matrix";
@@ -99,7 +100,7 @@
         String lo = zone.getLowerDischarge();
         String hi = zone.getUpperDischarge();
 
-        return hi != null && lo.equals(hi)
+        return hi != null && !lo.equals(hi)
             ? lo + " - " + hi
             : lo;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Fri Sep 28 12:15:45 2012 +0200
@@ -3,22 +3,17 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
 import org.json.JSONArray;
 import org.json.JSONException;
 
-import de.intevation.artifacts.CallMeta;
+import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.artifacts.CallContext;
-
-import de.intevation.artifactdatabase.state.Facet;
-
+import de.intevation.artifacts.CallMeta;
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.ManualPointsArtifact;
-
 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.ManualPointsFacet;
-
 import de.intevation.flys.artifacts.resources.Resources;
 
 /**
@@ -76,11 +71,11 @@
                     0,
                     fName,
                     Resources.getMsg(meta, "manualpoints", "Manual Points"));
-
                 facets.add(facet);
+                logger.debug("compute(): ManualPointsFacet for " + ct + " created");
             }
             else {
-                //logger.debug("No points for " + ct);
+                logger.debug("compute(): No points for " + ct);
             }
 
             // Handle lines.
@@ -89,7 +84,7 @@
             if (linesData != null && linesData.length() != 0
                 && !linesData.equals("[]")) {
                 try {
-                    JSONArray lines = new JSONArray((String) linesData);
+                    JSONArray lines = new JSONArray(linesData);
                     for (int i = 0, P = lines.length(); i < P; i++) {
                         JSONArray array = lines.getJSONArray(i);
                         double y    = array.getDouble(0);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri Sep 28 12:15:45 2012 +0200
@@ -20,13 +20,13 @@
 
 public class SoundingsSelect extends MultiStringArrayState {
 
-    public static final String SOUNDINGS  = "soundings";
+    public static final String SOUNDINGS = "soundings";
 
     public static final String PREFIX_SINGLE = "single-";
 
-    public static final String PREFIX_EPOCH  = "epoch-";
+    public static final String PREFIX_EPOCH = "epoch-";
 
-
+    /** Private logger. */
     private static final Logger logger = Logger.getLogger(SoundingsSelect.class);
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java	Fri Sep 28 12:15:45 2012 +0200
@@ -8,6 +8,7 @@
 
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.artifactdatabase.state.DefaultOutput;
+import de.intevation.artifactdatabase.state.Output;
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 
@@ -107,5 +108,9 @@
     ) {
         return staticCompute(facets, artifact);
     }
+
+    public void addOutput(Output out) {
+        super.addOutput(out);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,13 +1,14 @@
 package de.intevation.flys.artifacts.states;
 
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
 import de.intevation.artifactdatabase.state.Facet;
-
 import de.intevation.artifacts.CallContext;
-
 import de.intevation.flys.artifacts.ChartArtifact;
 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.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.DataFacet;
@@ -16,13 +17,8 @@
 import de.intevation.flys.artifacts.model.ReportFacet;
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.WaterlevelFacet;
-
 import de.intevation.flys.utils.FLYSUtils;
 
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
 public class WaterlevelState
 extends      DefaultState
 implements   FacetTypes
@@ -127,7 +123,6 @@
         Object       old
     ) {
         if (artifact instanceof ChartArtifact) {
-            ChartArtifact chart = (ChartArtifact)artifact;
             facets.add(new EmptyFacet());
             return null;
         }
@@ -147,7 +142,6 @@
         Object       old
     ) {
         if (artifact instanceof ChartArtifact) {
-            ChartArtifact chart = (ChartArtifact)artifact;
             facets.add(new EmptyFacet());
             return null;
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Fri Sep 28 12:15:45 2012 +0200
@@ -45,7 +45,7 @@
     /** The log used in this class. */
     private static Logger log = Logger.getLogger(FixAnalysisCompute.class);
 
-    private static final String I18N_REFERENCEPERIOD = "fix.reference.period.event.short";
+    private static final String I18N_REFERENCEPERIOD_SHORT = "fix.reference.period.event.short";
 
     private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods";
 
@@ -59,6 +59,8 @@
 
     private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
 
+    private static final String I18N_REFERENCEPERIOD = "state.fix.analysis.referenceperiod";
+
     public static final String [] SECTOR_LABELS = {
         "[0 - (MNQ+MQ)/2)",
         "[(MNQ+MQ)/2 - (MQ+MHQ)/2)",
@@ -77,16 +79,18 @@
                     Facet    facet,
                     String   output
                 ) {
-                    String name = facet.getName();
+                    if (output.contains(FacetTypes.ChartType.FLSC.toString())) { // Longitudinal section chart
+                        String name = facet.getName();
 
-                    if (name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_DWT)
-                     || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_LS)
-                     || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_WQ)
-                     || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_DWT)
-                     || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_LS)
-                     || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_WQ)
-                    ) {
-                        return Boolean.FALSE;
+                        if (name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_DWT)
+                         || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_LS)
+                         || name.contains(FacetTypes.FIX_ANALYSIS_EVENTS_WQ)
+                         || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_DWT)
+                         || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_LS)
+                         || name.contains(FacetTypes.FIX_REFERENCE_EVENTS_WQ)
+                        ) {
+                            return Boolean.FALSE;
+                        }
                     }
 
                     return Boolean.TRUE;
@@ -231,8 +235,8 @@
         IdGenerator idg = new IdGenerator(maxId + 1);
 
         String i18n_ref = Resources.getMsg(context.getMeta(),
-                I18N_REFERENCEPERIOD,
-                I18N_REFERENCEPERIOD);
+                I18N_REFERENCEPERIOD_SHORT,
+                I18N_REFERENCEPERIOD_SHORT);
         String i18n_dev = Resources.getMsg(context.getMeta(),
                 I18N_REFERENCEDEVIATION,
                 I18N_REFERENCEDEVIATION);
@@ -275,6 +279,13 @@
             FIX_ANALYSIS_PERIODS_WQ,
             i18n_ana));
 
+        String i18n_refp = Resources.getMsg(context.getMeta(),
+                I18N_REFERENCEPERIOD,
+                I18N_REFERENCEPERIOD);
+        facets.add(new DataFacet(idg.next(),
+            FIX_REFERENCE_PERIOD_DWT,
+            i18n_refp,
+            ComputeType.ADVANCE, null, null));
 
         facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
 
@@ -290,7 +301,7 @@
 
         facets.add(new FixDerivateFacet(
             idg.next(),
-            FIX_DERIVATE,
+            FIX_DERIVATE_CURVE,
             Resources.getMsg(
                 context.getMeta(),
                 I18N_DERIVATIVE,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,16 +1,248 @@
 package de.intevation.flys.artifacts.states.minfo;
 
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.apache.log4j.Logger;
 
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.BedDifferencesAccess;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.BedDiffCalculation;
+import de.intevation.flys.artifacts.model.minfo.BedDiffEpochFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.artifacts.model.minfo.BedDifferencesResult;
+import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
+import de.intevation.flys.utils.Formatter;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
-public class DifferencesState extends DefaultState {
+public class DifferencesState
+extends DefaultState
+implements FacetTypes
+{
     /** The logger used in this class. */
     private static Logger logger = Logger.getLogger(DifferencesState.class);
+    public static final String I18N_DIFF_YEAR = "beddifference.year";
+    public static final String I18N_DIFF_EPOCH = "beddifference.epoch";
+
+    public static final String I18N_FACET_BED_DIFF_YEAR = "facet.bedheight.diff.year";
+    public static final String I18N_FACET_BED_DIFF_ABSOLUTE = "facet.bedheight.diff.absolute";
+    public static final String I18N_FACET_BED_DIFF_MORPH = "facet.bedheight.diff.morph";
+    public static final String I18N_FACET_BED_DIFF_EPOCH = "facet.bedheight.diff.epoch";
+    public static final String I18N_FACET_BED_DIFF_HEIGHT1 = "facet.bedheight.diff.height1";
+    public static final String I18N_FACET_BED_DIFF_HEIGHT2 = "facet.bedheight.diff.height2";
 
     public DifferencesState() {
     }
+
+    @Override
+    public Object computeAdvance(FLYSArtifact artifact, String hash,
+        CallContext context, List<Facet> facets, Object old) {
+        logger.debug("BedQualityState.computeAdvance");
+
+        List<Facet> newFacets = new ArrayList<Facet>();
+
+        BedDifferencesAccess access =
+            new BedDifferencesAccess(artifact, context);
+
+        CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
+            : new BedDiffCalculation().calculate(access);
+
+        if (facets == null || res == null) {
+            return res;
+        }
+
+        BedDifferencesResult[] results = (BedDifferencesResult[]) res.getData();
+
+        if (results == null || results.length == 0) {
+            logger.warn("Calculation computed no results!");
+            return res;
+        }
+
+        generateFacets(context, newFacets, results, getID(), hash);
+        logger.debug("Created " + newFacets.size() + " new Facets.");
+
+        facets.addAll(newFacets);
+
+        return res;
+    }
+
+    protected void generateFacets(CallContext context, List<Facet> newFacets,
+        BedDifferencesResult[] results, String stateId, String hash) {
+        logger.debug("BedQualityState.generateFacets");
+
+        CallMeta meta = context.getMeta();
+
+        for (int idx = 0; idx < results.length; idx++) {
+            if (results[idx] instanceof BedDiffYearResult) {
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR,
+                    createBedDiffYearDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx]),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_MORPH_WIDTH,
+                    createBedDiffMorphDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx]),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR_HEIGHT1,
+                    createBedDiffHeightDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        0),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                 newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR_HEIGHT2,
+                    createBedDiffHeightDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        1),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_HEIGHT_YEAR,
+                    createBedDiffAbsoluteDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx]),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+            }
+            if (results[idx] instanceof BedDiffEpochResult) {
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH,
+                    createBedDiffEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx]),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH_HEIGHT1,
+                    createBedDiffHeightEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx],
+                        0),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH_HEIGHT2,
+                    createBedDiffHeightEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx],
+                        1),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+
+            }
+        }
+    }
+
+    private String createBedDiffHeightDescription(
+        CallMeta meta,
+        BedDiffYearResult result,
+        int ndx
+    ) {
+        String range = result.getStart() + " - " + result.getEnd();
+
+        if (ndx == 0) {
+            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT1,
+                I18N_FACET_BED_DIFF_HEIGHT1, new Object[] { range });
+        }
+        else {
+            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT2,
+                I18N_FACET_BED_DIFF_HEIGHT2, new Object[] {range});
+        }
+    }
+
+    private String createBedDiffHeightEpochDescription(
+        CallMeta meta,
+        BedDiffEpochResult result,
+        int ndx
+    ) {
+        DateFormat df = Formatter.getDateFormatter(meta, "yyyy");
+        String range =
+            df.format(result.getStart())
+            + " - " +
+            df.format(result.getEnd());
+
+        if (ndx == 0) {
+            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT1,
+                I18N_FACET_BED_DIFF_HEIGHT1, new Object[] { range });
+        }
+        else {
+            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT2,
+                I18N_FACET_BED_DIFF_HEIGHT2, new Object[] {range});
+        }
+    }
+
+    protected String createBedDiffYearDescription(
+        CallMeta meta,
+        BedDiffYearResult result) {
+        String range = result.getStart() + " - " + result.getEnd();
+
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_YEAR,
+            I18N_FACET_BED_DIFF_YEAR, new Object[] { range });
+    }
+
+    protected String createBedDiffMorphDescription(
+        CallMeta meta,
+        BedDiffYearResult result) {
+        String range = result.getStart() + " - " + result.getEnd();
+
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_MORPH,
+            I18N_FACET_BED_DIFF_MORPH, new Object[] { range });
+    }
+
+    protected String createBedDiffAbsoluteDescription(
+        CallMeta meta,
+        BedDiffYearResult result) {
+        String range = result.getStart() + " - " + result.getEnd();
+
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_ABSOLUTE,
+            I18N_FACET_BED_DIFF_ABSOLUTE, new Object[] { range });
+    }
+
+    protected String createBedDiffEpochDescription(
+        CallMeta meta,
+        BedDiffEpochResult result) {
+        DateFormat df = Formatter.getDateFormatter(meta, "yyyy");
+        String range =
+            df.format(result.getStart())
+            + " - " +
+            df.format(result.getEnd());
+
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_EPOCH,
+            I18N_FACET_BED_DIFF_EPOCH, new Object[] { range });
+    }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -338,7 +338,7 @@
                 series.setLabel(series.getLabel() + ", " + labelAdd);
             }
         }
-        if (ThemeUtil.parseShowLevel(theme) && lines.points.length >0
+        if (ThemeUtil.parseShowLevel(theme) && lines.points.length > 1
                 && lines.points[1].length > 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "W=" + nf.format(lines.points[1][0]) + "NN+m";
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -99,7 +99,7 @@
 
         if (nativeFacet instanceof WMSLayerFacet) {
             WMSLayerFacet wms = (WMSLayerFacet) nativeFacet;
-            Envelope   extent = wms.getExtent();
+            Envelope   extent = wms.getOriginalExtent();
 
             layers.add(wms);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -212,7 +212,7 @@
 
         XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
 
-        StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), true);
+        StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(), false);
 
         addAxisSeries(series, YAXIS.H.idx, visible);
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,7 +1,37 @@
 package de.intevation.flys.exports;
 
+import java.awt.Color;
+import java.awt.Font;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.swing.ImageIcon;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.LegendItem;
+import org.jfree.chart.annotations.XYAnnotation;
+import org.jfree.chart.annotations.XYImageAnnotation;
+import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.ValueAxis;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.data.Range;
+import org.jfree.data.general.Series;
+import org.jfree.data.xy.XYDataset;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-
 import de.intevation.flys.jfree.Bounds;
 import de.intevation.flys.jfree.CollisionFreeXYTextAnnotation;
 import de.intevation.flys.jfree.DoubleBounds;
@@ -9,47 +39,6 @@
 import de.intevation.flys.jfree.StyledAreaSeriesCollection;
 import de.intevation.flys.jfree.StyledXYSeries;
 
-import java.awt.Color;
-import java.awt.Font;
-import javax.swing.ImageIcon;
-
-import java.text.NumberFormat;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import org.jfree.chart.ChartFactory;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.LegendItem;
-
-import org.jfree.chart.annotations.XYAnnotation;
-import org.jfree.chart.annotations.XYImageAnnotation;
-import org.jfree.chart.annotations.XYTextAnnotation;
-
-import org.jfree.chart.axis.NumberAxis;
-import org.jfree.chart.axis.ValueAxis;
-
-import org.jfree.chart.plot.Marker;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
-
-import org.jfree.data.Range;
-
-import org.jfree.data.general.Series;
-
-import org.jfree.data.xy.XYDataset;
-import org.jfree.data.xy.XYSeries;
-import org.jfree.data.xy.XYSeriesCollection;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-
-import org.w3c.dom.Document;
-
 
 /**
  * An abstract base class for creating XY charts.
@@ -71,10 +60,13 @@
     public class XYAxisDataset implements AxisDataset {
         /** Symbolic integer, but also coding the priority (0 goes first). */
         protected int axisSymbol;
+
         /** List of assigned datasets (in order). */
         protected List<XYDataset> datasets;
+
         /** Range to use to include all given datasets. */
         protected Range range;
+
         /** Index of axis in plot. */
         protected int plotAxisIndex;
 
@@ -130,17 +122,19 @@
         /** Get Array of Datasets. */
         @Override
         public XYDataset[] getDatasets() {
-            return (XYDataset[])
-                datasets.toArray(new XYDataset[datasets.size()]);
+            return datasets.toArray(new XYDataset[datasets.size()]);
         }
 
 
         /** Add a Dataset that describes an area. */
         public void addArea(StyledAreaSeriesCollection series) {
             this.datasets.add(series);
+            List<?> allSeries = series.getSeries();
+            for (int n = 0; n < allSeries.size(); n++) {
+                includeYRange((XYSeries)allSeries.get(n));
+            }
         }
 
-        // TODO obsolete?
         /** True if to be rendered as area. */
         @Override
         public boolean isArea(XYDataset series) {
@@ -172,6 +166,7 @@
     } // class AxisDataset
 
     /** Enumerator over existing axes. */
+    @Override
     protected abstract YAxisWalker getYAxisWalker();
 
     public static final int AXIS_SPACE = 5;
@@ -200,6 +195,7 @@
     /**
      * Generate the chart anew (including localized axis and all).
      */
+    @Override
     public JFreeChart generateChart() {
         logger.debug("XYChartGenerator.generateChart");
 
@@ -479,7 +475,7 @@
     /**
      * Add given series if visible, if not visible adjust ranges (such that
      * all points in data would be plotted once visible).
-     * @param series the dataseries to include in plot.
+     * @param series the data series to include in plot.
      * @param index  ('symbolic') index of the series and of its axis.
      * @param visible whether or not the data should be plotted.
      */
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java	Fri Sep 28 12:15:45 2012 +0200
@@ -197,8 +197,8 @@
                         }
                     }
                 }
-                ++analysisCount;
             }
+            ++analysisCount;
         }
         writer.flush();
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java	Fri Sep 28 12:15:45 2012 +0200
@@ -18,8 +18,10 @@
 
 import org.apache.log4j.Logger;
 
+/** Export Fixation Analysis Results to AT. */
 public class FixATWriter
 {
+    /** Private logger. */
     private static Logger log = Logger.getLogger(FixATWriter.class);
 
     public static final String I18N_HEADER_KEY =
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,9 +1,11 @@
 package de.intevation.flys.exports.fixings;
 
 import java.io.OutputStream;
+import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 
@@ -195,6 +197,14 @@
                     theme,
                     visible);
         }
+        else if (name.equals(FIX_REFERENCE_PERIOD_DWT)) {
+            doReferencePeriodsOut(
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
+        }
         else if (FacetTypes.IS.MANUALPOINTS(name)) {
             doPoints (artifactFacet.getData(context),
                     artifactFacet,
@@ -207,6 +217,28 @@
     }
 
 
+    protected void doReferencePeriodsOut(
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible)
+    {
+        logger.debug("doReferencePeriodsOut()");
+
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        DateRange refRange  = access.getReferencePeriod();
+
+        RegularTimePeriod start = new Day(refRange.getFrom());
+        RegularTimePeriod end = new Day(refRange.getTo());
+        StyledDomainMarker marker = new StyledDomainMarker(
+                start.getMiddleMillisecond(),
+                end.getMiddleMillisecond(),
+                theme);
+        domainMarker.add(marker);
+    }
+
+
     protected void doSectorAverageOut(
             FLYSArtifact artifact,
             Object       data,
@@ -325,14 +357,18 @@
             return;
         }
 
+        Locale locale = Resources.getLocale(context.getMeta());
+        NumberFormat nf = NumberFormat.getInstance(locale);
+
         List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
         Set<Map.Entry<Integer, int[]>> entries = annoIdxMap.entrySet();
 
         for(Map.Entry<Integer, int[]> entry : entries) {
             int[] idxs = entry.getValue();
             double x = tsc.getXValue(idxs[0], idxs[1]);
+
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-                    qwd.getQ() + " m\u00B3/s",
+                    nf.format(qwd.getQ()) + " m\u00B3/s",
                     x,
                     qwd.getDeltaW());
             textAnnos.add(anno);
@@ -385,10 +421,8 @@
             Object       data,
             String       desc,
             Document     theme,
-            boolean      visible
-            ) {
-        logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc);
-
+            boolean      visible)
+    {
         DateRange[] ranges = (DateRange[]) data;
         if (ranges == null || !visible) {
             return;
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -21,6 +21,7 @@
 extends FixChartGenerator
 implements FacetTypes
 {
+    /** Private logger. */
     private static Logger logger =
             Logger.getLogger(FixDerivedCurveGenerator.class);
 
@@ -134,5 +135,4 @@
         };
     }
 }
-
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -154,7 +154,6 @@
         XYSeries lower =
                 new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
-
         for (KMIndex.Entry<AnalysisPeriod> entry: kms) {
             double km = entry.getKm();
             AnalysisPeriod ap = entry.getValue();
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -14,6 +14,7 @@
 import org.jfree.chart.title.TextTitle;
 import org.jfree.data.xy.XYSeries;
 import org.jfree.ui.RectangleAnchor;
+import org.jfree.ui.RectangleInsets;
 import org.jfree.ui.TextAnchor;
 import org.w3c.dom.Document;
 
@@ -323,6 +324,7 @@
             }
             m.setLabelAnchor(RectangleAnchor.TOP_LEFT);
             m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
+            m.setLabelOffset(new RectangleInsets(5, 5, 10, 10));
             addDomainMarker(m);
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffEpochInfoGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,12 @@
+package de.intevation.flys.exports.minfo;
+
+import de.intevation.flys.exports.ChartInfoGenerator;
+
+
+public class BedDiffEpochInfoGenerator
+extends ChartInfoGenerator
+{
+   public BedDiffEpochInfoGenerator() {
+        super(new BedDifferenceEpochGenerator());
+   }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,113 @@
+package de.intevation.flys.exports.minfo;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+import org.w3c.dom.Document;
+
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
+import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledXYSeries;
+
+
+public class BedDiffHeightYearGenerator
+extends XYChartGenerator
+implements FacetTypes
+{
+    public enum YAXIS {
+        D(0);
+
+        protected int idx;
+
+        private YAXIS(int c) {
+            idx = c;
+        }
+    }
+
+    /** The logger that is used in this generator. */
+    private static Logger logger = Logger.getLogger(BedDiffHeightYearGenerator.class);
+
+    public static final String I18N_CHART_TITLE = "chart.beddifference.height.title";
+    public static final String I18N_XAXIS_LABEL = "chart.beddifference.height.xaxis.label";
+    public static final String I18N_YAXIS_LABEL = "chart.beddifference.height.yaxis.label";
+
+    public static final String I18N_CHART_TITLE_DEFAULT = "Sohlenhöhen Differenz";
+    public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
+    public static final String I18N_YAXIS_LABEL_DEFAULT = "delta S [cm / Jahr]";
+
+    @Override
+    protected YAxisWalker getYAxisWalker() {
+        return new YAxisWalker() {
+
+            @Override
+            public int length() {
+                return YAXIS.values().length;
+            }
+
+            @Override
+            public String getId(int idx) {
+                YAXIS[] yaxes = YAXIS.values();
+                return yaxes[idx].toString();
+            }
+        };
+    }
+
+    @Override
+    public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) {
+        String name = bundle.getFacetName();
+
+        logger.debug("doOut: " + name);
+
+        if (name == null) {
+            logger.error("No facet name for doOut(). No output generated!");
+            return;
+        }
+
+        Facet facet = bundle.getFacet();
+
+        if (facet == null) {
+            return;
+        }
+
+        if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+            doAnnotations(
+                (FLYSAnnotation) bundle.getData(context),
+                 bundle,
+                 attr,
+                 visible);
+        }
+    }
+
+    @Override
+    protected String getDefaultChartTitle() {
+        return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultYAxisLabel(int pos) {
+        return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+    }
+
+    protected void doBedDifferenceYearOut(BedDiffYearResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getHeightPerYearData(), true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearInfoGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,12 @@
+package de.intevation.flys.exports.minfo;
+
+import de.intevation.flys.exports.ChartInfoGenerator;
+
+
+public class BedDiffHeightYearInfoGenerator
+extends ChartInfoGenerator
+{
+    public BedDiffHeightYearInfoGenerator() {
+        super (new BedDiffHeightYearGenerator());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffYearInfoGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,12 @@
+package de.intevation.flys.exports.minfo;
+
+import de.intevation.flys.exports.ChartInfoGenerator;
+
+
+public class BedDiffYearInfoGenerator
+extends ChartInfoGenerator
+{
+    public BedDiffYearInfoGenerator() {
+        super(new BedDifferenceYearGenerator());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,151 @@
+package de.intevation.flys.exports.minfo;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+import org.w3c.dom.Document;
+
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.BedDiffEpochResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
+import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledXYSeries;
+
+
+public class BedDifferenceEpochGenerator
+extends XYChartGenerator
+implements FacetTypes
+{
+    public enum YAXIS {
+        D(0), H(1);
+
+        protected int idx;
+
+        private YAXIS(int c) {
+            idx = c;
+        }
+    }
+
+    /** The logger that is used in this generator. */
+    private static Logger logger = Logger.getLogger(BedQualityGenerator.class);
+
+    public static final String I18N_CHART_TITLE = "chart.beddifference.epoch.title";
+    public static final String I18N_XAXIS_LABEL = "chart.beddifference.xaxis.label";
+    public static final String I18N_YAXIS_LABEL = "chart.beddifference.yaxis.label.diff";
+    public static final String I18N_SECOND_YAXIS_LABEL = "chart.beddifference.yaxis.label.height";
+
+    public static final String I18N_CHART_TITLE_DEFAULT = "Sohlenhöhen Differenz";
+    public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
+    public static final String I18N_YAXIS_LABEL_DEFAULT = "delta S [m]";
+    public static final String I18N_SECOND_YAXIS_LABEL_DEFAULT = "Höhe [m]";
+
+    @Override
+    protected YAxisWalker getYAxisWalker() {
+        return new YAxisWalker() {
+
+            @Override
+            public int length() {
+                return YAXIS.values().length;
+            }
+
+            @Override
+            public String getId(int idx) {
+                YAXIS[] yaxes = YAXIS.values();
+                return yaxes[idx].toString();
+            }
+        };
+    }
+
+    @Override
+    public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) {
+        String name = bundle.getFacetName();
+
+        logger.debug("doOut: " + name);
+
+        if (name == null) {
+            logger.error("No facet name for doOut(). No output generated!");
+            return;
+        }
+
+        Facet facet = bundle.getFacet();
+
+        if (facet == null) {
+            return;
+        }
+
+        if (name.equals(BED_DIFFERENCE_EPOCH)) {
+            doBedDifferenceEpochOut(
+                (BedDiffEpochResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1)) {
+            doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context),
+                bundle, attr, visible, 0);
+        }
+        else if (name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2)) {
+            doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context),
+                bundle, attr, visible, 1);
+        }
+        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+            doAnnotations(
+                (FLYSAnnotation) bundle.getData(context),
+                 bundle,
+                 attr,
+                 visible);
+        }
+    }
+
+    @Override
+    protected String getDefaultChartTitle() {
+        return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultYAxisLabel(int pos) {
+        String label = "default";
+        if (pos == YAXIS.D.idx) {
+            label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+        }
+        else if (pos == YAXIS.H.idx) {
+            label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT);
+        }
+
+        return label;
+    }
+
+    protected void doBedDifferenceEpochOut(BedDiffEpochResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    private void doBedDifferenceHeightsOut(
+        BedDiffEpochResult data,
+        ArtifactAndFacet bundle,
+        Document attr,
+        boolean visible,
+        int idx) {
+         logger.debug("doBedDifferenceHeightOut()");
+
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), attr);
+        if (idx == 0) {
+            StyledSeriesBuilder.addPoints(series, data.getHeights1Data(), true);
+        }
+        else {
+            StyledSeriesBuilder.addPoints(series, data.getHeights2Data(), true);
+        }
+
+        addAxisSeries(series, YAXIS.H.idx, visible);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,173 @@
+package de.intevation.flys.exports.minfo;
+
+import org.apache.log4j.Logger;
+import org.jfree.data.xy.XYSeries;
+import org.w3c.dom.Document;
+
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.BedDiffYearResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
+import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledXYSeries;
+
+
+public class BedDifferenceYearGenerator
+extends XYChartGenerator
+implements FacetTypes
+{
+    public enum YAXIS {
+        D(0), M(1), H(2);
+
+        protected int idx;
+
+        private YAXIS(int c) {
+            idx = c;
+        }
+    }
+
+    /** The logger that is used in this generator. */
+    private static Logger logger = Logger.getLogger(BedDifferenceYearGenerator.class);
+
+    public static final String I18N_CHART_TITLE = "chart.beddifference.year.title";
+    public static final String I18N_XAXIS_LABEL = "chart.beddifference.xaxis.label";
+    public static final String I18N_YAXIS_LABEL = "chart.beddifference.yaxis.label.diff";
+    public static final String I18N_SECOND_YAXIS_LABEL = "chart.beddifference.yaxis.label.morph";
+    public static final String I18N_THIRD_YAXIS_LABEL = "chart.beddifference.yaxis.label.heights";
+
+    public static final String I18N_CHART_TITLE_DEFAULT = "Sohlenhöhen Differenz";
+    public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
+    public static final String I18N_YAXIS_LABEL_DEFAULT = "delta S [m]";
+    public static final String I18N_SECOND_YAXIS_LABEL_DEFAULT = "Morph. Breite [m]";
+    public static final String I18N_THIRD_YAXIS_LABEL_DEFAULT = "Höhe [m]";
+
+    @Override
+    protected YAxisWalker getYAxisWalker() {
+        return new YAxisWalker() {
+
+            @Override
+            public int length() {
+                return YAXIS.values().length;
+            }
+
+            @Override
+            public String getId(int idx) {
+                YAXIS[] yaxes = YAXIS.values();
+                return yaxes[idx].toString();
+            }
+        };
+    }
+
+    @Override
+    public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) {
+        String name = bundle.getFacetName();
+
+        logger.debug("doOut: " + name);
+
+        if (name == null) {
+            logger.error("No facet name for doOut(). No output generated!");
+            return;
+        }
+
+        Facet facet = bundle.getFacet();
+
+        if (facet == null) {
+            return;
+        }
+
+        if (name.equals(BED_DIFFERENCE_YEAR)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_MORPH_WIDTH)) {
+            doBedDifferenceMorphWidthOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_HEIGHT1)) {
+            doBedDifferenceHeightsOut(
+                (BedDiffYearResult)bundle.getData(context),
+                bundle, attr, visible, 0);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_HEIGHT2)) {
+            doBedDifferenceHeightsOut(
+                (BedDiffYearResult)bundle.getData(context),
+                bundle, attr, visible, 1);
+        }
+        else if (name.equals(LONGITUDINAL_ANNOTATION)) {
+            doAnnotations(
+                (FLYSAnnotation) bundle.getData(context),
+                 bundle,
+                 attr,
+                 visible);
+        }
+    }
+
+    private void doBedDifferenceHeightsOut(
+        BedDiffYearResult data,
+        ArtifactAndFacet bundle,
+        Document attr,
+        boolean visible,
+        int idx) {
+         logger.debug("doBedDifferenceYearOut()");
+
+        XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), attr);
+        if (idx == 0) {
+            StyledSeriesBuilder.addPoints(series, data.getHeights1Data(), true);
+        }
+        else {
+            StyledSeriesBuilder.addPoints(series, data.getHeights2Data(), true);
+        }
+
+        addAxisSeries(series, YAXIS.H.idx, visible);
+    }
+
+    @Override
+    protected String getDefaultChartTitle() {
+        return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultYAxisLabel(int pos) {
+        String label = "default";
+        if (pos == YAXIS.D.idx) {
+            label = msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+        }
+        else if (pos == YAXIS.M.idx) {
+            label = msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT);
+        }
+        else if (pos == YAXIS.H.idx) {
+            label = msg(I18N_THIRD_YAXIS_LABEL, I18N_THIRD_YAXIS_LABEL_DEFAULT);
+        }
+
+        return label;
+    }
+
+    protected void doBedDifferenceYearOut(BedDiffYearResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("doBedDifferenceYearOut()");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    protected void doBedDifferenceMorphWidthOut(BedDiffYearResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("doBedDifferencesMorphWidthOut()");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getMorphWidthData(), true);
+
+        addAxisSeries(series, YAXIS.M.idx, visible);
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java	Fri Sep 28 12:15:45 2012 +0200
@@ -197,17 +197,17 @@
                 }
                 if (params.length > 0) {
                     header.add(
-                        msg(CSV_HEADER_DENSITY_CAP, CSV_HEADER_DENSITY_CAP));// +
-                        //" - " + d1 + "-" + d2);
+                        msg(CSV_HEADER_DENSITY_CAP, CSV_HEADER_DENSITY_CAP) +
+                        " - " + d1 + "-" + d2);
                     header.add(
-                        msg(CSV_HEADER_DENSITY_SUB, CSV_HEADER_DENSITY_SUB)); //+
-                        //" - " + d1 + "-" + d2);
+                        msg(CSV_HEADER_DENSITY_SUB, CSV_HEADER_DENSITY_SUB) +
+                        " - " + d1 + "-" + d2);
                     header.add(
-                        msg(CSV_HEADER_POROSITY_CAP, CSV_HEADER_POROSITY_CAP)); //+
-                        //" - " + d1 + "-" + d2);
+                        msg(CSV_HEADER_POROSITY_CAP, CSV_HEADER_POROSITY_CAP) +
+                        " - " + d1 + "-" + d2);
                     header.add(
-                        msg(CSV_HEADER_POROSITY_SUB, CSV_HEADER_POROSITY_SUB));// +
-                        //" - " + d1 + "-" + d2);
+                        msg(CSV_HEADER_POROSITY_SUB, CSV_HEADER_POROSITY_SUB) +
+                        " - " + d1 + "-" + d2);
                 }
             }
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Fri Sep 28 12:15:45 2012 +0200
@@ -4,7 +4,6 @@
 import java.awt.Color;
 import java.awt.Stroke;
 
-import org.apache.log4j.Logger;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.w3c.dom.Document;
 
@@ -20,6 +19,8 @@
  * dataset.
  */
 public class StyledAreaSeriesCollection extends XYSeriesCollection {
+    private static final long serialVersionUID = 5274940965666948237L;
+
     /** Mode, how to draw/which areas to fill. */
     public enum FILL_MODE {UNDER, ABOVE, BETWEEN};
 
@@ -29,10 +30,6 @@
     /** The theme-document with attributes about actual visual representation. */
     protected Document theme;
 
-    /** Own logger. */
-    private static final Logger logger =
-        Logger.getLogger(StyledAreaSeriesCollection.class);
-
 
     /**
      * @param theme the theme-document.
@@ -85,17 +82,19 @@
     }
 
 
-    /**
-     * Blindly (for now) apply the positivepaint of renderer.
-     */
     protected void applyFillColor(StableXYDifferenceRenderer renderer) {
-        // Get color.
-        Color paint = ThemeUtil.parseFillColorField(theme);
-        // Get half-transparency flag.
-        if (ThemeUtil.parseTransparency(theme)) {
-            paint = new Color(paint.getRed(), paint.getGreen(), paint.getBlue(),
-                128);
+        Color paint = ThemeUtil.parseColor(
+                ThemeUtil.getBackgroundColorString(theme));
+
+        int transparency = ThemeUtil.parseTransparency(theme);
+        if (transparency > 0) {
+            paint = new Color(
+                        paint.getRed(),
+                        paint.getGreen(),
+                        paint.getBlue(),
+                        (int)((100 - transparency) * 2.55f));
         }
+
         if (paint != null && this.getMode() == FILL_MODE.ABOVE) {
             renderer.setPositivePaint(paint);
             renderer.setNegativePaint(new Color(0,0,0,0));
@@ -105,15 +104,14 @@
             renderer.setPositivePaint(new Color(0,0,0,0));
         }
         else {
-            if (paint == null) paint = new Color(177, 117, 102);
+            if (paint == null)
+                paint = new Color(177, 117, 102);
             renderer.setPositivePaint(paint);
             renderer.setNegativePaint(paint);
         }
     }
 
-    /**
-     * Blindly (for now) apply the postiviepaint of renderer.
-     */
+
     protected void applyShowShape(StableXYDifferenceRenderer renderer) {
         boolean show = ThemeUtil.parseShowBorder(theme);
         renderer.setDrawOutline(show);
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Fri Sep 28 12:15:45 2012 +0200
@@ -9,6 +9,7 @@
 
 /**
  * Marker that represents a highlighted interval.
+ *
  * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
  */
 public class StyledDomainMarker extends IntervalMarker {
@@ -26,7 +27,8 @@
                 ThemeUtil.getFillColorString(theme));
         useSecondColor(false);
 
-        int alpha = 100 - ThemeUtil.parseInteger(ThemeUtil.getTransparency(theme), 50);
+        int alpha = 100 - ThemeUtil.parseInteger(
+                ThemeUtil.getTransparencyString(theme), 50);
         setAlpha(alpha / 100.0f);
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Sep 28 12:15:45 2012 +0200
@@ -72,9 +72,6 @@
     public final static String XPATH_SHOW_LEVEL =
             "/theme/field[@name='showlevel']/@default";
 
-    public final static String XPATH_TRANSPARENT =
-            "/theme/field[@name='transparent']/@default";
-
     public final static String XPATH_TRANSPARENCY =
             "/theme/field[@name='transparency']/@default";
 
@@ -556,11 +553,6 @@
     }
 
 
-    public static String getTransparency(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY, null);
-    }
-
-
     public static String getShowMinimum(Document theme) {
         return XMLUtils.xpathString(theme, XPATH_SHOW_MINIMUM, null);
     }
@@ -586,8 +578,8 @@
     }
 
 
-    public static boolean parseTransparency(Document theme) {
-        return parseBoolean(getTransparencyString(theme), false);
+    public static int parseTransparency(Document theme) {
+        return parseInteger(getTransparencyString(theme), 50);
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -94,6 +94,7 @@
         Envelope envB = b.getGeom().getEnvelopeInternal();
 
         envA.expandToInclude(envB);
+        envA = GeometryUtils.transform(envA, getSrid());
 
         logger.debug("###    => " + envA);
 
@@ -130,6 +131,7 @@
         wsplgen.addLayer(
             MapfileGenerator.MS_WSPLGEN_PREFIX + artifact.identifier());
         wsplgen.setSrid(getSrid());
+        wsplgen.setOriginalExtent(bounds);
         wsplgen.setExtent(bounds);
 
         tmpFacets.add(wsplgen);
--- a/flys-artifacts/src/main/resources/messages.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Reference period
 state.fix.analysis.analysisperiods = Analysis period
 state.fix.analysis.function = Function
-state.fix.analysis.preprocessing = Preprocessing
+state.fix.analysis.preprocessing = Outliers
 state.fix.preprocess=preprocess
 state.fix.vollmer.function=Function
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Outliers
 state.fix.vollmer.qa = Input for W/Q data
 
 state.minfo.river = River
@@ -184,6 +184,13 @@
 chart.bedquality.yaxis.label.porosity=Porosity [%]
 chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
 
+chart.bedheight_middle.section.title=Middle Bed Height
+chart.bedheight_middle.section.yaxis.label=middle Bed Height [mm a NN]
+
+chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung
+chart.flow_velocity.section.yaxis.label=Speed v [m/s]
+chart.flow_velocity.section.yaxis.second.label=Schubspannung Tau [N]
+
 chart.sq_relation.xaxis.label = Discharge [m\u00b3/s]
 chart.sq_relation.yaxis.label = Transport [kg/s]
 chart.sq_relation_a.title = Feinkornanteil
@@ -215,6 +222,26 @@
 facet.bedquality.bedload.diameter = {0}_Bedload
 bedquality.toplayer = 0.0m - 0.3m
 bedquality.sublayer = 0.1m - 0.5m
+facet.bedheight.diff.year = Bedheight Difference {0}
+facet.bedheight.diff.morph = Morphologic Width {0}
+facet.bedheight.diff.height1 = Original Height Minuend {0}
+facet.bedheight.diff.height2 = Original Height Subtrahend {0}
+facet.bedheight.diff.absolute = Bedheight Difference/Year {0}
+facet.bedheight.diff.epoch = Bedheight Difference {0}
+
+chart.beddifference.height.title = Bedheight Difference
+chart.beddifference.height.xaxis.label = River-Km [km]
+chart.beddifference.height.yaxis.label = Difference [cm/year]
+chart.beddifference.epoch.title = Bedheight Difference
+chart.beddifference.xaxis.label = River-Km [km]
+chart.beddifference.yaxis.label.diff = Difference [m]
+chart.beddifference.yaxis.label.height = Absolute Height [m]
+chart.beddifference.year.title = Bedheight Difference
+chart.beddifference.xaxis.label = River-Km [km]
+chart.beddifference.yaxis.label.diff = Difference [m]
+chart.beddifference.yaxis.label.morph = Morphologic Width [m]
+chart.beddifference.yaxis.label.heights = Absolute Height [m]
+
 
 export.waterlevel.csv.header.km = River-Km
 export.waterlevel.csv.header.w = W [NN + m]
@@ -294,6 +321,14 @@
 export.sqrelation.csv.header.c.duan = C (DUAN)
 export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
 export.sqrelation.csv.header.variance = Standard variance
+export.minfo.bedquality.km = km
+export.minfo.bedquality.density_cap = Density Toplayer
+export.minfo.bedquality.density_sub = Density Sublayer
+export.minfo.bedquality.porosity_cap = Porosity Toplayer
+export.minfo.bedquality.porosity_sub = Porosity Sublayer
+export.minfo.bedquality.bedload = Bedload Diameter
+export.minfo.bedquality.bed_cap = Bed Diameter Toplayer
+export.minfo.bedquality.bed_sub = Bed Diameter Sublayer
 
 floodmap.wmsbackground = Background Map
 floodmap.riveraxis = River Axis
--- a/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Bezugszeitraum
 state.fix.analysis.analysisperiods = Analysezeitr\u00e4ume
 state.fix.analysis.function = Funktion
-state.fix.analysis.preprocessing = Aufbereiten
+state.fix.analysis.preprocessing = Ausrei\u00DFer
 state.fix.preprocess=aufbereiten
 state.fix.vollmer.function=Funktion
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Ausrei\u00DFer
 state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten
 
 state.minfo.river = Gew\u00e4sser
@@ -184,6 +184,13 @@
 chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
 chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
 
+chart.bedheight_middle.section.title=Mittlere Sohlh\u00f6he
+chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [mm\u00fcNN]
+
+chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung
+chart.flow_velocity.section.yaxis.label=Geschwindigkeit v [m/s]
+chart.flow_velocity.section.yaxis.second.label=Schubspannung Tau [N]
+
 chart.sq_relation.xaxis.label = Abfluss [m\u00b3/s]
 chart.sq_relation.yaxis.label = Transport [kg/s]
 chart.sq_relation_a.title = Feinkornanteil
@@ -215,6 +222,25 @@
 facet.bedquality.bedload.diameter = {0}_Geschiebe
 bedquality.toplayer = 0,0m - 0,3m
 bedquality.sublayer = 0,1m - 0,5m
+facet.bedheight.diff.year = Sohlh\u00f6hendiffernez {0}
+facet.bedheight.diff.morph = Morphologische Breite {0}
+facet.bedheight.diff.height1 = H\u00f6he Minuend {0}
+facet.bedheight.diff.height2 = H\u00f6he Subtrahend {0}
+facet.bedheight.diff.absolute = Sohlh\u00f6hendifferenz/Jahr {0}
+facet.bedheight.diff.epoch = Sohlh\u00f6hendifferenz {0}
+
+chart.beddifference.height.title = Sohlh\u00f6hendifferenz
+chart.beddifference.height.xaxis.label = Fluss-Km [km]
+chart.beddifference.height.yaxis.label = Differenz [cm/Jahr]
+chart.beddifference.epoch.title = Sohlh\u00f6hendifferenz
+chart.beddifference.xaxis.label = Fluss-Km [km]
+chart.beddifference.yaxis.label.diff = Differenz [m]
+chart.beddifference.yaxis.label.height = Absolute H\u00f6he [m]
+chart.beddifference.year.title = Sohlh\u00f6hendifferenz
+chart.beddifference.xaxis.label = Fluss-Km [km]
+chart.beddifference.yaxis.label.diff = Differenz [m]
+chart.beddifference.yaxis.label.morph = Morphologische Breite [m]
+chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
 export.waterlevel.csv.header.w = W [NN + m]
@@ -295,6 +321,14 @@
 export.sqrelation.csv.header.c.duan = C (DUAN)
 export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
 export.sqrelation.csv.header.variance = Standardabweichung
+export.minfo.bedquality.km = km
+export.minfo.bedquality.density_cap = Sedimentdichte Deckschicht
+export.minfo.bedquality.density_sub = Sedimentdichte Unterschicht
+export.minfo.bedquality.porosity_cap = Porosit\u00e4t Deckschicht
+export.minfo.bedquality.porosity_sub = Porosit\u00e4t Unterschicht
+export.minfo.bedquality.bedload = Geschiebedurchmesser
+export.minfo.bedquality.bed_cap = Sohldurchmesser Deckschicht
+export.minfo.bedquality.bed_sub = Sohldurchmesser Unterschicht
 
 floodmap.wmsbackground = Hintergrundkarte
 floodmap.riveraxis = Flussachse
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -30,10 +30,10 @@
 state.fix.analysis.referenceperiod = Bezugszeitraum
 state.fix.analysis.analysisperiods = Analysezeitr\u00e4ume
 state.fix.analysis.function = Funktion
-state.fix.analysis.preprocessing = Aufbereitung
+state.fix.analysis.preprocessing = Ausrei\u00DFer
 state.fix.preprocess=aufbereiten
 state.fix.vollmer.function=Funktion
-state.fix.vollmer.preprocessing = Aufbereiten
+state.fix.vollmer.preprocessing = Ausrei\u00DFer
 state.fix.vollmer.qa = Eingabe f\u00e4r W/Q Daten
 
 state.minfo.river = Gew\u00e4sser
@@ -182,6 +182,13 @@
 chart.bedquality.yaxis.label.porosity=Porosit\u00e4t [%]
 chart.bedquality.yaxis.label.density=Dichte [t/m\u00b3]
 
+chart.bedheight_middle.section.title=Mittlere Sohlh\u00f6he
+chart.bedheight_middle.section.yaxis.label=mittlere Sohlh\u00f6hen [mm\u00fcNN]
+
+chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung
+chart.flow_velocity.section.yaxis.label=Geschwindigkeit v [m/s]
+chart.flow_velocity.section.yaxis.second.label=Schubspannung Tau [N]
+
 chart.sq_relation.xaxis.label = Abfluss [m\u00b3/s]
 chart.sq_relation.yaxis.label = Transport [kg/s]
 chart.sq_relation_a.title = Feinkornanteil
@@ -213,6 +220,25 @@
 facet.bedquality.bedload.diameter = {0}_Geschiebe
 bedquality.toplayer = 0,0m - 0,3m
 bedquality.sublayer = 0,1m - 0,5m
+facet.bedheight.diff.year = Sohlh\u00f6hendiffernez {0}
+facet.bedheight.diff.morph = Morphologische Breite {0}
+facet.bedheight.diff.height1 = H\u00f6he Minuend {0}
+facet.bedheight.diff.height2 = H\u00f6he Subtrahend {0}
+facet.bedheight.diff.absolute = Sohlh\u00f6hendifferenz/Jahr {0}
+facet.bedheight.diff.epoch = Sohlh\u00f6hendifferenz {0}
+
+chart.beddifference.height.title = Sohlh\u00f6hendifferenz
+chart.beddifference.height.xaxis.label = Fluss-Km [km]
+chart.beddifference.height.yaxis.label = Differenz [cm/Jahr]
+chart.beddifference.epoch.title = Sohlh\u00f6hendifferenz
+chart.beddifference.xaxis.label = Fluss-Km [km]
+chart.beddifference.yaxis.label.diff = Differenz [m]
+chart.beddifference.yaxis.label.height = Absolute H\u00f6he [m]
+chart.beddifference.year.title = Sohlh\u00f6hendifferenz
+chart.beddifference.xaxis.label = Fluss-Km [km]
+chart.beddifference.yaxis.label.diff = Differenz [m]
+chart.beddifference.yaxis.label.morph = Morphologische Breite [m]
+chart.beddifference.yaxis.label.heights = Absolute H\u00f6he [m]
 
 export.waterlevel.csv.header.km = Fluss-Km
 export.waterlevel.csv.header.w = W [NN + m]
@@ -292,6 +318,14 @@
 export.sqrelation.csv.header.c.duan = C (DUAN)
 export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
 export.sqrelation.csv.header.variance = Standardabweichung
+export.minfo.bedquality.km = km
+export.minfo.bedquality.density_cap = Sedimentdichte Deckschicht
+export.minfo.bedquality.density_sub = Sedimentdichte Unterschicht
+export.minfo.bedquality.porosity_cap = Porosit\u00e4t Deckschicht
+export.minfo.bedquality.porosity_sub = Porosit\u00e4t Unterschicht
+export.minfo.bedquality.bedload = Geschiebedurchmesser
+export.minfo.bedquality.bed_cap = Sohldurchmesser Deckschicht
+export.minfo.bedquality.bed_sub = Sohldurchmesser Unterschicht
 
 floodmap.wmsbackground = Hintergrundkarte
 floodmap.riveraxis = Flussachse
--- a/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -30,11 +30,11 @@
 state.fix.analysis.referenceperiod = Reference period
 state.fix.analysis.analysisperiods = Analysis period
 state.fix.analysis.function = Function
-state.fix.analysis.preprocessing = Preprocessing
+state.fix.analysis.preprocessing = Outliers
 state.fix.preprocess=preprocess
 state.fix.vollmer.function=Function
-state.fix.vollmer.preprocessing = Aufbereiten
-state.fix.vollmer.qa = Eingabe for W/Q data
+state.fix.vollmer.preprocessing = Outliers
+state.fix.vollmer.qa = Input for W/Q data
 
 state.minfo.river = River
 state.minfo.calculation_mode = Calculation Mode
@@ -186,6 +186,13 @@
 chart.bedquality.yaxis.label.porosity=Porosity [%]
 chart.bedquality.yaxis.label.density=Density [t/m\u00b3]
 
+chart.bedheight_middle.section.title=Middle Bed Height
+chart.bedheight_middle.section.yaxis.label=middle Bed Height [mm a NN]
+
+chart.flow_velocity.section.title=Geschwindigkeit- und Schubspannung
+chart.flow_velocity.section.yaxis.label=Speed v [m/s]
+chart.flow_velocity.section.yaxis.second.label=Schubspannung Tau [N]
+
 chart.sq_relation.xaxis.label = Discharge [m\u00b3/s]
 chart.sq_relation.yaxis.label = Transport [kg/s]
 chart.sq_relation_a.title = Feinkornanteil
@@ -217,6 +224,25 @@
 facet.bedquality.bedload.diameter = {0}_Bedload
 bedquality.toplayer = 0.0m - 0.3m
 bedquality.sublayer = 0.1m - 0.5m
+facet.bedheight.diff.year = Bedheight Difference {0}
+facet.bedheight.diff.morph = Morphologic Width {0}
+facet.bedheight.diff.height1 = Original Height Minuend {0}
+facet.bedheight.diff.height2 = Original Height Subtrahend {0}
+facet.bedheight.diff.absolute = Bedheight Difference/Year {0}
+facet.bedheight.diff.epoch = Bedheight Difference {0}
+
+chart.beddifference.height.title = Bedheight Difference
+chart.beddifference.height.xaxis.label = River-Km [km]
+chart.beddifference.height.yaxis.label = Difference [cm/year]
+chart.beddifference.epoch.title = Bedheight Difference
+chart.beddifference.xaxis.label = River-Km [km]
+chart.beddifference.yaxis.label.diff = Difference [m]
+chart.beddifference.yaxis.label.height = Absolute Height [m]
+chart.beddifference.year.title = Bedheight Difference
+chart.beddifference.xaxis.label = River-Km [km]
+chart.beddifference.yaxis.label.diff = Difference [m]
+chart.beddifference.yaxis.label.morph = Morphologic Width [m]
+chart.beddifference.yaxis.label.heights = Absolute Height [m]
 
 export.waterlevel.csv.header.km = River-Km
 export.waterlevel.csv.header.w = W [NN + m]
@@ -296,6 +322,14 @@
 export.sqrelation.csv.header.c.duan = C (DUAN)
 export.sqrelation.csv.header.c.ferguson = C (FERGUSON)
 export.sqrelation.csv.header.variance = Standard variance
+export.minfo.bedquality.km = km
+export.minfo.bedquality.density_cap = Density Toplayer
+export.minfo.bedquality.density_sub = Density Sublayer
+export.minfo.bedquality.porosity_cap = Porosity Toplayer
+export.minfo.bedquality.porosity_sub = Porosity Sublayer
+export.minfo.bedquality.bedload = Bedload Diameter
+export.minfo.bedquality.bed_cap = Bed Diameter Toplayer
+export.minfo.bedquality.bed_sub = Bed Diameter Sublayer
 
 floodmap.wmsbackground = Background Map
 floodmap.riveraxis = River Axis
--- a/flys-backend/ChangeLog	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/ChangeLog	Fri Sep 28 12:15:45 2012 +0200
@@ -1,3 +1,183 @@
+2012-09-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/schema/postgresql-spatial.sql,
+	  doc/schema/oracle-spatial.sql: Changed the type of date columns to
+	  VARCHAR. This is a quick fix to solve the concatination problem in
+	  Oracle and PostgreSQL. Both aren't able to concatinate null values.
+	  So, null values are not valid for those columns. Users can now decide
+	  to fill these columns with correct values or an empty string.
+
+	* src/main/java/de/intevation/flys/utils/DgmSqlConverter.java: Set
+	  year_from and year_to values to an empty string if no correct value is
+	  specified.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	For issue862/1, fix parsing of year field of bed height csvs,
+	which sometimes contain non-year character.
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java:
+	  Extend RE to parse year field of Bed Height data csv.
+
+2012-09-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/RiverAxis.java:
+	  Added new method to query a special kind of river axes.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Backend-part for fix of issue863.
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java:
+	  Handle missing data points.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java:
+	  Doc.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java:
+	  Removed debug output.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java:
+	  Handle csv lines with just the km set ("gaps").
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java:
+	  Added TODO, as more changes towards fix for issue863 are necessary.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java,
+	  src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java:
+	  Cosmetics, docs.
+
+2012-09-27  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	Towards fix for issue863 (data gaps in bed height single values).
+
+	* doc/schema/postgresql-minfo.sql,
+	  doc/schema/oracle-minfo.sql:
+	  Drop "NOT NULL" constraints on some single bed height value columns.
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/BedHeightSingle.java:
+	  Replaced labeled continue by a simple break.
+
+	* src/main/java/de/intevation/flys/utils/DgmSqlConverter.java,
+	  src/main/java/de/intevation/flys/importer/ImportElevationModel.java:
+	  Removed trailing whitespace.
+
+2012-09-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/schema/postgresql-spatial.sql:
+
+	* doc/schema/import-dems.sql: Added more information to fullfil the schema
+	  for dems.
+
+	* src/main/java/de/intevation/flys/utils/DgmSqlConverter.java: New converter
+	  for CSV files with DGM information; results in a SQL file with INSERT
+	  statements.
+
+	* pom.xml: Added dependency to OpenCSV for reading CSV files.
+
+2012-09-24  Ingo Weinzierl <ingo@intevation.de>
+
+	* contrib/shpimporter/importer.py: Fixed method name for ERROR log
+	  messages.
+
+	* doc/schema/postgresql-spatial.sql: Set geometry dim to '3' instead of
+	  '4'.
+
+2012-09-24  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java,
+	  src/main/java/de/intevation/flys/importer/ImportElevationModel.java:
+	  Some minor bugfixes for MINFO import.
+
+2012-09-24  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/schema/postgresql-spatial.sql: Adapted schema; added missing
+	  relations.
+
+	* doc/schema/postgresql-drop-spatial.sql: SQL statements to drop an
+	  existing FLYS postgresql schema.
+
+2012-09-21	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/River.java,
+	  src/main/java/de/intevation/flys/model/Gauge.java:
+	  Remove fetchInfoURL methods. The info url will be generated in the
+	  client.
+
+2012-09-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/schema/postgresql.sql, doc/schema/oracle.sql:
+	  Addes column 'official_number' to rivers table.
+	  This should contain the 'Bundeswasserstrassen Identnummer'.
+
+	* src/main/java/de/intevation/flys/model/River.java:
+	  Added new column to Hibernate model.
+
+2012-09-21	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/River.java,
+	  src/main/java/de/intevation/flys/model/Gauge.java:
+	  Rename getInfoURL methods to fetchInfoURL until the values are fetched
+	  from the db to statisfy hibernate.
+
+2012-09-21	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/River.java,
+	  src/main/java/de/intevation/flys/model/Gauge.java:
+	  Add new methods to return a HTTP URL for additional information about the
+	  river or gauge.
+
+2012-09-19  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java,
+	  src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java,
+	  src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java,
+	  src/main/java/de/intevation/flys/importer/ImportSedimentYield.java,
+	  src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java,
+	  src/main/java/de/intevation/flys/importer/ImportWaterlevel.java,
+	  src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java,
+	  src/main/java/de/intevation/flys/importer/ImportMorphWidth.java,
+	  src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java,
+	  src/main/java/de/intevation/flys/importer/ImportSQRelation.java: Store
+	  values into database only if its peer has been successfully stored,
+	  otherwise skip values.
+
+2012-09-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	 * src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java,
+	   src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java:
+	   Removed trailing whitespace.
+
+2012-09-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/BedHeightType.java: Accept
+	  "Querprofil" as valid BedHeightType.
+
+	* src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java:
+	  Added missing GrainFraction.TOTAL type to parser.
+
+2012-09-18  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java,
+	  src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java,
+	  src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java,
+	  src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java:
+	  Some litte logging improvements and be more tolerant with exceptions.
+
+2012-09-17  Ingo Weinzierl <ingo@intevation.de>
+
+	Taggd RELEASE 2.9.1
+
 2012-09-17  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/BedHeightEpoch.java:
--- a/flys-backend/contrib/shpimporter/importer.py	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/contrib/shpimporter/importer.py	Fri Sep 28 12:15:45 2012 +0200
@@ -124,7 +124,7 @@
                     newFeat = self.transform(newFeat)
                     res = destLayer.CreateFeature(newFeat)
                     if res is None or res > 0:
-                        shpimporter.Error("Unable to insert feature: %r" % res)
+                        shpimporter.ERROR("Unable to insert feature: %r" % res)
                     else:
                         success = success + 1
                 else:
--- a/flys-backend/doc/schema/import-dems.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/import-dems.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -1,165 +1,24 @@
--- SAAR
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    0,
-    7.9,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0000-0079_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    8.0,
-    20.4,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0080-0204_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    20.5,
-    31.4,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0205-0314_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    31.5,
-    54.1,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0315-0541_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    54.2,
-    65.5,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0542-0655_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    65.6,
-    82.8,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0656-0828_long.txt'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Saar'),
-    82.9,
-    93.1,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0829-0931_erweitert.txt'
-);
-
-
--- ELBE
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    0.0,
-    101.1,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_00000_10110.grd'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    99.2,
-    203.0,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_09920_20300.grd'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    202.0,
-    299.8,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_20200_29980.grd'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    298.1,
-    401.0,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_29810_40100.grd'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    400.0,
-    500.9,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_40000_50090.grd'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Elbe'),
-    500.1,
-    583.3,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_50010_58330.grd'
-);
-
-
--- MOSEL
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    0.0,
-    5.8,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0000-0580.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    5.8,
-    15.3,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0058-0153.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    15.3,
-    41.6,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0153-0416.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    41.4,
-    101.2,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0414-1012O.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    41.4,
-    101.21,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0414-1012W.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    101.2,
-    148.8,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1012-1488.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    148.8,
-    166.6,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1488-1666.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    166.6,
-    196.0,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1666-1960.xyz'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    196.0,
-    204.4,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1960-2044.XYZ'
-);
-
-INSERT INTO dem (river_id, lower, upper, path) VALUES (
-    (SELECT id FROM rivers WHERE name = 'Mosel'),
-    204.4,
-    218.4,
-    '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/2044-2184.XYZ'
-);
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_00000_01010', 0.0, 101.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_00000_10110.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_00992_02030', 99.0, 203.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_09920_20300.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_02020_02998', 202.0, 300.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_20200_29980.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_02981_04010', 298.0, 401.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_29810_40100.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_04000_05009', 400.0, 501.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_40000_50090.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Elbe'), 'GRD_05001_05830', 500.0, 583.0, 2003, 2007, 'GK-3', 'DHHN92', 'ESRI-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Elbe/Geodaesie/Hoehenmodelle/m_50010_58330.grd');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_00000_00058', 0.0, 6.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0000-0580.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_00058_00153', 6.0, 15.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0058-0153.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_00153_00416', 15.0, 42.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0153-0416.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_00414_01012_O', 41.0, 101.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', 'muss überarbeitet werden', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0414-1012O.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_00414_01012_W', 41.0, 101.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', 'muss überarbeitet werden', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/0414-1012W.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_01012_01488', 101.0, 145.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1012-1488.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_01488_01666', 145.0, 167.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1488-1666.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_01666_01960', 167.0, 196.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1666-1960.xyz');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_01960_02044', 196.0, 204.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/1960-2044.XYZ');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_02044_02184', 204.0, 218.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/2044-2184.XYZ');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Mosel'), 'GRD_02184_02420', 218.0, 242.0, null, null, 'GK-2', 'DHHN85', 'ASCII-Grid', false, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Mosel/Geodaesie/Hoehenmodelle/DGMW-ASCII/525480MO.XYZ');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00000_00079', 0.0, 8.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0000-0079_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00080_00204', 8.0, 20.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0080-0204_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00205_00314', 20.0, 31.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0205-0314_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00315_00541', 31.0, 54.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0315-0541_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00542_00655', 54.0, 65.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0542-0655_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00656_00828', 65.0, 83.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0656-0828_long.txt');
+INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,projection, elevation_state, format, border_break, resolution, description, path) VALUES ((SELECT id from rivers WHERE name = 'Saar'), 'GRD_00829_00931', 83.0, 93.0, 1999, 2002, 'GK-2', '', 'ASCII-Grid', true, '2', '', '/vol1/projects/Geospatial/flys-3.0/testdaten/Gewaesser/Saar/Geodaesie/Hoehenmodelle/km0829-0931_erweitert.txt');
--- a/flys-backend/doc/schema/oracle-minfo.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -84,9 +84,9 @@
     station                 NUMBER(38,2) NOT NULL,
     height                  NUMBER(38,2),
     uncertainty             NUMBER(38,2),
-    data_gap                NUMBER(38,2) NOT NULL,
-    sounding_width          NUMBER(38,2) NOT NULL,
-    width                   NUMBER(38,2) NOT NULL,
+    data_gap                NUMBER(38,2),
+    sounding_width          NUMBER(38,2),
+    width                   NUMBER(38,2),
     PRIMARY KEY(id),
     CONSTRAINT fk_bed_single_values_parent FOREIGN KEY (bed_height_single_id) REFERENCES bed_height_single(id)
 );
--- a/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -155,10 +155,18 @@
     ID NUMBER PRIMARY KEY NOT NULL,
     river_id NUMBER(38),
     -- XXX Should we use the ranges table instead?
-    lower    NUMBER(19,5),
-    upper    NUMBER(19,5),
-    path     VARCHAR(256),
-    UNIQUE (river_id, lower, upper)
+    name            VARCHAR(64),
+    lower           NUMBER(19,5),
+    upper           NUMBER(19,5),
+    year_from       VARCHAR(32) NOT NULL,
+    year_to         VARCHAR(32) NOT NULL,
+    projection      VARCHAR(32) NOT NULL,
+    elevation_state VARCHAR(32),
+    format          VARCHAR(32),
+    border_break    BOOLEAN NOT NULL DEFAULT FALSE,
+    resolution      VARCHAR(16),
+    description     VARCHAR(256),
+    path            VARCHAR(256)
 );
 CREATE OR REPLACE TRIGGER dem_trigger BEFORE INSERT ON dem FOR each ROW
     BEGIN
--- a/flys-backend/doc/schema/oracle.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/oracle.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -249,6 +249,7 @@
 
 CREATE TABLE rivers (
     id                  NUMBER(38,0) NOT NULL,
+    official_number     NUMBER(38,0),
     km_up               NUMBER(38,0),
     name                VARCHAR2(255),
     wst_unit_id         NUMBER(38,0),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/doc/schema/postgresql-drop-spatial.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,45 @@
+BEGIN;
+
+DROP TABLE river_axes;
+DROP SEQUENCE RIVER_AXES_ID_SEQ;
+
+DROP TABLE river_axes_km;
+DROP SEQUENCE RIVER_AXES_KM_ID_SEQ;
+
+DROP TABLE cross_section_tracks;
+DROP SEQUENCE CROSS_SECTION_TRACKS_ID_SEQ;
+
+DROP TABLE lines;
+DROP SEQUENCE LINES_ID_SEQ;
+
+DROP TABLE buildings;
+DROP SEQUENCE BUILDINGS_ID_SEQ;
+
+DROP TABLE fixpoints;
+DROP SEQUENCE FIXPOINTS_ID_SEQ;
+
+DROP TABLE floodplain;
+DROP SEQUENCE FLOODPLAIN_ID_SEQ;
+
+DROP TABLE dem;
+DROP SEQUENCE DEM_ID_SEQ;
+
+DROP TABLE catchment;
+DROP SEQUENCE CATCHMENT_ID_SEQ;
+
+DROP TABLE hws;
+DROP SEQUENCE HWS_ID_SEQ;
+
+DROP TABLE floodmaps;
+DROP SEQUENCE FLOODMAPS_ID_SEQ;
+
+DROP TABLE hydr_boundaries;
+DROP SEQUENCE HYDR_BOUNDARIES_ID_SEQ;
+
+DROP TABLE hydr_boundaries_poly;
+DROP SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ;
+
+DROP TABLE gauge_location;
+DROP SEQUENCE GAUGE_LOCATION_ID_SEQ;
+
+COMMIT;
--- a/flys-backend/doc/schema/postgresql-minfo.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -84,9 +84,9 @@
     station                 NUMERIC NOT NULL,
     height                  NUMERIC,
     uncertainty             NUMERIC,
-    data_gap                NUMERIC NOT NULL,
-    sounding_width          NUMERIC NOT NULL,
-    width                   NUMERIC NOT NULL,
+    data_gap                NUMERIC,
+    sounding_width          NUMERIC,
+    width                   NUMERIC,
     PRIMARY KEY(id),
     CONSTRAINT fk_bed_single_values_parent FOREIGN KEY (bed_height_single_id) REFERENCES bed_height_single(id)
 );
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -5,9 +5,11 @@
 CREATE TABLE river_axes (
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
-    kind     int             NOT NULL DEFAULT 0
+    kind     int             NOT NULL DEFAULT 0,
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('river_axes', 'geom', 31466, 'LINESTRING', 2);
+SELECT AddGeometryColumn('river_axes', 'geom', 31467, 'LINESTRING', 2);
 ALTER TABLE river_axes ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_ID_SEQ');
 
 
@@ -17,9 +19,11 @@
 CREATE TABLE river_axes_km (
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
-    km       NUMERIC NOT NULL
+    km       NUMERIC NOT NULL,
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('river_axes_km', 'geom', 31466, 'POINT', 2);
+SELECT AddGeometryColumn('river_axes_km', 'geom', 31467, 'POINT', 2);
 ALTER TABLE river_axes_km ALTER COLUMN id SET DEFAULT NEXTVAL('RIVER_AXES_KM_ID_SEQ');
 
 
@@ -29,9 +33,11 @@
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
     km       NUMERIC NOT NULL,
-    z        NUMERIC NOT NULL DEFAULT 0
+    z        NUMERIC NOT NULL DEFAULT 0,
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('cross_section_tracks', 'geom', 31466, 'LINESTRING', 2);
+SELECT AddGeometryColumn('cross_section_tracks', 'geom', 31467, 'LINESTRING', 2);
 ALTER TABLE cross_section_tracks ALTER COLUMN id SET DEFAULT NEXTVAL('CROSS_SECTION_TRACKS_ID_SEQ');
 
 
@@ -41,9 +47,11 @@
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
     kind     VARCHAR(16) NOT NULL,
-    z        NUMERIC DEFAULT 0
+    z        NUMERIC DEFAULT 0,
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('lines', 'geom', 31466, 'LINESTRING', 4);
+SELECT AddGeometryColumn('lines', 'geom', 31467, 'LINESTRING', 3);
 ALTER TABLE lines ALTER COLUMN id SET DEFAULT NEXTVAL('LINES_ID_SEQ');
 -- 'kind':
 -- 0: ROHR1
@@ -55,9 +63,10 @@
 CREATE TABLE buildings (
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
-    name     VARCHAR(256)
+    name     VARCHAR(256),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('buildings', 'geom', 31466, 'LINESTRING', 2);
+SELECT AddGeometryColumn('buildings', 'geom', 31467, 'LINESTRING', 2);
 ALTER TABLE buildings ALTER COLUMN id SET DEFAULT NEXTVAL('BUILDINGS_ID_SEQ');
 
 
@@ -69,9 +78,11 @@
     x        int,
     y        int,
     km       NUMERIC NOT NULL,
-    HPGP     VARCHAR(2)
+    HPGP     VARCHAR(2),
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('fixpoints', 'geom', 31466, 'POINT', 2);
+SELECT AddGeometryColumn('fixpoints', 'geom', 31467, 'POINT', 2);
 ALTER TABLE fixpoints ALTER COLUMN id SET DEFAULT NEXTVAL('FIXPOINTS_ID_SEQ');
 
 
@@ -79,9 +90,11 @@
 CREATE SEQUENCE FLOODPLAIN_ID_SEQ;
 CREATE TABLE floodplain (
     id       int PRIMARY KEY NOT NULL,
-    river_id int REFERENCES rivers(id)
+    river_id int REFERENCES rivers(id),
+    name     VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('floodplain', 'geom', 31466, 'POLYGON', 2);
+SELECT AddGeometryColumn('floodplain', 'geom', 31467, 'POLYGON', 2);
 ALTER TABLE floodplain ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODPLAIN_ID_SEQ');
 
 
@@ -91,10 +104,18 @@
     id       int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
     -- XXX Should we use the ranges table instead?
-    lower    NUMERIC,
-    upper    NUMERIC,
-    path     VARCHAR(256),
-    UNIQUE (river_id, lower, upper)
+    name            VARCHAR(64),
+    lower           NUMERIC,
+    upper           NUMERIC,
+    year_from       VARCHAR(32) NOT NULL,
+    year_to         VARCHAR(32) NOT NULL,
+    projection      VARCHAR(32) NOT NULL,
+    elevation_state VARCHAR(32),
+    format          VARCHAR(32),
+    border_break    BOOLEAN NOT NULL DEFAULT FALSE,
+    resolution      VARCHAR(16),
+    description     VARCHAR(256),
+    path            VARCHAR(256)
 );
 ALTER TABLE dem ALTER COLUMN id SET DEFAULT NEXTVAL('DEM_ID_SEQ');
 
@@ -105,9 +126,10 @@
     id int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
     area NUMERIC,
-    name VARCHAR(256)
+    name VARCHAR(256),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('catchment','geom',31466,'POLYGON',2);
+SELECT AddGeometryColumn('catchment','geom',31467,'POLYGON',2);
 ALTER TABLE catchment ALTER COLUMN id SET DEFAULT NEXTVAL('CATCHMENT_ID_SEQ');
 
 
@@ -117,9 +139,11 @@
     id int PRIMARY KEY NOT NULL,
     river_id int REFERENCES rivers(id),
     hws_facility VARCHAR(256),
-    type VARCHAR(256)
+    type VARCHAR(256),
+    name VARCHAR(64),
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('hws','geom',31466,'LINESTRING',2);
+SELECT AddGeometryColumn('hws','geom',31467,'LINESTRING',2);
 ALTER TABLE hws ALTER COLUMN id SET DEFAULT NEXTVAL('HWS_ID_SEQ');
 
 
@@ -133,14 +157,7 @@
 -- 121 = Berechnung->Potenziell->BfG
 -- 122 = Berechnung->Potenziell->Land
 --
-CREATE SEQUENCE FLOODMAPS_SEQ;
-CREATE FUNCTION floodmaps_id_func() RETURNS trigger AS $floodmaps_id_func$
-    BEGIN
-        NEW.id := nextval('floodmaps_seq');
-        RETURN NEW;
-    END;
-$floodmaps_id_func$ LANGUAGE plpgsql;
-
+CREATE SEQUENCE FLOODMAPS_ID_SEQ;
 CREATE TABLE floodmaps (
     id         int PRIMARY KEY NOT NULL,
     river_id   int REFERENCES rivers(id),
@@ -149,13 +166,47 @@
     diff       real,
     count      int,
     area       real,
-    perimeter  real
+    perimeter  real,
+    path     VARCHAR(256)
 );
-SELECT AddGeometryColumn('floodmaps', 'geom', 31466, 'MULTIPOLYGON', 2);
+SELECT AddGeometryColumn('floodmaps', 'geom', 31467, 'MULTIPOLYGON', 2);
 ALTER TABLE floodmaps DROP CONSTRAINT enforce_geotype_geom;
 ALTER TABLE floodmaps ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geometrytype(geom) = 'MULTIPOLYGON'::text);
-ALTER TABLE floodmaps ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODMAPS_SEQ');
+ALTER TABLE floodmaps ALTER COLUMN id SET DEFAULT NEXTVAL('FLOODMAPS_ID_SEQ');
 
-CREATE TRIGGER floodmaps_id_trigger BEFORE INSERT OR UPDATE ON floodmaps
-    FOR EACH ROW EXECUTE PROCEDURE floodmaps_id_func();
-END;
+
+CREATE SEQUENCE HYDR_BOUNDARIES_ID_SEQ;
+CREATE TABLE hydr_boundaries (
+    id         int PRIMARY KEY NOT NULL,
+    river_id   int REFERENCES rivers(id),
+    name       VARCHAR(255),
+    kind       int,
+    path       VARCHAR(256)
+);
+SELECT AddGeometryColumn('hydr_boundaries','geom',31467,'LINESTRING',3);
+ALTER TABLE hydr_boundaries ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_ID_SEQ');
+
+
+CREATE SEQUENCE HYDR_BOUNDARIES_POLY_ID_SEQ;
+CREATE TABLE hydr_boundaries_poly (
+    id         int PRIMARY KEY NOT NULL,
+    river_id   int REFERENCES rivers(id),
+    name       VARCHAR(255),
+    kind       int,
+    path       VARCHAR(256)
+);
+SELECT AddGeometryColumn('hydr_boundaries_poly','geom',31467,'POLYGON',3);
+ALTER TABLE hydr_boundaries_poly ALTER COLUMN id SET DEFAULT NEXTVAL('HYDR_BOUNDARIES_POLY_ID_SEQ');
+
+
+CREATE SEQUENCE GAUGE_LOCATION_ID_SEQ;
+CREATE TABLE gauge_location (
+    id         int PRIMARY KEY NOT NULL,
+    river_id   int REFERENCES rivers(id),
+    name       VARCHAR(255),
+    path       VARCHAR(256)
+);
+SELECT AddGeometryColumn('gauge_location','geom',31467,'POINT',2);
+ALTER TABLE gauge_location ALTER COLUMN id SET DEFAULT NEXTVAL('GAUGE_LOCATION_ID_SEQ');
+
+COMMIT;
--- a/flys-backend/doc/schema/postgresql.sql	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/doc/schema/postgresql.sql	Fri Sep 28 12:15:45 2012 +0200
@@ -11,10 +11,11 @@
 CREATE SEQUENCE RIVERS_ID_SEQ;
 
 CREATE TABLE rivers (
-    id          int PRIMARY KEY NOT NULL,
-    name        VARCHAR(256)    NOT NULL UNIQUE,
-    km_up       BOOLEAN         NOT NULL DEFAULT true,
-    wst_unit_id int             NOT NULL REFERENCES units(id)
+    id              int PRIMARY KEY NOT NULL,
+    official_number int8                     UNIQUE,
+    name            VARCHAR(256)    NOT NULL UNIQUE,
+    km_up           BOOLEAN         NOT NULL DEFAULT true,
+    wst_unit_id int                 NOT NULL REFERENCES units(id)
 );
 
 -- Bruecke, Haefen, etc.
--- a/flys-backend/pom.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/pom.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -53,6 +53,11 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>net.sf.opencsv</groupId>
+      <artifactId>opencsv</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-core</artifactId>
       <version>3.6.5.Final</version>
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,14 +1,12 @@
 package de.intevation.flys.importer;
 
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 
-import java.sql.SQLException;
-
 import org.apache.log4j.Logger;
-
+import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.Query;
 import org.hibernate.exception.ConstraintViolationException;
 
 import de.intevation.flys.model.BedHeightEpoch;
@@ -18,15 +16,19 @@
 import de.intevation.flys.model.TimeInterval;
 
 
-public class ImportBedHeightEpoch implements ImportBedHeight
-{
+/** Import Bed Height Data, 'epoch' type from csv file. */
+public class ImportBedHeightEpoch implements ImportBedHeight {
+
+    /** Private logger. */
     private static Logger log = Logger.getLogger(ImportBedHeightEpoch.class);
 
     protected String evaluationBy;
+
+    /** De facto the file name. */
     protected String description;
 
-    protected ImportTimeInterval   timeInterval;
-    protected ImportRange          range;
+    protected ImportTimeInterval timeInterval;
+    protected ImportRange range;
     protected ImportElevationModel curElevationModel;
     protected ImportElevationModel oldElevationModel;
 
@@ -34,18 +36,15 @@
 
     protected BedHeightEpoch peer;
 
-
     public ImportBedHeightEpoch(String description) {
         this.description = description;
-        this.values      = new ArrayList<ImportBedHeightEpochValue>();
+        this.values = new ArrayList<ImportBedHeightEpochValue>();
     }
 
-
     public String getDescription() {
         return description;
     }
 
-
     public int getValueCount() {
         return values.size();
     }
@@ -54,7 +53,6 @@
         this.timeInterval = timeInterval;
     }
 
-
     public void setEvaluationBy(String evaluationBy) {
         this.evaluationBy = evaluationBy;
     }
@@ -75,18 +73,24 @@
         this.oldElevationModel = oldElevationModel;
     }
 
+    /** Does nothing. */
     public void setYear(int year) {
         // do nothing
     }
 
+    /** Does nothing. */
     public void setSoundingWidth(int soundingWidth) {
         // do nothing
     }
 
+
+    /** Does nothing. */
     public void setLocationSystem(ImportLocationSystem locationSystem) {
         // do nothing
     }
 
+
+    /** Does nothing. */
     public void setType(ImportBedHeightType type) {
         // do nothing
     }
@@ -96,13 +100,13 @@
         values.add((ImportBedHeightEpochValue) value);
     }
 
-
     @Override
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.info("Store dependencies for epoch: '" + getDescription() + "'");
 
+        BedHeightEpoch peer = getPeer(river);
+
         if (curElevationModel != null) {
             curElevationModel.storeDependencies();
         }
@@ -111,34 +115,41 @@
             oldElevationModel.storeDependencies();
         }
 
-        BedHeightEpoch peer = getPeer(river);
+        if (peer != null) {
+            log.debug("store values now...");
 
-        log.debug("store values now...");
-
-        for (ImportBedHeightEpochValue value: values) {
-            value.storeDependencies(peer);
+            for (ImportBedHeightEpochValue value : values) {
+                value.storeDependencies(peer);
+            }
         }
 
         Session session = ImporterSession.getInstance().getDatabaseSession();
         session.flush();
     }
 
-
+    /**
+     * Asserts all dependent entities (ElevationModel, TimeInterval, Range,
+     * BedHeighEpoch) are in db and returns bound (either newly created or
+     * freshly fetched) BedHeightEpoch.
+     */
     @Override
     public BedHeightEpoch getPeer(River river) {
         if (peer == null) {
-            ElevationModel theCurModel = curElevationModel != null
-                ? curElevationModel.getPeer()
-                : null;
+            ElevationModel theCurModel = null;
+            if (curElevationModel != null) {
+                curElevationModel.storeDependencies();
+                theCurModel = curElevationModel.getPeer();
+            }
 
             if (theCurModel == null) {
                 log.warn("BHE: Skip file - invalid current elevation model.");
                 return null;
             }
 
-            TimeInterval theTime = timeInterval != null
-                ? timeInterval.getPeer()
-                : null;
+            TimeInterval theTime = null;
+            if (timeInterval != null) {
+                theTime = timeInterval.getPeer();
+            }
 
             if (theTime == null) {
                 log.warn("BHE: Skip file - invalid time range.");
@@ -152,16 +163,14 @@
                 return null;
             }
 
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
 
-            Query query = session.createQuery(
-                "from BedHeightEpoch where " +
-                "   river=:river and " +
-                "   timeInterval=:timeInterval and " +
-                "   curElevationModel=:curElevationModel and " +
-                "   range=:range and " +
-                "   evaluationBy=:evaluationBy and " +
-                "   description=:description");
+            Query query = session.createQuery("from BedHeightEpoch where "
+                + "   river=:river and " + "   timeInterval=:timeInterval and "
+                + "   curElevationModel=:curElevationModel and "
+                + "   range=:range and " + "   evaluationBy=:evaluationBy and "
+                + "   description=:description");
 
             query.setParameter("river", river);
             query.setParameter("timeInterval", theTime);
@@ -175,15 +184,10 @@
             if (bedHeights.isEmpty()) {
                 log.info("Create new BedHeightEpoch DB instance.");
 
-                peer = new BedHeightEpoch(
-                    river,
-                    theTime,
-                    theRange,
+                peer = new BedHeightEpoch(river, theTime, theRange,
                     theCurModel,
-                    oldElevationModel != null ? oldElevationModel.getPeer() : null,
-                    evaluationBy,
-                    description
-                );
+                    oldElevationModel != null ? oldElevationModel.getPeer()
+                        : null, evaluationBy, description);
 
                 session.save(peer);
             }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Fri Sep 28 12:15:45 2012 +0200
@@ -123,8 +123,10 @@
 
         BedHeightSingle peer = getPeer(river);
 
-        for (ImportBedHeightSingleValue value: values) {
-            value.storeDependencies(peer);
+        if (peer != null) {
+            for (ImportBedHeightSingleValue value: values) {
+                value.storeDependencies(peer);
+            }
         }
 
         Session session = ImporterSession.getInstance().getDatabaseSession();
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java	Fri Sep 28 12:15:45 2012 +0200
@@ -55,6 +55,10 @@
     }
 
 
+    /**
+     * Add this value to database or return database bound Value, assuring
+     * that the BedHeightSingle exists in db already.
+     */
     public BedHeightSingleValue getPeer(BedHeightSingle bedHeight) {
         if (peer == null) {
             Session session = ImporterSession.getInstance().getDatabaseSession();
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportElevationModel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportElevationModel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -33,6 +33,11 @@
     }
 
     public ElevationModel getPeer() {
+        if (unit == null) {
+            log.warn("No elevation model specified.");
+            return null;
+        }
+
         if (peer == null) {
             Session session = ImporterSession.getInstance().getDatabaseSession();
             Query query = session.createQuery(
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java	Fri Sep 28 12:15:45 2012 +0200
@@ -16,9 +16,8 @@
 
 public class ImportFlowVelocityMeasurement {
 
-    private static final Logger log =
-        Logger.getLogger(ImportFlowVelocityMeasurement.class);
-
+    private static final Logger log = Logger
+        .getLogger(ImportFlowVelocityMeasurement.class);
 
     private String description;
 
@@ -26,50 +25,44 @@
 
     private FlowVelocityMeasurement peer;
 
-
     public ImportFlowVelocityMeasurement() {
         this(null);
     }
 
-
     public ImportFlowVelocityMeasurement(String description) {
         this.description = description;
-        this.values      = new ArrayList<ImportFlowVelocityMeasurementValue>();
+        this.values = new ArrayList<ImportFlowVelocityMeasurementValue>();
     }
 
-
     public void setDescription(String description) {
         this.description = description;
     }
 
-
     public void addValue(ImportFlowVelocityMeasurementValue value) {
         this.values.add(value);
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.debug("store dependencies");
 
         FlowVelocityMeasurement peer = getPeer(river);
 
-        for (ImportFlowVelocityMeasurementValue value: values) {
-            value.storeDependencies(peer);
+        if (peer != null) {
+            for (ImportFlowVelocityMeasurementValue value : values) {
+                value.storeDependencies(peer);
+            }
         }
     }
 
-
     public FlowVelocityMeasurement getPeer(River river) {
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
 
-            Query query = session.createQuery(
-                "from FlowVelocityMeasurement where " +
-                "   river=:river and " +
-                "   description=:description"
-            );
+            Query query = session
+                .createQuery("from FlowVelocityMeasurement where "
+                    + "   river=:river and " + "   description=:description");
 
             query.setParameter("river", river);
             query.setParameter("description", description);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -17,9 +17,8 @@
 
 public class ImportFlowVelocityModel {
 
-    private static final Logger log =
-        Logger.getLogger(ImportFlowVelocityModel.class);
-
+    private static final Logger log = Logger
+        .getLogger(ImportFlowVelocityModel.class);
 
     private String description;
 
@@ -29,41 +28,32 @@
 
     private FlowVelocityModel peer;
 
-
     public ImportFlowVelocityModel() {
         values = new ArrayList<ImportFlowVelocityModelValue>();
     }
 
-
-    public ImportFlowVelocityModel(
-        ImportDischargeZone dischargeZone,
-        String              description
-    ) {
+    public ImportFlowVelocityModel(ImportDischargeZone dischargeZone,
+        String description) {
         this();
 
         this.dischargeZone = dischargeZone;
-        this.description   = description;
+        this.description = description;
     }
 
-
     public void setDischargeZone(ImportDischargeZone dischargeZone) {
         this.dischargeZone = dischargeZone;
     }
 
-
     public void setDescription(String description) {
         this.description = description;
     }
 
-
     public void addValue(ImportFlowVelocityModelValue value) {
         this.values.add(value);
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.debug("store dependencies");
 
         if (dischargeZone == null) {
@@ -75,28 +65,27 @@
 
         FlowVelocityModel peer = getPeer(river);
 
-        int i = 0;
+        if (peer != null) {
+            int i = 0;
 
-        for (ImportFlowVelocityModelValue value: values) {
-            value.storeDependencies(peer);
-            i++;
+            for (ImportFlowVelocityModelValue value : values) {
+                value.storeDependencies(peer);
+                i++;
+            }
+
+            log.info("stored " + i + " flow velocity model values.");
         }
-
-        log.info("stored " + i + " flow velocity model values.");
     }
 
-
     public FlowVelocityModel getPeer(River river) {
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
 
             DischargeZone zone = dischargeZone.getPeer(river);
 
-            Query query = session.createQuery(
-                "from FlowVelocityModel where " +
-                "   river=:river and " +
-                "   dischargeZone=:dischargeZone"
-            );
+            Query query = session.createQuery("from FlowVelocityModel where "
+                + "   river=:river and " + "   dischargeZone=:dischargeZone");
 
             query.setParameter("river", river);
             query.setParameter("dischargeZone", zone);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,14 +1,12 @@
 package de.intevation.flys.importer;
 
 import java.sql.SQLException;
-
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
+import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.Query;
 import org.hibernate.exception.ConstraintViolationException;
 
 import de.intevation.flys.model.MorphologicalWidth;
@@ -19,54 +17,48 @@
 
     private static Logger log = Logger.getLogger(ImportMorphWidth.class);
 
-
     protected MorphologicalWidth peer;
 
     protected ImportUnit unit;
 
     protected List<ImportMorphWidthValue> values;
 
-
     public ImportMorphWidth() {
         this.values = new ArrayList<ImportMorphWidthValue>();
     }
 
-
     public void addValue(ImportMorphWidthValue value) {
         this.values.add(value);
     }
 
-
     public void setUnit(ImportUnit unit) {
         this.unit = unit;
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.info("store dependencies");
 
         MorphologicalWidth peer = getPeer(river);
 
-        log.info("store morphological width values");
+        if (peer != null) {
+            log.info("store morphological width values");
 
-        for (ImportMorphWidthValue value: values) {
-            value.storeDependencies(peer);
+            for (ImportMorphWidthValue value : values) {
+                value.storeDependencies(peer);
+            }
         }
     }
 
-
     public MorphologicalWidth getPeer(River river) {
         log.info("get peer");
 
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
 
-            Query query = session.createQuery(
-                "from MorphologicalWidth where " +
-                "   river=:river and " +
-                "   unit=:unit");
+            Query query = session.createQuery("from MorphologicalWidth where "
+                + "   river=:river and " + "   unit=:unit");
 
             query.setParameter("river", river);
             query.setParameter("unit", unit.getPeer());
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java	Fri Sep 28 12:15:45 2012 +0200
@@ -19,7 +19,6 @@
 
     private static Logger log = Logger.getLogger(ImportSQRelation.class);
 
-
     private ImportTimeInterval timeInterval;
 
     private String description;
@@ -28,40 +27,38 @@
 
     private SQRelation peer;
 
-
     public ImportSQRelation() {
         this.values = new ArrayList<ImportSQRelationValue>();
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.info("store dependencies");
 
         SQRelation peer = getPeer(river);
 
         timeInterval.getPeer();
 
-        int count = 0;
+        if (peer != null) {
+            int count = 0;
 
-        for (ImportSQRelationValue value: values) {
-            try {
-                value.storeDependencies(peer);
-                count++;
+            for (ImportSQRelationValue value : values) {
+                try {
+                    value.storeDependencies(peer);
+                    count++;
+                }
+                catch (SQLException sqle) {
+                    log.warn("ISQ: Unable to store sq relation value.", sqle);
+                }
+                catch (ConstraintViolationException cve) {
+                    log.warn("ISQ: Unable to store sq relation value.", cve);
+                }
             }
-            catch (SQLException sqle) {
-                log.warn("ISQ: Unable to store sq relation value.", sqle);
-            }
-            catch (ConstraintViolationException cve) {
-                log.warn("ISQ: Unable to store sq relation value.", cve);
-            }
+
+            log.info("stored " + count + " sq relation values.");
         }
-
-        log.info("stored " + count + " sq relation values.");
     }
 
-
     public SQRelation getPeer(River river) {
         log.debug("getPeer()");
 
@@ -73,11 +70,11 @@
                 return null;
             }
 
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
 
-            Query query = session.createQuery(
-                "FROM SQRelation WHERE river=:river AND timeInterval=:timeInter"
-            );
+            Query query = session
+                .createQuery("FROM SQRelation WHERE river=:river AND timeInterval=:timeInter");
 
             query.setParameter("river", river);
             query.setParameter("timeInter", timeInter);
@@ -87,11 +84,7 @@
             if (sq.isEmpty()) {
                 log.info("create new SQ relation '" + description + "'");
 
-                peer = new SQRelation(
-                    river,
-                    timeInter,
-                    description
-                );
+                peer = new SQRelation(river, timeInter, description);
                 session.save(peer);
             }
             else {
@@ -102,17 +95,14 @@
         return peer;
     }
 
-
     public void setDescription(String description) {
         this.description = description;
     }
 
-
     public void setTimeInterval(ImportTimeInterval timeInterval) {
         this.timeInterval = timeInterval;
     }
 
-
     public void addValue(ImportSQRelationValue value) {
         if (value != null) {
             this.values.add(value);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,14 +1,12 @@
 package de.intevation.flys.importer;
 
 import java.sql.SQLException;
-
 import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
+import org.hibernate.Query;
 import org.hibernate.Session;
-import org.hibernate.Query;
 import org.hibernate.exception.ConstraintViolationException;
 
 import de.intevation.flys.model.River;
@@ -19,7 +17,6 @@
 
     private static Logger log = Logger.getLogger(ImportSedimentDensity.class);
 
-
     protected SedimentDensity peer;
 
     protected ImportDepth depth;
@@ -30,63 +27,67 @@
 
     protected List<ImportSedimentDensityValue> values;
 
-
     public ImportSedimentDensity(String description) {
         this.description = description;
-        this.values      = new ArrayList<ImportSedimentDensityValue>();
+        this.values = new ArrayList<ImportSedimentDensityValue>();
     }
 
-
     public String getDescription() {
         return description;
     }
 
-
     public void setDepth(ImportDepth depth) {
         this.depth = depth;
     }
 
-
     public void setUnit(ImportUnit unit) {
         this.unit = unit;
     }
 
-
     public void addValue(ImportSedimentDensityValue value) {
         values.add(value);
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.info("store dependencies");
 
         if (depth != null) {
             depth.storeDependencies();
         }
 
-        log.info("store sediment density values.");
-
         SedimentDensity peer = getPeer(river);
 
-        for (ImportSedimentDensityValue value: values) {
-            value.storeDependencies(peer);
+        if (peer != null) {
+            log.info("store sediment density values.");
+            for (ImportSedimentDensityValue value : values) {
+                value.storeDependencies(peer);
+            }
         }
     }
 
-
     public SedimentDensity getPeer(River river) {
         log.info("get peer");
 
-        if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
+        if (depth == null) {
+            log.warn("cannot store sediment density '" + description
+                + "': no depth");
+            return null;
+        }
 
-            Query query = session.createQuery(
-                "from SedimentDensity where " +
-                "   river=:river and " +
-                "   depth=:depth and " +
-                "   unit=:unit");
+        if (unit == null) {
+            log.warn("cannot store sediment density '" + description
+                + "': no unit");
+            return null;
+        }
+
+        if (peer == null) {
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
+
+            Query query = session.createQuery("from SedimentDensity where "
+                + "   river=:river and " + "   depth=:depth and "
+                + "   unit=:unit");
 
             query.setParameter("river", river);
             query.setParameter("depth", depth.getPeer());
@@ -97,11 +98,8 @@
             if (density.isEmpty()) {
                 log.debug("Create new SedimentDensity DB instance.");
 
-                peer = new SedimentDensity(
-                    river,
-                    depth.getPeer(),
-                    unit.getPeer(),
-                    description);
+                peer = new SedimentDensity(river, depth.getPeer(),
+                    unit.getPeer(), description);
 
                 session.save(peer);
             }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java	Fri Sep 28 12:15:45 2012 +0200
@@ -33,36 +33,29 @@
 
     private SedimentYield peer;
 
-
     public ImportSedimentYield(String description) {
-        this.values      = new ArrayList<ImportSedimentYieldValue>();
+        this.values = new ArrayList<ImportSedimentYieldValue>();
         this.description = description;
     }
 
-
     public void setTimeInterval(ImportTimeInterval timeInterval) {
         this.timeInterval = timeInterval;
     }
 
-
     public void setUnit(ImportUnit unit) {
         this.unit = unit;
     }
 
-
     public void setGrainFraction(ImportGrainFraction grainFraction) {
         this.grainFraction = grainFraction;
     }
 
-
     public void addValue(ImportSedimentYieldValue value) {
         this.values.add(value);
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.debug("store dependencies");
 
         if (grainFraction != null) {
@@ -71,22 +64,22 @@
 
         SedimentYield peer = getPeer(river);
 
-        int i = 0;
+        if (peer != null) {
+            int i = 0;
 
-        for (ImportSedimentYieldValue value: values) {
-            value.storeDependencies(peer);
-            i++;
+            for (ImportSedimentYieldValue value : values) {
+                value.storeDependencies(peer);
+                i++;
+            }
+
+            log.info("stored " + i + " sediment yield values.");
         }
-
-        log.info("stored " + i + " sediment yield values.");
     }
 
-
     public SedimentYield getPeer(River river) {
         log.debug("get peer");
 
-        GrainFraction gf = grainFraction != null
-            ? grainFraction.getPeer()
+        GrainFraction gf = grainFraction != null ? grainFraction.getPeer()
             : null;
 
         Unit u = unit != null ? unit.getPeer() : null;
@@ -99,15 +92,13 @@
         }
 
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query = session.createQuery(
-                "from SedimentYield where " +
-                "   river=:river and " +
-                "   grainFraction=:grainFraction and " +
-                "   unit=:unit and " +
-                "   timeInterval=:timeInterval and " +
-                "   description=:description"
-            );
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
+            Query query = session.createQuery("from SedimentYield where "
+                + "   river=:river and "
+                + "   grainFraction=:grainFraction and " + "   unit=:unit and "
+                + "   timeInterval=:timeInterval and "
+                + "   description=:description");
 
             query.setParameter("river", river);
             query.setParameter("grainFraction", gf);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -17,7 +17,6 @@
 
     private static final Logger log = Logger.getLogger(ImportWaterlevel.class);
 
-
     private ImportUnit unit;
 
     private String description;
@@ -26,40 +25,37 @@
 
     private Waterlevel peer;
 
-
     public ImportWaterlevel(String description) {
         this.qRanges = new ArrayList<ImportWaterlevelQRange>();
 
         this.description = description;
     }
 
-
     public void setUnit(ImportUnit unit) {
         this.unit = unit;
     }
 
-
     public void addValue(ImportWaterlevelQRange qRange) {
         this.qRanges.add(qRange);
     }
 
-
     public void storeDependencies(River river) {
         log.info("store dependencies");
 
         Waterlevel peer = getPeer(river);
 
-        int i = 0;
+        if (peer != null) {
+            int i = 0;
 
-        for (ImportWaterlevelQRange qRange: qRanges) {
-            qRange.storeDependencies(peer);
-            i++;
+            for (ImportWaterlevelQRange qRange : qRanges) {
+                qRange.storeDependencies(peer);
+                i++;
+            }
+
+            log.info("stored " + i + " waterlevel q ranges");
         }
-
-        log.info("stored " + i + " waterlevel q ranges");
     }
 
-
     public Waterlevel getPeer(River river) {
         Unit u = unit != null ? unit.getPeer() : null;
         if (u == null) {
@@ -68,13 +64,11 @@
         }
 
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query = session.createQuery(
-                "from Waterlevel where " +
-                "   river=:river and " +
-                "   unit=:unit and " +
-                "   description=:description"
-            );
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
+            Query query = session.createQuery("from Waterlevel where "
+                + "   river=:river and " + "   unit=:unit and "
+                + "   description=:description");
 
             query.setParameter("river", river);
             query.setParameter("unit", u);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java	Fri Sep 28 12:15:45 2012 +0200
@@ -17,9 +17,8 @@
 
 public class ImportWaterlevelDifference {
 
-    private static final Logger log =
-        Logger.getLogger(ImportWaterlevelDifference.class);
-
+    private static final Logger log = Logger
+        .getLogger(ImportWaterlevelDifference.class);
 
     private ImportUnit unit;
 
@@ -29,42 +28,38 @@
 
     private WaterlevelDifference peer;
 
-
     public ImportWaterlevelDifference(String description) {
         this.columns = new ArrayList<ImportWaterlevelDifferenceColumn>();
 
         this.description = description;
     }
 
-
     public void setUnit(ImportUnit unit) {
         this.unit = unit;
     }
 
-
     public void addValue(ImportWaterlevelDifferenceColumn column) {
         this.columns.add(column);
     }
 
-
-    public void storeDependencies(River river)
-    throws SQLException, ConstraintViolationException
-    {
+    public void storeDependencies(River river) throws SQLException,
+        ConstraintViolationException {
         log.info("store dependencies");
 
         WaterlevelDifference peer = getPeer(river);
 
-        int i = 0;
+        if (peer != null) {
+            int i = 0;
 
-        for (ImportWaterlevelDifferenceColumn column: columns) {
-            column.storeDependencies(peer);
-            i++;
+            for (ImportWaterlevelDifferenceColumn column : columns) {
+                column.storeDependencies(peer);
+                i++;
+            }
+
+            log.info("stored " + i + " waterlevel difference columns");
         }
-
-        log.info("stored " + i + " waterlevel difference columns");
     }
 
-
     public WaterlevelDifference getPeer(River river) {
         Unit u = unit != null ? unit.getPeer() : null;
         if (u == null) {
@@ -73,13 +68,12 @@
         }
 
         if (peer == null) {
-            Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query = session.createQuery(
-                "from WaterlevelDifference where " +
-                "   river=:river and " +
-                "   unit=:unit and " +
-                "   description=:description"
-            );
+            Session session = ImporterSession.getInstance()
+                .getDatabaseSession();
+            Query query = session
+                .createQuery("from WaterlevelDifference where "
+                    + "   river=:river and " + "   unit=:unit and "
+                    + "   description=:description");
 
             query.setParameter("river", river);
             query.setParameter("unit", u);
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,12 +1,9 @@
 package de.intevation.flys.importer.parsers;
 
-
 import java.math.BigDecimal;
 
 import java.text.ParseException;
 
-
-
 import org.apache.log4j.Logger;
 
 import de.intevation.flys.importer.ImportBedHeight;
@@ -14,31 +11,59 @@
 import de.intevation.flys.importer.ImportBedHeightEpochValue;
 
 
+/** Parses BedHeightEpochs from csv file. */
 public class BedHeightEpochParser extends BedHeightParser {
 
+    /** Our own logger. */
     private static final Logger log =
         Logger.getLogger(BedHeightEpochParser.class);
 
 
-
     @Override
     protected ImportBedHeight newImportBedHeight(String description) {
         return new ImportBedHeightEpoch(description);
     }
 
 
+    /**
+     * Handle a non-comment, none-Metadata line of csv file, adding
+     * ImportBedHeightEpochValues to the given ImportBedHeight object.
+     */
     @Override
     protected void handleDataLine(ImportBedHeight obj, String line) {
         String[] values = line.split(SEPERATOR_CHAR);
 
-        if (values == null || values.length < 2 || values[0].length() == 0 || values[1].length() == 0) {
+        if (values == null || values.length == 0 || values[0].length() == 0) {
+            // There might be quite some ";" found.
             //log.warn("Skip invalid data line: " + line);
             return;
         }
 
+        BigDecimal km;
+
+        try {
+            km = new BigDecimal(nf.parse(values[0]).doubleValue());
+        }
+        catch (ParseException e) {
+            log.warn("Error while parsing number from data row: " + line);
+            return;
+        }
+
+
+        // Handle "gap" lines like '255,0;'
+        if (values.length < 2) {
+            ImportBedHeightEpochValue value = new ImportBedHeightEpochValue(
+                km,
+                null
+            );
+
+            obj.addValue(value);
+            return;
+        }
+
         try {
             ImportBedHeightEpochValue value = new ImportBedHeightEpochValue(
-                new BigDecimal(nf.parse(values[0]).doubleValue()),
+                km,
                 new BigDecimal(nf.parse(values[1]).doubleValue())
             );
 
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -46,7 +46,7 @@
     public static final String SEPERATOR_CHAR  = ";";
 
     public static final Pattern META_YEAR =
-        Pattern.compile("^Jahr: (\\d*).*");
+        Pattern.compile("^Jahr: [^0-9]*(\\d*).*");
 
     public static final Pattern META_TIMEINTERVAL =
         Pattern.compile("^Zeitraum: Epoche (\\d*)-(\\d*).*");
@@ -84,6 +84,7 @@
 
     protected abstract ImportBedHeight newImportBedHeight(String description);
 
+    /** Handle a line of file that contains data (in contrast to comments, meta). */
     protected abstract void handleDataLine(
         ImportBedHeight importBedHeight,
         String          line
@@ -256,8 +257,10 @@
                 return true;
             }
             catch (NumberFormatException e) {
-                log.warn("BHP: Error while parsing sounding width!", e);
+                log.warn("BHP: Error while parsing sounding width: " + line, e);
+                log.warn("-> Set default value '0'");
             }
+            obj.setSoundingWidth(0);
         }
 
         return false;
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,13 +1,9 @@
 package de.intevation.flys.importer.parsers;
 
-
 import java.math.BigDecimal;
 
 import java.text.ParseException;
 
-
-
-
 import org.apache.log4j.Logger;
 
 import de.intevation.flys.importer.ImportBedHeight;
@@ -29,19 +25,53 @@
 
 
 
+    /**
+     * Create ImportBedHeightSingleValue from a line of csv file, add
+     * it to the ImportBedHeight.
+     */
     @Override
     protected void handleDataLine(ImportBedHeight obj, String line) {
         String[] values = line.split(SEPERATOR_CHAR);
 
-        if (values == null || values.length < 6) {
+        if (values == null || (values.length != 1 && values.length < 6)) {
             //log.warn("BSP: Error while parsing data line: '" + line + "'");
             return;
         }
 
+        BigDecimal km;
+
+        try {
+            km = new BigDecimal(nf.parse(values[0]).doubleValue());
+        }
+        catch (ParseException e) {
+            // We expect a lot of ";;;;;;" lines.
+            //log.warn("BSP: Error while parsing km of data row.", e);
+            return;
+        }
+
+        // Handle gaps like "10,0;;;;;".
+        if (values.length == 1) {
+            ImportBedHeightSingleValue value = new ImportBedHeightSingleValue(
+                (ImportBedHeightSingle) obj,
+                km,
+                null, null, null, null, null);
+            obj.addValue(value);
+            return;
+        }
+
+        // Because we cannot enforce consistency of values with complete data
+        // via null constraints in the database (as there are "gap" values),
+        // do this checks manually.
+        if (values[3].length() == 0 || values[4].length() == 0
+            || values[5].length() == 0) {
+            //log.warn("BSP: Error while parsing data row (manual null constraint violated).");
+            return;
+        }
+
         try {
             ImportBedHeightSingleValue value = new ImportBedHeightSingleValue(
                 (ImportBedHeightSingle) obj,
-                new BigDecimal(nf.parse(values[0]).doubleValue()),
+                km,
                 new BigDecimal(nf.parse(values[1]).doubleValue()),
                 new BigDecimal(nf.parse(values[2]).doubleValue()),
                 new BigDecimal(nf.parse(values[3]).doubleValue()),
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -118,6 +118,8 @@
             String up   = m.group(2);
             String unit = m.group(4);
 
+            log.info("Found sediment density depth: " + lo + " - " + up + " " + unit);
+
             try {
                 ImportDepth depth = new ImportDepth(
                     new BigDecimal(nf.parse(lo).doubleValue()),
@@ -133,6 +135,9 @@
                 log.warn("Error while parsing numbers in: '" + line + "'");
             }
         }
+        else {
+            log.debug("Meta line doesn't contain depth information: " + line);
+        }
 
         return false;
     }
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -50,6 +50,9 @@
     public static final String FRACTION_SUSPENDED_SEDIMENT =
         "_Schwebstoff.csv";
 
+    public static final String FRACTION_TOTAL =
+        "_gesamt.csv";
+
 
     public static final Pattern TIMEINTERVAL_SINGLE =
         Pattern.compile("\\D*([0-9]+?)\\D*");
@@ -376,6 +379,9 @@
         else if (filename.endsWith(FRACTION_SUSPENDED_SEDIMENT)) {
             return GrainFraction.SUSPENDED_SEDIMENT;
         }
+        else if (filename.endsWith(FRACTION_TOTAL)) {
+            return GrainFraction.TOTAL;
+        }
         else {
             log.warn("SYP: Unknown grain fraction '" + filename + "'");
             return "unknown";
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java	Fri Sep 28 12:15:45 2012 +0200
@@ -153,7 +153,14 @@
             Double station = nf.parse(cols[0]).doubleValue();
 
             for (int i = 0; i < columns.length; i++) {
-                String value = cols[i+1];
+                int idx = i+1;
+
+                if (idx >= cols.length) {
+                    log.warn("Insufficient column numbers: " + line);
+                    continue;
+                }
+
+                String value = cols[idx];
 
                 try {
                     columns[i].addValue(new ImportWaterlevelDifferenceValue(
--- a/flys-backend/src/main/java/de/intevation/flys/model/BedHeightSingle.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightSingle.java	Fri Sep 28 12:15:45 2012 +0200
@@ -241,13 +241,13 @@
         List<BedHeightSingle> singles = query.list();
         List<BedHeightSingle> good    = new ArrayList<BedHeightSingle>();
 
-        OUTER: for (BedHeightSingle s: singles) {
+        for (BedHeightSingle s: singles) {
             for (BedHeightSingleValue value: s.getValues()) {
                 double station = value.getStation().doubleValue();
 
                 if (station >= kmLo && station <= kmHi) {
                     good.add(s);
-                    continue OUTER;
+                    break;
                 }
             }
         }
--- a/flys-backend/src/main/java/de/intevation/flys/model/BedHeightType.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightType.java	Fri Sep 28 12:15:45 2012 +0200
@@ -76,6 +76,9 @@
         else if ("Querprofile".equals(description)) {
             return "QP";
         }
+        else if ("Querprofil".equals(description)) {
+            return "QP";
+        }
         else if ("TIN".equals(description)) {
             return "TIN";
         }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Fri Sep 28 12:15:45 2012 +0200
@@ -325,6 +325,5 @@
 
         return new MinMaxWQ(minw, maxw, minq, maxq);
     }
-
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java	Fri Sep 28 12:15:45 2012 +0200
@@ -48,6 +48,8 @@
 
     private Integer id;
 
+    private Long    officialNumber;
+
     private String  name;
 
     private boolean kmUp;
@@ -73,6 +75,15 @@
         this.id = id;
     }
 
+    @Column(name = "official_number")
+    public Long getOfficialNumber() {
+        return officialNumber;
+    }
+
+    public void setOfficialNumber(Long officialNumber) {
+        this.officialNumber = officialNumber;
+    }
+
     @Column(name = "name")
     public String getName() {
         return name;
@@ -316,5 +327,6 @@
 
         return result;
     }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Fri Sep 28 12:15:45 2012 +0200
@@ -35,6 +35,11 @@
     private Integer    kind;
     private River      river;
     private LineString geom;
+    
+    public static final int DEFAULT_KIND = 0;
+    
+    public static final int KIND_OFFICIAL = 1;
+    public static final int KIND_OUTSOURCED = 2;
 
     public RiverAxis() {
     }
@@ -88,11 +93,16 @@
 
 
     public static List<RiverAxis> getRiverAxis(String river) {
+        return getRiverAxis(river, DEFAULT_KIND);
+    }
+    
+    public static List<RiverAxis> getRiverAxis(String river, int kind) {
         Session session = SessionHolder.HOLDER.get();
 
         Query query = session.createQuery(
-            "from RiverAxis where river.name =:river");
+            "from RiverAxis where river.name =:river AND kind =:kind");
         query.setParameter("river", river);
+        query.setParameter("kind", kind);
 
         List<RiverAxis> list = query.list();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/utils/DgmSqlConverter.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,483 @@
+package de.intevation.flys.utils;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
+import au.com.bytecode.opencsv.CSVReader;
+
+
+/**
+ * A converter for CSV files with DGM information. The result of a conversion
+ * is an SQL file with "INSERT INTO dem ..." statements.
+ * <br>
+ * To start the converter, at least the following three system properties are
+ * required:
+ * <br>
+ * <ul>
+ * <ol><b>gew.dir</b>: This property must point to the directory where all
+ * rivers are stored.</ol>
+ * <ol><b>csv</b>: This property must point to the CSV file that contains the
+ * DGM information.</ol>
+ * <ol><b>sql</b>: This property must point to a (not yet existing) file that
+ * will be generated by this converter.</ol>
+ * </ul>
+ * <br>
+ * In addiation, the following properties are accepted to modify log messages,
+ * etc.
+ * <ul>
+ * <ol><b>verbose</b>: Accepts integer values (0, 1, 2, 3) to modify the log
+ * messages. The higher the value the more log messages are printed to STDOUT.
+ * </ol>
+ * <ol><b>full</b>: Accepts true|false values. If true is set, all rivers
+ * included in the CSV file are taken into account while parsing. Otherwise,
+ * the converter reads information for 'Saar', 'Mosel' and 'Eble' only.</ol>
+ * </ul>
+ *
+ * @author Ingo Weinzierl <a href="mailto:ingo.weinzierl@intevation.de">
+ * ingo.weinzierl@intevation.de</a>
+ *
+ */
+public class DgmSqlConverter {
+
+    public static final String SQL_INSERT = "INSERT INTO dem (river_id, name, lower, upper, year_from, year_to,"
+        + "projection, elevation_state, format, border_break, resolution, description, path) VALUES ("
+        + "%s, '%s', %s, %s, %s, %s, '%s', '%s', '%s', %s, '%s', '%s', '%s');";
+
+    public static final String SQL_SELECT_RIVER = "(SELECT id from rivers WHERE name = '%s')";
+
+    public static final char DEFAULT_SEPERATOR = ',';
+    public static final char DEFAULT_QUOTE = '"';
+    public static final int DEFAULT_LOG_LEVEL = 2;
+
+    public static final boolean FULL_MODE = Boolean.getBoolean("full");
+    public static final String GEW_DIR = System.getProperty("gew.dir", null);
+    public static final String CSV_FILE = System.getProperty("csv");
+    public static final String SQL_FILE = System.getProperty("sql");
+    public static final int LOG_LEVEL = Integer.getInteger("verbose",
+        DEFAULT_LOG_LEVEL);
+
+    public static final int MIN_COLUMN_COUNT = 15;
+
+    public static final int IDX_RIVERNAME = 0;
+    public static final int IDX_NAME = 12;
+    public static final int IDX_LOWER = 1;
+    public static final int IDX_UPPER = 2;
+    public static final int IDX_YEAR_FROM = 3;
+    public static final int IDX_YEAR_TO = 4;
+    public static final int IDX_PROJECTION = 7;
+    public static final int IDX_ELEVATION_STATE = 8;
+    public static final int IDX_FORMAT = 9;
+    public static final int IDX_BORDER_BREAK = 10;
+    public static final int IDX_RESOLUTION = 11;
+    public static final int IDX_DESCRIPTION = 14;
+    public static final int IDX_FILE_NAME = 5;
+    public static final int IDX_FILE_PATH = 6;
+
+    private class DGM {
+
+        public String river;
+        public String name;
+        public String projection;
+        public String elevationState;
+        public String format;
+        public String resolution;
+        public String description;
+        public String path;
+
+        public double lower;
+        public double upper;
+        public Integer yearFrom;
+        public Integer yearTo;
+
+        public boolean borderBreak;
+
+        public DGM() {
+            borderBreak = false;
+        }
+
+        public String toSQL() {
+            String riverId = String.format(SQL_SELECT_RIVER, river);
+            String lower = String.valueOf(this.lower);
+            String upper = String.valueOf(this.upper);
+            String yearFrom = this.yearFrom != null ? String
+                .valueOf(this.yearFrom) : "";
+            String yearTo = this.yearTo != null ? String.valueOf(this.yearTo)
+                : "";
+
+            return String.format(SQL_INSERT, riverId, name, lower, upper,
+                yearFrom, yearTo, projection, elevationState, format,
+                borderBreak, resolution, description, path);
+        }
+    }
+
+    private File riverDir;
+    private File csv;
+    private File sql;
+
+    private List<DGM> dgms;
+
+    public static void debug(String msg) {
+        if (LOG_LEVEL >= 3) {
+            System.out.println("DEBUG: " + msg);
+        }
+    }
+
+    public static void info(String msg) {
+        if (LOG_LEVEL >= 2) {
+            System.out.println("INFO: " + msg);
+        }
+    }
+
+    public static void warn(String msg) {
+        if (LOG_LEVEL >= 1) {
+            System.out.println("WARN: " + msg);
+        }
+    }
+
+    public static void error(String msg) {
+        System.out.println("ERROR: " + msg);
+    }
+
+    public static File getRiverDir(String[] args) {
+        if (GEW_DIR != null && GEW_DIR.length() > 0) {
+            return new File(GEW_DIR);
+        }
+        else if (args != null && args.length > 0) {
+            return new File(args[0]);
+        }
+
+        return null;
+    }
+
+    public static File getCSVFile(String[] args) {
+        if (CSV_FILE != null && CSV_FILE.length() > 0) {
+            return new File(CSV_FILE);
+        }
+        else if (args != null && args.length > 1) {
+            return new File(args[1]);
+        }
+
+        return null;
+    }
+
+    public static File getSQLFile(String[] args) {
+        if (SQL_FILE != null && SQL_FILE.length() > 0) {
+            return new File(SQL_FILE);
+        }
+        else if (args != null && args.length > 2) {
+            return new File(args[2]);
+        }
+
+        return null;
+    }
+
+    public static void main(String[] args) {
+        info("Start convering CSV -> SQL statements");
+
+        if (!FULL_MODE) {
+            info("You are running in DEMO mode; other rivers than 'Saar', 'Mosel' and 'Elbe' are ignored.");
+        }
+
+        File riverDir = getRiverDir(args);
+
+        if (riverDir == null) {
+            warn("No rivers directory specified!");
+            return;
+        }
+        else if (!riverDir.isDirectory()) {
+            warn("Specified rivers directory is not a directory!");
+            return;
+        }
+        else if (!riverDir.canRead()) {
+            warn("Unable to read '" + riverDir.toString() + "'");
+            return;
+        }
+
+        File csv = getCSVFile(args);
+
+        if (csv == null) {
+            warn("No CSV file specified!");
+            return;
+        }
+        else if (csv.isDirectory()) {
+            warn("Specified CSV file is a directory!");
+            return;
+        }
+        else if (!csv.canRead()) {
+            warn("Unable to read '" + csv.toString() + "'");
+            return;
+        }
+
+        File sql = getSQLFile(args);
+
+        if (sql == null) {
+            warn("No destination file specified!");
+            return;
+        }
+        else if (sql.isDirectory()) {
+            warn("Specified destination file is a directory!");
+            return;
+        }
+        else if (sql.exists() && !sql.canWrite()) {
+            warn("Unable to write to '" + sql.toString() + "'");
+            return;
+        }
+        else if (!sql.exists()) {
+            try {
+                sql.createNewFile();
+            }
+            catch (IOException ioe) {
+                warn("Unable to write to '" + sql.toString() + "'");
+                return;
+            }
+        }
+
+        info("Start parsing CSV file '" + csv.toString() + "'");
+
+        try {
+            DgmSqlConverter parser = new DgmSqlConverter(riverDir, csv, sql);
+            parser.read();
+            parser.write();
+        }
+        catch (Exception e) {
+            error("Unexpected error: " + e.getMessage());
+            e.printStackTrace();
+        }
+
+        info("Finished converting CSV -> SQL regularly.");
+    }
+
+    public DgmSqlConverter(File riverDir, File csv, File sql) {
+        this.riverDir = riverDir;
+        this.csv = csv;
+        this.sql = sql;
+        this.dgms = new ArrayList<DGM>();
+    }
+
+    public void read() {
+        info("Read DGM information from CSV file: " + csv.getAbsolutePath());
+
+        InputStream in = null;
+
+        try {
+            in = new BufferedInputStream(new FileInputStream(csv));
+        }
+        catch (FileNotFoundException e) {
+            error("File not found: " + e.getMessage());
+            return;
+        }
+
+        Reader reader = new InputStreamReader(in);
+        CSVReader csvReader = new CSVReader(reader, DEFAULT_SEPERATOR,
+            DEFAULT_QUOTE);
+
+        List<String[]> rows = new ArrayList<String[]>();
+
+        int success = 0;
+
+        try {
+            rows = csvReader.readAll();
+
+            for (int idx = 0; idx < rows.size(); idx++) {
+                String[] row = rows.get(idx);
+                if (readRow(row)) {
+                    success++;
+                }
+                else {
+                    warn("Unable to parse row " + (idx + 1));
+                }
+            }
+        }
+        catch (IOException e) {
+            error("Error while parsing CSV: " + e.getMessage());
+            return;
+        }
+
+        info("Parsed CSV file: " + rows.size() + " lines.");
+        info("Parsed " + success + " line successful");
+    }
+
+    private boolean readRow(String[] row) {
+        if (row == null) {
+            warn("Row is null!");
+            return false;
+        }
+
+        if (row.length < MIN_COLUMN_COUNT) {
+            warn("invalid column count: " + row.length);
+            return false;
+        }
+
+        StringBuffer rowBuffer = new StringBuffer();
+        for (String col : row) {
+            rowBuffer.append(col);
+            rowBuffer.append(" | ");
+        }
+        debug(rowBuffer.toString());
+
+        try {
+            DGM dgm = new DGM();
+            dgm.river = readRiver(row[IDX_RIVERNAME]);
+            dgm.name = row[IDX_NAME];
+            dgm.projection = row[IDX_PROJECTION];
+            dgm.elevationState = row[IDX_ELEVATION_STATE];
+            dgm.format = row[IDX_FORMAT];
+            dgm.resolution = row[IDX_RESOLUTION];
+            dgm.description = row[IDX_DESCRIPTION];
+            dgm.lower = readLower(row[IDX_LOWER]);
+            dgm.upper = readUpper(row[IDX_UPPER]);
+            dgm.yearFrom = readFromYear(row[IDX_YEAR_FROM]);
+            dgm.yearTo = readToYear(row[IDX_YEAR_TO]);
+            dgm.borderBreak = readBorderBreak(row[IDX_BORDER_BREAK]);
+            dgm.path = readPath(dgm.river, row[IDX_FILE_PATH],
+                row[IDX_FILE_NAME]);
+
+            dgms.add(dgm);
+
+            return true;
+        }
+        catch (IllegalArgumentException iae) {
+            warn(iae.getMessage());
+        }
+
+        return false;
+    }
+
+    private String readRiver(String rivername) throws IllegalArgumentException {
+        if (rivername == null || rivername.length() == 0) {
+            throw new IllegalAccessError("Invalid rivername: " + rivername);
+        }
+
+        if (!FULL_MODE
+            && !(rivername.equals("Saar") || rivername.equals("Mosel") || rivername
+                .equals("Elbe"))) {
+            throw new IllegalArgumentException("In DEMO mode; skip river: "
+                + rivername);
+        }
+
+        return rivername;
+    }
+
+    private Double readLower(String lower) throws IllegalArgumentException {
+        try {
+            return Double.valueOf(lower);
+        }
+        catch (NumberFormatException nfe) {
+        }
+
+        throw new IllegalArgumentException("Attribute 'lower' invalid: "
+            + lower);
+    }
+
+    private Double readUpper(String upper) throws IllegalArgumentException {
+        try {
+            return Double.valueOf(upper);
+        }
+        catch (NumberFormatException nfe) {
+        }
+
+        throw new IllegalArgumentException("Attribute 'upper' invalid: "
+            + upper);
+    }
+
+    private Integer readFromYear(String from) throws IllegalArgumentException {
+        try {
+            return Integer.valueOf(from);
+        }
+        catch (NumberFormatException nfe) {
+        }
+
+        return null;
+    }
+
+    private Integer readToYear(String to) throws IllegalArgumentException {
+        try {
+            return Integer.valueOf(to);
+        }
+        catch (NumberFormatException nfe) {
+        }
+
+        return null;
+    }
+
+    private String readPath(String rivername, String dir, String filename)
+        throws IllegalArgumentException {
+        File riverDir = new File(this.riverDir, rivername);
+        File dgmDir = new File(riverDir, dir);
+        File dgmFile = new File(dgmDir, filename);
+
+        try {
+            debug("Path of DGM = " + dgmFile.getAbsolutePath());
+
+            if (dgmFile == null || !dgmFile.exists()) {
+                throw new IllegalAccessError(
+                    "Specified DGM file does not exist: "
+                        + dgmFile.getAbsolutePath());
+            }
+
+            if (!dgmFile.isFile()) {
+                throw new IllegalArgumentException(
+                    "Specified DGM file is no file: "
+                        + dgmFile.getAbsolutePath());
+            }
+        }
+        catch (IllegalAccessError iae) {
+            throw new IllegalArgumentException("Cannot find DGM file (river="
+                + rivername + " | directory=" + dir + " | filename=" + filename
+                + ")");
+        }
+
+        return dgmFile.getAbsolutePath();
+    }
+
+    private boolean readBorderBreak(String borderBreak) {
+        if (borderBreak == null || borderBreak.length() == 0) {
+            return true;
+        }
+        else if (borderBreak.toLowerCase().equals("ja")) {
+            return true;
+        }
+        else if (borderBreak.toLowerCase().equals("nein")) {
+            return false;
+        }
+        else {
+            return true;
+        }
+    }
+
+    public void write() {
+        info("Write DEM information to SQL file: " + sql.getAbsolutePath());
+
+        BufferedWriter bufferedWriter = null;
+        try {
+            bufferedWriter = new BufferedWriter(new FileWriter(sql));
+
+            for (DGM dgm : dgms) {
+                bufferedWriter.write(dgm.toSQL());
+                bufferedWriter.newLine();
+            }
+        }
+        catch (IOException ioe) {
+            error(ioe.getMessage());
+        }
+        finally {
+            if (bufferedWriter != null) {
+                try {
+                    bufferedWriter.close();
+                }
+                catch (IOException ioe) {
+                }
+            }
+        }
+    }
+}
--- a/flys-client/ChangeLog	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/ChangeLog	Fri Sep 28 12:15:45 2012 +0200
@@ -1,3 +1,262 @@
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java,
+	  src/main/java/de/intevation/flys/client/server/ArtifactHelper.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeDischargeCurveArtifact.java,
+	  src/main/java/de/intevation/flys/client/client/services/ArtifactService.java,
+	  src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYS.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/ParameterList.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java:
+	  Allow to create a discharge curve from a gauge info.
+	  Currently the dicharge curve will not be displayed.
+
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java:
+	  Add river name to the GaugeInfo
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Work on issue724 (i18n in minfo).
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties:
+	  Translate data export.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/services/ModuleServiceAsync.java,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java:
+	  Cosmetics, docs.
+
+2012-09-27	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/UserServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Donate own error message when no users were found.
+
+2012-09-27	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DoubleProperty.java,
+	  src/main/java/de/intevation/flys/client/shared/model/PropertySetting.java,
+	  src/main/java/de/intevation/flys/client/shared/model/PropertyGroup.java:
+	  Add "Date" support for Manual Points editor (not finished yet).
+
+	* src/main/java/de/intevation/flys/client/shared/model/MapMode.java:
+	  Add comment.
+
+2012-09-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/MapMode.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java:
+	  Removed trailing whitespace.
+
+2012-09-27	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/webapp/WEB-INF/web.xml:
+	  Add servlet mapping for the GaugeOverviewInfoService
+
+2012-09-26  Ingo Weinzierl <ingo@intevation.de>
+
+	flys/issue897 (MissingResourceException: Cannot find constant '500 The call failed on the server; see server log for details')
+
+	* src/main/java/de/intevation/flys/client/shared/model/MapMode.java:
+	  Readded default constructor.
+
+2012-09-25	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java:
+	  Default from and to dates are now shown with english locale, too (#854).
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
+	  Cosmetics.
+
+2012-09-25	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Improved fix for issue860 (minfo parameterization in helper pane).
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java
+	  (createWidget, createCheckBox): Renamed.
+	  Use smartgwt stuff to profit from scrollbars (yay!).
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java:
+	  Place ParameterMatrix in helper pane if too long.
+
+2012-09-25	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Attempt at issue860 (minfo parameterization in helper pane).
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java:
+	  Place ParameterMatrix in helper pane if too long.
+
+2012-09-24	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/widgets/KMSpinner.java:
+	  Issue #853:
+	  - Height is now normal again
+	  - "Junk" chars are now removed on change	
+
+2012-09-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	issue846 (GGInA: Auth mechanism ignores URL prefix)
+
+	* src/main/java/de/intevation/flys/client/server/LoginServlet.java,
+	  src/main/java/de/intevation/flys/client/server/GGInAFilter.java,
+	  src/main/webapp/login.jsp:
+	  Consider the Context Path variable when using urls in the GGInAFilter.
+
+2012-09-24	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	issue871 (parameterization of flowvelocity loo¿s a tiny bit messy).
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java:
+	  Show horizontal line between entries.
+
+2012-09-24	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java,
+	  src/main/java/de/intevation/flys/client/shared/model/IntegerOptionsData.java:
+	  Cosmetics, docs.
+
+2012-09-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java:
+	  Finally store passed kmup value in member variable.
+
+2012-09-24	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java:
+	  Use i18n to calculate the info urls for the gauge overview instead of
+	  fechting the urls from the artifact service.
+
+2012-09-22	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java:
+	  Show full function instead of internal name (#873).
+
+2012-09-21  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Added i18n strings for bedheight difference calculation.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java:
+	  Open fold for historicalq reference.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java:
+	  Add the official gauge number to the GaugeInfo class.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Refactor GaugeTree into its own java file. Due to the folding logic in the
+	  GaugeTree the code became quite lage. Therefore it is better preserved in
+	  its own file.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Additional refactoring to avoid code duplication and fixing reading double
+	  value from locations DataItem object. Also add another code path for
+	  location_distance winfo state.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Refactor to avoid code duplication
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Add html links to the additional gauge and river info pages.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java:
+	  Extend GaugeInfo and RiverInfo to store also the http url for additional
+	  info.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Open and close gauge tree folds that correspond to the selected WINFO
+	  calculation.
+
+2012-09-21	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java:
+	  Fix NullPointerException on not available list
+
+2012-09-20	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixMultiPeriodPanel.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  i18n for FixMultiPeriodPanel (#872).
+
+2012-09-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Prevent AIOOB exception.
+
+2012-09-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Removed superfluous import.
+
+2012-09-19	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  i18n (#858)
+
 2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Fri Sep 28 12:15:45 2012 +0200
@@ -17,6 +17,8 @@
 import de.intevation.flys.client.client.event.CollectionChangeHandler;
 import de.intevation.flys.client.client.services.ArtifactService;
 import de.intevation.flys.client.client.services.ArtifactServiceAsync;
+import de.intevation.flys.client.client.services.CreateCollectionService;
+import de.intevation.flys.client.client.services.CreateCollectionServiceAsync;
 import de.intevation.flys.client.client.services.DescribeCollectionService;
 import de.intevation.flys.client.client.services.DescribeCollectionServiceAsync;
 import de.intevation.flys.client.client.services.GetArtifactService;
@@ -72,6 +74,9 @@
     protected GetArtifactServiceAsync getArtifactService =
         GWT.create(GetArtifactService.class);
 
+    /** The CreateCollectionServiceAsync used to create a new collection */
+    protected CreateCollectionServiceAsync collectionService =
+        GWT.create(CreateCollectionService.class);
 
     /** The menu bar at the top of the application. */
     protected MainMenu menu;
@@ -440,6 +445,55 @@
         });
     }
 
+    public void newGaugeDischargeCurve(String river, Long gaugeref) {
+        Config config = Config.getInstance();
+
+        final String locale = config.getLocale();
+        final String riv = river;
+        final Long ref = gaugeref;
+        final FLYS   flys = this;
+
+        User user = getCurrentUser();
+
+        if (user == null) {
+            SC.warn(MSG.error_not_logged_in());
+            return;
+        }
+
+        collectionService.create(locale, user.identifier(),
+            new AsyncCallback<Collection>() {
+                @Override
+                public void onFailure(Throwable caught) {
+                    GWT.log("Could not create new collection.");
+                    SC.warn(MSG.getString(caught.getMessage()));
+                }
+
+                @Override
+                public void onSuccess(Collection collection) {
+                    GWT.log("Successfully created a new collection.");
+                    final Collection col = collection;
+                    artifactService.createGaugeDischargeCurverArtifact(
+                        col, locale, riv, ref,
+                        new AsyncCallback<Artifact>() {
+                            @Override
+                            public void onFailure(Throwable caught) {
+                                GWT.log("Could not create the new artifact.");
+                                SC.warn(MSG.getString(caught.getMessage()));
+                            }
+
+                            @Override
+                            public void onSuccess(Artifact artifact) {
+                                GWT.log("Successfully created a new artifact.");
+                                CollectionView view = new CollectionView(flys,
+                                    col, artifact);
+                                workspace.addView("new-project", view);
+
+                                view.addCollectionChangeHandler(getProjectList());
+                            }
+                    });
+                }
+            });
+    }
 
     @Override
     public void onCollectionChange(CollectionChangeEvent event) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Sep 28 12:15:45 2012 +0200
@@ -8,6 +8,8 @@
  */
 public interface FLYSConstants extends ConstantsWithLookup {
 
+    String add();
+
     String unexpected_exception();
 
     String title();
@@ -367,6 +369,17 @@
     String zoomboxTooltip();
 
     String chartPropertiesTooltip();
+
+    // Gauges
+
+    String gauge_mnq();
+
+    String gauge_mq();
+
+    String gauge_mhq();
+
+    String gauge_hq5();
+
     // Elevation window
 
     String ele_window_title();
@@ -393,6 +406,8 @@
 
     String discharge_curve();
 
+    String gauge_discharge_curve();
+
     String computed_discharge_curve();
 
     String computed_discharge_curves();
@@ -532,10 +547,14 @@
     String load_diameter();
 
     String bed_diameter();
-    
+
     String soundings();
 
-    String soundings();
+    String bed_difference_year();
+
+    String bed_difference_epoch();
+
+    String bed_difference_height_year();
 
     // ERRORS
 
@@ -571,6 +590,8 @@
 
     String error_no_such_user();
 
+    String error_no_users();
+
     String error_no_waterlevel_pair_selected();
 
     String error_same_waterlevels_in_pair();
@@ -1011,8 +1032,20 @@
 
     String sq_overview();
 
+    // Gauge Overview Info
+
     String gauge_zero();
 
     String gauge_q_unit();
+
+    String gauge_info_link();
+
+    String gauge_river_info_link();
+
+    String gauge_river_url();
+
+    String gauge_url();
+
+    String gauge_curve_link();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -84,6 +84,7 @@
 start_year = Start
 end_year = End
 period = Period
+
 # Header images
 flysLogo = images/flys_logo.gif
 bfgLogo = images/bfg_logo.gif
@@ -175,8 +176,8 @@
 main_channel = Main Channel
 total_channel = Total Channel
 footerHome = Home
-footerContact = Kontakt
-footerImpressum = Impressum
+footerContact = Contact
+footerImpressum = Legal info
 
 buttonNext = Next
 imageBack = images/back_en.png
@@ -191,8 +192,10 @@
 zoom_back = images/mag_zoom_back.png
 pan = images/hand.png
 askThemeRemove = Are you sure that you want to remove the selected theme / themes?
+add = Add
 
 discharge_curve = Discharge Curves at Gauges
+gauge_discharge_curve = Discharge Curves at Gauge
 computed_discharge_curve = Discharge Curve
 computed_discharge_curves = Discharge Curves
 longitudinal_section = Longitudinal Section Curve
@@ -228,6 +231,9 @@
 load_diameter = Bedload Diameter
 bed_diameter = Bed Diameter
 soundings = Soundings
+bed_difference_year = Single Bedheight Differences
+bed_difference_epoch = Epoch Bedheight Differences
+bed_difference_height_year = Bedheight Differences per year
 
 exportATTooltip = Export as AT file
 
@@ -239,7 +245,7 @@
 discharge_longitudinal_section_report = Discharge Longitudinal Section Report
 durationcurve_export = Duration Curve Export
 durationcurve_report = Duration Curve Report
-dataexport = Datenexport
+dataexport = Data export
 csv = CSV
 wst = WST
 at = AT
@@ -261,6 +267,11 @@
 chart_themepanel_area_between = between ...
 against_x_axis = Over X-Axis
 
+gauge_mnq = around MNQ
+gauge_mq  = around MQ
+gauge_mhq = around MHQ
+gauge_hq5 = above HQ5
+
 ele_window_title = Elevation Node
 ele_window_label = Elevation settings in m \u00fc. NN.
 ele_window_x_col = X
@@ -290,6 +301,7 @@
 error_describe_collection = Error while fetching the projects state.
 error_no_rivers_found = Error while reading supported rivers.
 error_no_such_user = Error - no such user found.
+error_no_users = Error - no users found.
 error_no_waterlevel_pair_selected = Error - no waterlevel pair for building differences selected.
 error_same_waterlevels_in_pair = Error - minuend and subtrahend have to differ.
 error_not_logged_in = You need to log in before you are allowed to start your work.
@@ -527,3 +539,8 @@
 
 gauge_zero = Gauge zero ground
 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_curve_link = Dischargecurve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -178,6 +178,7 @@
 zoom_back = images/mag_zoom_back.png
 pan = images/hand.png
 askThemeRemove = Sind Sie sicher, dass sie die gew\u00e4hlten / das gew\u00e4lte Thema l\u00f6eschen wollen?
+add = Hinzuf\u00fcgen
 
 addPointsTooltip = Manuelle Punkte hinzuf\u00fcgen
 addWSPTooltip = Manuelle WSP hinzuf\u00fcgen
@@ -193,6 +194,7 @@
 chartPropertiesTooltip = Diagrammeigenschaften
 
 discharge_curve = Abflusskurven an Pegeln
+gauge_discharge_curve = Abflusskurven an Pegel
 computed_discharge_curve = Abflusskurve
 computed_discharge_curves = Abflusskurven
 longitudinal_section = L\u00e4ngsschnitt
@@ -228,6 +230,9 @@
 load_diameter = Geschiebedurchmesser
 bed_diameter = Sohldurchmesser
 soundings = Peilungen
+bed_difference_year = Sohlh\u00f6hendifferenz (Jahr)
+bed_difference_epoch = Sohlh\u00f6hendifferenz (Epoche)
+bed_difference_height_year = Sohlh\u00f6hendifferenz pro Jahr
 
 waterlevel_export = Wasserstand/Wasserspiegellagen Export
 waterlevel_report = Wasserstand/Wasserspiegellagen Bericht
@@ -261,6 +266,11 @@
 chart_themepanel_area_between = zwischen ...
 against_x_axis =  \u00fcber X-Achse
 
+gauge_mnq = um MNQ
+gauge_mq  = um MQ
+gauge_mhq = um MHQ
+gauge_hq5 = \u00fcber HQ5
+
 ele_window_title = H\u00f6henknoten setzen
 ele_window_label = H\u00f6henangaben in m \u00fc. NN.
 ele_window_x_col = X
@@ -289,7 +299,8 @@
 error_create_collection = Fehler beim Erstellen eines neuen Projektes.
 error_describe_collection = Fehler beim Laden des Projektzustandes.
 error_no_rivers_found = Fehler beim Lesen der unterst\u00fctzten Fl\u00fcsse.
-error_no_such_user = Fehler - Kein Benutzer vorhanden.
+error_no_such_user = Fehler - Kein solcher Benutzer vorhanden.
+error_no_users = Fehler - Keine Benutzer vorhanden.
 error_no_waterlevel_pair_selected = Fehler - kein Paar zur Differenzenbildung gew\u00e4hlt.
 error_same_waterlevels_in_pair = Error - minuend and subtrahend m\u00fcssen sich unterscheiden.
 error_not_logged_in = Sie m\u00fcssen sich erst einloggen um mit der Arbeit beginnen zu k\u00f6nnen.
@@ -526,3 +537,8 @@
 
 gauge_zero = Pegelnullpunkt
 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_curve_link = Abflusskurve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Sep 28 12:15:45 2012 +0200
@@ -55,8 +55,8 @@
 scale = Scale
 databasket = Databasket
 databasket_loading = Loading Databasket content
-fix = TODO FIX ANALYSE TODO
-fixanalysis = TODO FIX ANALYSE TODO
+fix = Fixing
+fixanalysis = Fixing Analysis
 next = Next
 location_distance_state = Choose calculation location(s) / range [km]
 distance_state = Choose calculation range [km]
@@ -176,8 +176,8 @@
 main_channel = Main Channel
 total_channel = Total Channel
 footerHome = Home
-footerContact = Kontakt
-footerImpressum = Impressum
+footerContact = Contact
+footerImpressum = Legal info
 
 buttonNext = Next
 imageBack = images/back_en.png
@@ -192,8 +192,10 @@
 zoom_back = images/mag_zoom_back.png
 pan = images/hand.png
 askThemeRemove = Are you sure that you want to remove the selected theme / themes?
+add = Add
 
 discharge_curve = Discharge Curves at Gauges
+gauge_discharge_curve = Discharge Curves at Gauge
 computed_discharge_curve = Discharge Curve
 computed_discharge_curves = Discharge Curves
 longitudinal_section = Longitudinal Section Curve
@@ -229,6 +231,9 @@
 load_diameter = Bedload Diameter
 bed_diameter = Bed Diameter
 soundings = Soundings
+bed_difference_year = Single Bedheight Differences
+bed_difference_epoch = Epoch Bedheight Differences
+bed_difference_height_year = Bedheight Difference per year
 
 exportATTooltip = Export as AT file
 
@@ -240,7 +245,7 @@
 discharge_longitudinal_section_report = Discharge Longitudinal Section Report
 durationcurve_export = Duration Curve Export
 durationcurve_report = Duration Curve Report
-dataexport = Datenexport
+dataexport = Data export
 csv = CSV
 wst = WST
 at = AT
@@ -262,6 +267,11 @@
 chart_themepanel_area_between = between ...
 against_x_axis = Over X-Axis
 
+gauge_mnq = around MNQ
+gauge_mq  = around MQ
+gauge_mhq = around MHQ
+gauge_hq5 = above HQ5
+
 ele_window_title = Elevation Node
 ele_window_label = Elevation settings in m \u00fc. NN.
 ele_window_x_col = X
@@ -291,6 +301,7 @@
 error_describe_collection = Error while fetching the projects state.
 error_no_rivers_found = Error while reading supported rivers.
 error_no_such_user = Error - no such user found.
+error_no_users = Error - no users found.
 error_no_waterlevel_pair_selected = Error - no waterlevel pair for building differences selected.
 error_same_waterlevels_in_pair = Error - minuend and subtrahend have to differ.
 error_not_logged_in = You need to log in before you are allowed to start your work.
@@ -527,3 +538,8 @@
 
 gauge_zero = Gauge zero ground
 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_curve_link = Dischargecurve
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java	Fri Sep 28 12:15:45 2012 +0200
@@ -5,6 +5,7 @@
 
 import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.Collection;
 
 import de.intevation.flys.client.shared.model.Recommendation;
 
@@ -31,5 +32,19 @@
         String         factory,
         Recommendation recommendation
     ) throws ServerException;
+
+    /**
+     * Create a new GaugeDischageCurveArtifact
+     *
+     * @param collection the collection to add the artifact to
+     * @param river      the river
+     * @param gaugeref   reference id of the gauge
+     */
+    public Artifact createGaugeDischargeCurverArtifact(
+            Collection collection,
+            String locale,
+            String river,
+            Long   gaugeref
+    ) throws ServerException;
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java	Fri Sep 28 12:15:45 2012 +0200
@@ -3,6 +3,7 @@
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.Collection;
 
 import de.intevation.flys.client.shared.model.Recommendation;
 
@@ -19,5 +20,13 @@
         String         factory,
         Recommendation recommendation,
         AsyncCallback<Artifact> callback);
+
+    public void createGaugeDischargeCurverArtifact(
+        Collection collection,
+        String locale,
+        String river,
+        Long   gaugeref,
+        AsyncCallback<Artifact> callback
+    );
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/services/ModuleServiceAsync.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ModuleServiceAsync.java	Fri Sep 28 12:15:45 2012 +0200
@@ -9,5 +9,4 @@
     public void list(String locale,
         AsyncCallback<Module[]> callback);
 }
-
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -100,7 +100,7 @@
     public void setValues(double[] values) {
         NumberFormat f = NumberFormat.getDecimalFormat();
 
-        if(values.length == 0) {
+        if(values == null || values.length == 0) {
             ti.clearValue();
             return;
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,38 +1,31 @@
 package de.intevation.flys.client.client.ui;
 
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.DecoratorPanel;
-import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.Anchor;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.Tree;
-import com.google.gwt.user.client.ui.TreeItem;
 
-import com.smartgwt.client.types.Alignment;
 import com.smartgwt.client.types.Overflow;
 import com.smartgwt.client.widgets.events.ResizedEvent;
 import com.smartgwt.client.widgets.events.ResizedHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.SectionStackSection;
 import com.smartgwt.client.widgets.layout.VLayout;
 
+import de.intevation.flys.client.client.FLYS;
 import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.client.services.GaugeOverviewInfoService;
 import de.intevation.flys.client.client.services.GaugeOverviewInfoServiceAsync;
-import de.intevation.flys.client.shared.model.GaugeInfo;
+import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.RiverInfo;
 
 /**
  * The GaugePanel is intendet to be used within a SectionStackSection
  * It extends the VLayout by two methods to show and hide the
  * section stack section.
+ *
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
  */
 public class GaugePanel extends VLayout implements ResizedHandler {
 
@@ -45,19 +38,24 @@
     /** The message class that provides i18n strings.*/
     protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
+    private FLYS flys;
+
     protected GaugeOverviewInfoServiceAsync gaugeOverviewInfoService =
         GWT.create(GaugeOverviewInfoService.class);
 
-    protected GaugeTree gaugetree = new GaugeTree();
+    protected GaugeTree gaugetree;
 
     protected RiverInfoPanel riverinfopanel;
 
     /**
      * Creates a new VLayout with a SectionStackSection
      * The GaugePanel's SectionStackSection is hidden by default.
+     *
+     * @param flys The FLYS object
      * @param sectionStack The section stack section to place the VLayout in.
      */
-    public GaugePanel(SectionStackSection sectionStack) {
+    public GaugePanel(FLYS flys, SectionStackSection sectionStack) {
+        gaugetree = new GaugeTree(flys);
         setOverflow(Overflow.HIDDEN);
         sectionStack.setHidden(true);
         sectionStack.setItems(this);
@@ -77,6 +75,13 @@
     }
 
     /**
+     * Sets the data and closes not corresponding folds in the gauge tree
+     */
+    public void setData(DataList[] data) {
+        gaugetree.setData(data);
+    }
+
+    /**
      * Loads the river info and renders it afterwards
      */
     public void refresh() {
@@ -88,7 +93,6 @@
             public void onSuccess(RiverInfo riverinfo) {
                 GWT.log("Loaded river info");
                 renderGaugeOverviewInfo(riverinfo);
-                gaugetree.openAll();
             }
         });
     }
@@ -137,69 +141,6 @@
         this.sectionStack.setHidden(false);
     }
 
-    class GaugeTree extends ScrollPanel {
-
-        private Tree tree;
-
-        public GaugeTree() {
-            tree = new Tree();
-            setWidget(tree);
-        }
-
-        /**
-         * Resets the items of the tree.
-         * If the list of gauges is empty or null the tree will be empty.
-         */
-        public void setGauges(RiverInfo riverinfo) {
-            tree.clear();
-
-            List<GaugeInfo> gauges = riverinfo.getGauges();
-
-            if (gauges != null && !gauges.isEmpty()) {
-
-                ArrayList<GaugeInfo> emptygauges = new ArrayList<GaugeInfo>();
-
-                if (!riverinfo.isKmUp()) {
-                    for (GaugeInfo gauge : gauges) {
-                        addGauge(gauge, emptygauges);
-                    }
-                }
-                else {
-                    for (int i = gauges.size(); i >= 0; i--) {
-                        GaugeInfo gauge = gauges.get(i);
-                        addGauge(gauge, emptygauges);
-                    }
-                }
-
-                // put empty gauges to the end
-                for (GaugeInfo gauge : emptygauges) {
-                    addGauge(gauge);
-                }
-            }
-        }
-
-        private void addGauge(GaugeInfo gauge, List<GaugeInfo> empty) {
-            if (gauge.getKmStart() != null && gauge.getKmEnd() != null) {
-                addGauge(gauge);
-            }
-            else {
-                empty.add(gauge);
-            }
-        }
-
-        private void addGauge(GaugeInfo gauge) {
-            TreeItem gaugeitem = new GaugeInfoItem(gauge);
-            tree.addItem(gaugeitem);
-        }
-
-        public void openAll() {
-            for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) {
-                TreeItem item = it.next();
-                item.setState(true);
-            }
-        }
-    }
-
     class RiverInfoPanel extends HorizontalPanel {
 
         public final static int HEIGHT = 30;
@@ -250,6 +191,13 @@
             }
 
             addLabel(qtext, false);
+
+            Long number = riverinfo.getOfficialNumber();
+            String url = number != null ?
+                MSG.gauge_river_url() + number :
+                MSG.gauge_river_url();
+            Anchor anchor = new Anchor(MSG.gauge_river_info_link(), url);
+            add(anchor);
         }
 
         private void addLabel(String text, boolean wordwrap) {
@@ -258,104 +206,4 @@
             setCellHeight(label, "" + HEIGHT + "px");
         }
     }
-
-    class GaugeInfoItem extends TreeItem {
-        public GaugeInfoItem(GaugeInfo gauge) {
-            GaugeInfoHead gaugeinfohead = new GaugeInfoHead(gauge);
-            GaugeInfoPanel gaugeinfopanel = new GaugeInfoPanel(gauge);
-            setWidget(gaugeinfohead);
-            addItem(gaugeinfopanel);
-        }
-    }
-
-    class GaugeInfoHead extends HLayout {
-
-        public GaugeInfoHead(GaugeInfo gauge) {
-            setStyleName("gaugeinfohead");
-            setAutoHeight();
-            setAutoWidth();
-
-            NumberFormat nf = NumberFormat.getDecimalFormat();
-
-            Label label = new Label(gauge.getName(), true);
-            addMember(label);
-
-            Double start;
-            Double end;
-
-            if (!gauge.isKmUp()) {
-                start = gauge.getKmStart();
-                end   = gauge.getKmEnd();
-            }
-            else {
-                start = gauge.getKmEnd();
-                end   = gauge.getKmStart();
-            }
-
-            String kmtext = "";
-            if (start != null) {
-                kmtext += nf.format(start);
-                kmtext += " - ";
-            }
-            if (end != null) {
-                kmtext += nf.format(end);
-            }
-            if (start != null || end != null) {
-                kmtext += " km";
-            }
-
-            label = new Label(kmtext);
-
-            addMember(label);
-
-            Double station = gauge.getStation();
-            if (station != null) {
-                String stext = nf.format(station);
-                stext += " km";
-                label = new Label(stext);
-                addMember(label);
-            }
-        }
-    }
-
-    class GaugeInfoPanel extends DecoratorPanel {
-
-        public GaugeInfoPanel(GaugeInfo gauge) {
-            setStyleName("gaugeinfopanel");
-            Grid grid = new Grid(4, 2);
-
-            NumberFormat nf = NumberFormat.getDecimalFormat();
-
-            Double minw = gauge.getMinW();
-            Double maxw = gauge.getMaxW();
-            if (minw != null && maxw != null) {
-                grid.setText(0, 0, MSG.wq_value_q());
-                grid.setText(0, 1, "" + nf.format(minw) +
-                        " - " + nf.format(maxw));
-            }
-
-            Double minq = gauge.getMinQ();
-            Double maxq = gauge.getMaxQ();
-            if (minq != null && maxq != null) {
-                grid.setText(1, 0, MSG.wq_value_w());
-                grid.setText(1, 1, "" + nf.format(minq) +
-                        " - " + nf.format(maxq));
-            }
-
-            Double aeo = gauge.getAeo();
-            if (aeo != null) {
-                grid.setText(2, 0, "AEO [km²]");
-                grid.setText(2, 1, "" + nf.format(aeo));
-            }
-
-            Double datum = gauge.getDatum();
-            if (datum != null) {
-                grid.setText(3, 0, MSG.gauge_zero() + " [" +
-                        gauge.getWstUnit() + "]");
-                grid.setText(3, 1, "" + nf.format(datum));
-            }
-
-            setWidget(grid);
-        }
-    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,465 @@
+package de.intevation.flys.client.client.ui;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Iterator;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.i18n.client.NumberFormat;
+import com.google.gwt.user.client.ui.Anchor;
+import com.google.gwt.user.client.ui.DecoratorPanel;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.Tree;
+import com.google.gwt.user.client.ui.TreeItem;
+
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import de.intevation.flys.client.client.FLYS;
+import de.intevation.flys.client.client.FLYSConstants;
+
+import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
+import de.intevation.flys.client.shared.model.DataList;
+import de.intevation.flys.client.shared.model.GaugeInfo;
+import de.intevation.flys.client.shared.model.RiverInfo;
+
+
+public class GaugeTree extends ScrollPanel {
+
+    private FLYS flys;
+    private Tree tree;
+    private DataList[] data;
+
+    /** The message class that provides i18n strings.*/
+    protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
+
+    public GaugeTree(FLYS flys) {
+        this.flys = flys;
+        tree = new Tree();
+        setWidget(tree);
+    }
+
+    /**
+     * Resets the items of the tree.
+     * If the list of gauges is empty or null the tree will be empty.
+     */
+    public void setGauges(RiverInfo riverinfo) {
+        tree.clear();
+
+        List<GaugeInfo> gauges = riverinfo.getGauges();
+
+        if (gauges != null && !gauges.isEmpty()) {
+
+            ArrayList<GaugeInfo> emptygauges = new ArrayList<GaugeInfo>();
+
+            if (!riverinfo.isKmUp()) {
+                for (GaugeInfo gauge : gauges) {
+                    addGauge(gauge, emptygauges);
+                }
+            }
+            else {
+                for (int i = gauges.size()-1; i >= 0; i--) {
+                    GaugeInfo gauge = gauges.get(i);
+                    addGauge(gauge, emptygauges);
+                }
+            }
+
+            // put empty gauges to the end
+            for (GaugeInfo gauge : emptygauges) {
+                addGauge(gauge);
+            }
+
+            open();
+        }
+    }
+
+    private void addGauge(GaugeInfo gauge, List<GaugeInfo> empty) {
+        if (gauge.getKmStart() != null && gauge.getKmEnd() != null) {
+            addGauge(gauge);
+        }
+        else {
+            empty.add(gauge);
+        }
+    }
+
+    private void addGauge(GaugeInfo gauge) {
+        GaugeInfoItem gaugeitem = new GaugeInfoItem(flys, gauge);
+        tree.addItem(gaugeitem);
+    }
+
+    public void openAll() {
+        GWT.log("GaugeTree - openAll");
+        for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) {
+            TreeItem item = it.next();
+            item.setState(true);
+        }
+    }
+
+    public void setData(DataList[] data) {
+        this.data = data;
+        if (tree.getItemCount() > 0) {
+            open();
+        }
+    }
+
+    public void open() {
+        ArrayList<Double> locations = new ArrayList<Double>();
+
+        if (data != null && data.length > 0) {
+            for (int i = 0; i < data.length; i++) {
+                DataList dl = data[i];
+                String state = dl.getState();
+                GWT.log("GaugeTree - setData " + state);
+                if (state.equals("state.winfo.location_distance")) {
+                    Double ldfrom = null;
+                    Double ldto = null;
+
+                    for (int j = dl.size()-1; j >= 0; --j) {
+                        Data d = dl.get(j);
+                        String label = d.getLabel();
+                        GWT.log("GaugeTree - setData - label " + label + " " + d.getStringValue());
+                        if (label.equals("ld_from")) {
+                            ldfrom = getDoubleValue(d);
+                        }
+                        else if (label.equals("ld_to")) {
+                            ldto = getDoubleValue(d);
+                        }
+                        else if (label.equals("ld_locations")) {
+                            getLocationsFromData(locations, d);
+                            openOnLocations(locations);
+                            return;
+                        }
+                    }
+                    if (ldfrom != null) {
+                        openOnDistance(ldfrom, ldto);
+                        return;
+                    }
+                }
+                else if(state.equals("state.winfo.distance_only") ||
+                        state.equals("state.winfo.distance")) {
+                    Double ldfrom = null;
+                    Double ldto = null;
+
+                    for (int j = dl.size()-1; j >= 0; --j) {
+                        Data d = dl.get(j);
+                        String label = d.getLabel();
+                        GWT.log("GaugeTree - setData - label " + label + " " + d.getStringValue());
+                        if (label.equals("ld_from")) {
+                            ldfrom = getDoubleValue(d);
+                        }
+                        else if (label.equals("ld_to")) {
+                            ldto = getDoubleValue(d);
+                        }
+                    }
+
+                    if (ldfrom != null) {
+                        openOnDistance(ldfrom, ldto);
+                        return;
+                    }
+                        }
+                else if (state.equals("state.winfo.location")) {
+                    getLocations("ld_locations", locations, dl);
+                    openOnLocations(locations);
+                    return;
+                }
+                else if (state.equals("state.winfo.reference.curve.input.start")) {
+                    getLocations("reference_startpoint", locations, dl);
+                }
+                else if (state.equals("state.winfo.reference.curve.input.end")) {
+                    getLocations("reference_endpoint", locations, dl);
+                }
+                else if (state.equals("state.winfo.historicalq.reference_gauge")) {
+                    for (int j = dl.size()-1; j >= 0; --j) {
+                        Data d = dl.get(j);
+                        String label = d.getLabel();
+                        if (label.equals("reference_gauge")) {
+                            String tmp = d.getStringValue();
+                            if (tmp != null) {
+                                Long gaugereference = Long.valueOf(tmp);
+                                if (gaugereference != null) {
+                                    openOnReference(gaugereference);
+                                    return;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        if (!locations.isEmpty()) {
+            openOnLocations(locations);
+        }
+        else {
+            openAll();
+        }
+    }
+
+    private void getLocations(String labelname, List<Double> locations, DataList dl) {
+        for (int j = dl.size()-1; j >= 0; --j) {
+            Data d = dl.get(j);
+            String label = d.getLabel();
+            if (label.equals(labelname)) {
+                getLocationsFromData(locations, d);
+            }
+        }
+    }
+
+    private void getLocationsFromData(List<Double> locations, Data data) {
+        DataItem[] items = data.getItems();
+        for (int k = 0; k < items.length; k++) {
+            String tmp = items[k].getStringValue();
+            GWT.log("GaugeTree - getLocationsFromData " + tmp);
+            if (tmp != null) {
+                if (tmp.contains(" ")) {
+                    // string contains several values ...
+                    String[] values = tmp.split(" ");
+                    for(int i=0; i < values.length; i++) {
+                        Double value = Double.valueOf(values[i]);
+                        if (value != null) {
+                            locations.add(value);
+                        }
+                    }
+                }
+                else {
+                    Double value = Double.valueOf(tmp);
+                    if (value != null) {
+                        locations.add(value);
+                    }
+                }
+            }
+        }
+    }
+
+    private Double getDoubleValue(Data d) {
+        String tmp = d.getStringValue();
+        if (tmp != null) {
+            return Double.valueOf(tmp);
+        }
+        return null;
+    }
+
+    public void openOnReference(Long number) {
+        GWT.log("GaugeTree - openOnReference " + number);
+        for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) {
+            TreeItem item = it.next();
+            if (item instanceof GaugeInfoItem) {
+                GaugeInfoItem gitem = (GaugeInfoItem)item;
+                if (gitem.getReference().equals(number)) {
+                    item.setState(true);
+                }
+                else {
+                    item.setState(false);
+                }
+            }
+        }
+    }
+
+    public void openOnDistance(Double start, Double end) {
+        GWT.log("GaugeTree - openOnDistance " + start + " " + end + " " +
+                tree.getItemCount());
+
+        for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) {
+            TreeItem item = it.next();
+            /* Strange stuff is happening here:
+             * GWT Tree.treeItemIterator returns another TreeItem for each
+             * GaugeInfoItem */
+            if (item instanceof GaugeInfoItem) {
+                boolean setstate = false;
+                GaugeInfoItem gitem = (GaugeInfoItem)item;
+                if (end == null) {
+                    if (gitem.getStart() >= start) {
+                        setstate = true;
+                    }
+                }
+                else {
+                    GWT.log("GaugeTree - openOnDistance gitem " + gitem.getStart() + " " + gitem.getEnd());
+                    if ((start >= gitem.getStart() && start <= gitem.getEnd()) ||
+                            (end >= gitem.getStart() && end <= gitem.getEnd()) ||
+                            (start <= gitem.getStart() && end >= gitem.getEnd())) {
+                        setstate = true;
+                            }
+                }
+                item.setState(setstate);
+            }
+        }
+    }
+
+    public void openOnLocations(List<Double> locations) {
+        GWT.log("GaugeTree - openOnLocations " + locations + " " +
+                tree.getItemCount());
+
+        if (locations == null || locations.isEmpty()) {
+            return;
+        }
+
+        for (Iterator<TreeItem> it = tree.treeItemIterator(); it.hasNext();) {
+            TreeItem item = it.next();
+            if (item instanceof GaugeInfoItem) {
+                GaugeInfoItem gitem = (GaugeInfoItem)item;
+                boolean isset = false;
+                for (Double location: locations) {
+                    if (locations == null) {
+                        continue;
+                    }
+                    if (location >= gitem.getStart() &&
+                            location <= gitem.getEnd()) {
+                        isset = true;
+                        break;
+                            }
+                }
+                item.setState(isset);
+            }
+        }
+    }
+
+    class GaugeInfoItem extends TreeItem {
+
+        private GaugeInfo gauge;
+
+        public GaugeInfoItem(FLYS flys, GaugeInfo gauge) {
+            GaugeInfoHead gaugeinfohead = new GaugeInfoHead(flys, gauge);
+            GaugeInfoPanel gaugeinfopanel = new GaugeInfoPanel(gauge);
+            setWidget(gaugeinfohead);
+            addItem(gaugeinfopanel);
+            this.gauge = gauge;
+        }
+
+        public Double getStart() {
+            return gauge.getKmStart();
+        }
+
+        public Double getEnd() {
+            return gauge.getKmEnd();
+        }
+
+        public Long getReference() {
+            return gauge.getOfficialNumber();
+        }
+    }
+
+    class GaugeInfoHead extends HLayout {
+
+        public GaugeInfoHead(FLYS flys, GaugeInfo gauge) {
+            setStyleName("gaugeinfohead");
+            setAutoHeight();
+            setAutoWidth();
+
+            NumberFormat nf = NumberFormat.getDecimalFormat();
+
+            Label label = new Label(gauge.getName(), true);
+            addMember(label);
+
+            Double start;
+            Double end;
+
+            if (!gauge.isKmUp()) {
+                start = gauge.getKmStart();
+                end   = gauge.getKmEnd();
+            }
+            else {
+                start = gauge.getKmEnd();
+                end   = gauge.getKmStart();
+            }
+
+            String kmtext = "";
+            if (start != null) {
+                kmtext += nf.format(start);
+                kmtext += " - ";
+            }
+            if (end != null) {
+                kmtext += nf.format(end);
+            }
+            if (start != null || end != null) {
+                kmtext += " km";
+            }
+
+            label = new Label(kmtext);
+
+            addMember(label);
+
+            Double station = gauge.getStation();
+            if (station != null) {
+                String stext = nf.format(station);
+                stext += " km";
+                label = new Label(stext);
+                addMember(label);
+            }
+
+            Long number = gauge.getOfficialNumber();
+            String url = number != null ?
+                MSG.gauge_url() + number :
+                MSG.gauge_url();
+            Anchor anchor = new Anchor(MSG.gauge_info_link(), url);
+            addMember(anchor);
+
+            addMember(new GaugeCurveAnchor(flys, gauge));
+        }
+    }
+
+    class GaugeCurveAnchor extends Anchor implements ClickHandler {
+
+        private FLYS flys;
+        private GaugeInfo gauge;
+
+        public GaugeCurveAnchor(FLYS flys, GaugeInfo gauge) {
+            super(MSG.gauge_curve_link());
+            this.flys = flys;
+            this.gauge = gauge;
+
+            addClickHandler(this);
+        }
+
+        public void onClick(ClickEvent ev) {
+            GWT.log("GaugeCurveAnchor - onClick " + gauge.getRiverName() +
+                    " " + gauge.getOfficialNumber());
+            flys.newGaugeDischargeCurve(gauge.getRiverName(),
+                    gauge.getOfficialNumber());
+        }
+    }
+
+    class GaugeInfoPanel extends DecoratorPanel {
+
+        public GaugeInfoPanel(GaugeInfo gauge) {
+            setStyleName("gaugeinfopanel");
+            Grid grid = new Grid(4, 2);
+
+            NumberFormat nf = NumberFormat.getDecimalFormat();
+
+            Double minw = gauge.getMinW();
+            Double maxw = gauge.getMaxW();
+            if (minw != null && maxw != null) {
+                grid.setText(0, 0, MSG.wq_value_q());
+                grid.setText(0, 1, "" + nf.format(minw) +
+                        " - " + nf.format(maxw));
+            }
+
+            Double minq = gauge.getMinQ();
+            Double maxq = gauge.getMaxQ();
+            if (minq != null && maxq != null) {
+                grid.setText(1, 0, MSG.wq_value_w());
+                grid.setText(1, 1, "" + nf.format(minq) +
+                        " - " + nf.format(maxq));
+            }
+
+            Double aeo = gauge.getAeo();
+            if (aeo != null) {
+                grid.setText(2, 0, "AEO [km²]");
+                grid.setText(2, 1, "" + nf.format(aeo));
+            }
+
+            Double datum = gauge.getDatum();
+            if (datum != null) {
+                grid.setText(3, 0, MSG.gauge_zero() + " [" +
+                        gauge.getWstUnit() + "]");
+                grid.setText(3, 1, "" + nf.format(datum));
+            }
+
+            setWidget(grid);
+        }
+    }
+
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 28 12:15:45 2012 +0200
@@ -212,7 +212,7 @@
         final SectionStackSection gaugeSection = new SectionStackSection();
         gaugeSection.setExpanded(false);
         gaugeSection.setTitle(MSG.gaugePanelTitle());
-        gaugePanel = new GaugePanel(gaugeSection) {
+        gaugePanel = new GaugePanel(flys, gaugeSection) {
             public void addMember(Canvas component) {
                 super.addMember(component);
                 gaugeSection.setExpanded(true);
@@ -745,7 +745,7 @@
         if (art instanceof WINFOArtifact) {
             String river = desc.getRiver();
             if (river != null) {
-                renderGaugeInfo(desc.getRiver());
+                renderGaugeInfo(desc.getRiver(), desc.getOldData());
             }
             else {
                 gaugePanel.hide();
@@ -925,8 +925,9 @@
     }
 
 
-    private void renderGaugeInfo(String river) {
+    private void renderGaugeInfo(String river, DataList[] data) {
         gaugePanel.setRiver(river);
+        gaugePanel.setData(data);
         gaugePanel.show();
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java	Fri Sep 28 12:15:45 2012 +0200
@@ -13,7 +13,9 @@
 import com.google.gwt.user.client.ui.Widget;
 import com.google.gwt.user.client.ui.ClickListener;
 
+import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.tile.TileLayout;
 
 import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.shared.model.DataItem;
@@ -21,6 +23,14 @@
 import de.intevation.flys.client.shared.model.StringOptionsData;
 
 
+/**
+ * Some parameters take the form of on/off options that can also be seen
+ * as a matrix.
+ *
+ * This class helps to survive the underlying objects and create a visual
+ * representation of this matrix. Later can happen in two ways to overcome
+ * shortcomings of GWT/SmartGWT combination.
+ */
 public class ParameterMatrix {
 
     public static class Column implements Serializable {
@@ -117,8 +127,55 @@
     }
 
 
-    public Widget create() {
-        Grid grid = new Grid(valueNames.size()+1, columnNames.size() + 1);
+    public Widget createTileLayout() {
+        TileLayout tileLayout = new TileLayout();
+        tileLayout.setTilesPerLine (columnNames.size() + 1);
+        tileLayout.setAutoWrapLines(false);
+        tileLayout.setTileMargin(1);
+
+        tileLayout.addTile(new Label(""));
+        for (int i = 0, n = columnNames.size(); i < n; i++) {
+            String columnName = columnNames.get(i);
+            Column col        = columns.get(columnName);
+
+            selected.put(columnName, new ArrayList<String>());
+
+            tileLayout.addTile(createLabel(MESSAGE.getString(columnName)));
+        }
+
+        int nVals = valueNames.size();
+
+        for (int j = 0; j < nVals; j++) {
+            for (int i = 0, n = columnNames.size(); i < n; i++) {
+                String valueName  = valueNames.get(j);
+                String columnName = columnNames.get(i);
+                Column col        = columns.get(columnName);
+                String value      = col.getValue(valueName);
+
+                if (i == 0) {
+                    tileLayout.addTile(createLabel(valueName));
+                }
+
+                if (value != null && value.length() > 0) {
+                    tileLayout.addTile(createCheckBox(columnName, value));
+                }
+            }
+        }
+
+        return tileLayout;
+    }
+
+
+    /**
+     * Returns a widget with matrix of checkboxes and labels.
+     * @param tileLayouted if true, use a TileLayout (for inclusion in SmartGWT
+     *                     containers, avoiding scrollbar-issues.
+     */
+    public Widget create(boolean tileLayouted) {
+        if (tileLayouted) {
+            return createTileLayout();
+        }
+        Grid grid = new Grid(valueNames.size() + 1, columnNames.size() + 1);
 
         for (int i = 0, n = columnNames.size(); i < n; i++) {
             String columnName = columnNames.get(i);
@@ -137,7 +194,7 @@
                 }
 
                 if (value != null && value.length() > 0) {
-                    grid.setWidget(j+1, i+1, createWidget(columnName, value));
+                    grid.setWidget(j+1, i+1, createCheckBox(columnName, value));
                 }
             }
         }
@@ -146,6 +203,7 @@
     }
 
 
+    /** Creates label with given text. */
     protected Label createLabel(String text) {
         Label label = new Label(text);
         label.setHeight(CELL_HEIGHT);
@@ -154,7 +212,8 @@
     }
 
 
-    protected CheckBox createWidget(final String colName, final String value) {
+    /** Create Checkbox for column/value. */
+    protected Canvas createCheckBox(final String colName, final String value) {
         CheckBox box = new CheckBox();
         box.addClickListener(new ClickListener() {
             @Override
@@ -172,7 +231,9 @@
             }
         });
 
-        return box;
+        Canvas c = new Canvas();
+        c.addChild(box);
+        return c;
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -4,6 +4,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import com.google.gwt.user.client.ui.HTML;
+
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.layout.HLayout;
@@ -68,6 +70,7 @@
     }
 
 
+    /** Canvas to show in non-edit mode. */
     @Override
     public Canvas createOld(DataList dataList) {
         HLayout layout  = new HLayout();
@@ -98,6 +101,9 @@
                 value.setHeight(20);
 
                 cols.addMember(value);
+                HTML hr = new HTML("<hr>");
+                hr.setHeight("3px");
+                cols.addMember(hr);
             }
 
             row.addMember(parameter);
@@ -114,6 +120,8 @@
         return layout;
     }
 
+
+    /** Create the main canvas in the "editing" mode. */
     @Override
     public Canvas create(DataList dataList) {
         VLayout v = new VLayout();
@@ -130,13 +138,21 @@
             }
         }
 
-        v.addMember(matrix.create());
+        // If too many items are shown, show it in the helper Panel.
+        // TODO its not about the datalist, but about the "rows" in the data.
+        if (dataList.getAll().size() > 5) {
+            v.addMember(matrix.create(false));
+        }
+        else {
+            helperContainer.addMember(matrix.create(true));
+        }
         v.addMember(getNextButton());
 
         return v;
     }
 
 
+    /** Reaturns a label with description of first Data. */
     protected Canvas createTitle(DataList dataList) {
         Data data = dataList.get(0);
         Label label = new Label(data.getDescription());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,61 +1,53 @@
 package de.intevation.flys.client.client.ui.chart;
 
-import java.util.List;
-
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
 import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONBoolean;
 import com.google.gwt.json.client.JSONNumber;
 import com.google.gwt.json.client.JSONParser;
 import com.google.gwt.json.client.JSONString;
-import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.ListGridFieldType;
 import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.grid.CellEditValueFormatter;
+import com.smartgwt.client.widgets.grid.CellEditValueParser;
+import com.smartgwt.client.widgets.grid.CellFormatter;
 import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridField;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
 import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
 import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.types.ListGridFieldType;
-import com.smartgwt.client.widgets.grid.CellFormatter;
-import com.google.gwt.i18n.client.NumberFormat;
-
-import com.smartgwt.client.widgets.grid.CellEditValueParser;
-import com.smartgwt.client.widgets.grid.CellEditValueFormatter;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-
-import com.smartgwt.client.types.Alignment;
-
-import de.intevation.flys.client.shared.model.Artifact;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.client.event.RedrawRequestEvent;
+import de.intevation.flys.client.client.event.RedrawRequestHandler;
+import de.intevation.flys.client.client.services.FeedServiceAsync;
+import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
+import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.CollectionItem;
-
-import de.intevation.flys.client.client.services.LoadArtifactService;
-import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
-import de.intevation.flys.client.client.services.FeedService;
-import de.intevation.flys.client.client.services.FeedServiceAsync;
-
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DefaultArtifact;
 import de.intevation.flys.client.shared.model.DefaultData;
-import de.intevation.flys.client.shared.model.Recommendation;
-import de.intevation.flys.client.shared.model.Settings;
 import de.intevation.flys.client.shared.model.Property;
 import de.intevation.flys.client.shared.model.PropertyGroup;
+import de.intevation.flys.client.shared.model.Recommendation;
+import de.intevation.flys.client.shared.model.Settings;
 import de.intevation.flys.client.shared.model.StringProperty;
 
-import de.intevation.flys.client.client.event.RedrawRequestHandler;
-import de.intevation.flys.client.client.event.RedrawRequestEvent;
+import java.util.List;
 
 
 /**
@@ -80,6 +72,8 @@
     /** The listGrid showing point entries. */
     protected ListGrid listGrid;
 
+    protected ListGridFieldType fieldTypeX = ListGridFieldType.FLOAT;
+
     /** Service handle to clone and add artifacts to collection. */
     LoadArtifactServiceAsync loadArtifactService = GWT.create(
             de.intevation.flys.client.client.services.LoadArtifactService.class);
@@ -120,7 +114,7 @@
 
         for (int i = 0; i < size; i++) {
             CollectionItem item = collection.getItem(i);
-            String dataValue = (String) item.getData().get(pointDataItemName);
+            String dataValue = item.getData().get(pointDataItemName);
             if (dataValue != null) {
                 // Found it.
                 uuid = item.identifier();
@@ -178,52 +172,6 @@
         listGrid.setCanEdit(true);
         listGrid.setShowHeaderContextMenu(false);
 
-        CellFormatter doubleFormat = new CellFormatter() {
-            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
-                if(value != null) {
-                    NumberFormat nf = NumberFormat.getDecimalFormat();
-                    try {
-                        double d = Double.valueOf(value.toString()).doubleValue();
-                        return nf.format(d);
-                    } catch (Exception e) {
-                        return value.toString();
-                    }
-                } else {
-                   return null;
-                }
-            }};
-
-        CellEditValueParser cevp = new CellEditValueParser() {
-            public Object parse(Object value, ListGridRecord record, int rowNum, int colNum) {
-                if (value == null)
-                    return null;
-                try {
-                    NumberFormat nf = NumberFormat.getDecimalFormat();
-                    double d = nf.parse(value.toString());
-                    return (new Double(d)).toString();
-                }
-                catch(NumberFormatException nfe) {
-                    return value;
-                }
-            }
-        };
-
-        CellEditValueFormatter cevf = new CellEditValueFormatter() {
-            public Object format(Object value, ListGridRecord record, int rowNum, int colNum) {
-                if (value == null) {
-                    return "";
-                }
-                NumberFormat nf = NumberFormat.getDecimalFormat();
-                try {
-                    double d = Double.valueOf(value.toString()).doubleValue();
-                    return nf.format(d);
-                }
-                catch(NumberFormatException nfe) {
-                    return value;
-                }
-            }
-        };
-
         // Use X and Y as default fallback.
         String xAxis = "X";
         String yAxis = "Y";
@@ -234,6 +182,7 @@
         if(axes != null) {
             for (Property p: axes) {
                 PropertyGroup pg = (PropertyGroup)p;
+                GWT.log(pg.toString());
                 StringProperty id =
                     (StringProperty)pg.getPropertyByName("id");
                 if(id.getValue().equals("X")) {
@@ -248,18 +197,29 @@
                 }
             }
         }
+
+        CellFormatter format = createCellFormatter();
+        CellEditValueParser cevp = createCellEditValueParser();
+        CellEditValueFormatter cevf = createCellEditValueFormatter();
+
         ListGridField xField =
-            new ListGridField(PointRecord.ATTRIBUTE_X, xAxis);
-        xField.setType(ListGridFieldType.FLOAT);
-        xField.setCellFormatter(doubleFormat);
-        xField.setEditValueParser(cevp);
-        xField.setEditValueFormatter(cevf);
-
+                new ListGridField(PointRecord.ATTRIBUTE_X, xAxis);
+        if(xAxis.equalsIgnoreCase("date") || xAxis.equalsIgnoreCase("Datum")) {
+            // FIXME: This is a hack for the special axis with Date type
+            xField.setType(ListGridFieldType.DATE);
+            this.fieldTypeX = ListGridFieldType.DATE;
+        }
+        else {
+            xField.setType(ListGridFieldType.FLOAT);
+            xField.setCellFormatter(format);
+            xField.setEditValueParser(cevp);
+            xField.setEditValueFormatter(cevf);
+        }
 
         ListGridField yField =
             new ListGridField(PointRecord.ATTRIBUTE_Y, yAxis);
         yField.setType(ListGridFieldType.FLOAT);
-        yField.setCellFormatter(doubleFormat);
+        yField.setCellFormatter(format);
         yField.setEditValueParser(cevp);
         yField.setEditValueFormatter(cevf);
 
@@ -334,6 +294,61 @@
     }
 
 
+    protected CellFormatter createCellFormatter() {
+        return new CellFormatter() {
+            public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
+                if(value != null) {
+                    NumberFormat nf = NumberFormat.getDecimalFormat();
+                    try {
+                        double d = Double.valueOf(value.toString()).doubleValue();
+                        return nf.format(d);
+                    } catch (Exception e) {
+                        return value.toString();
+                    }
+                } else {
+                   return null;
+                }
+            }};
+    }
+
+
+    protected CellEditValueParser createCellEditValueParser() {
+        return new CellEditValueParser() {
+            public Object parse(Object value, ListGridRecord record, int rowNum, int colNum) {
+                if (value == null)
+                    return null;
+                try {
+                    NumberFormat nf = NumberFormat.getDecimalFormat();
+                    double d = nf.parse(value.toString());
+                    return (new Double(d)).toString();
+                }
+                catch(NumberFormatException nfe) {
+                    return value;
+                }
+            }
+        };
+    }
+
+
+    protected CellEditValueFormatter createCellEditValueFormatter() {
+        return new CellEditValueFormatter() {
+            public Object format(Object value, ListGridRecord record, int rowNum, int colNum) {
+                if (value == null) {
+                    return "";
+                }
+                NumberFormat nf = NumberFormat.getDecimalFormat();
+                try {
+                    double d = Double.valueOf(value.toString()).doubleValue();
+                    return nf.format(d);
+                }
+                catch(NumberFormatException nfe) {
+                    return value;
+                }
+            }
+        };
+    }
+
+
     /** Create JSON representation of the points present in the list grid. */
     protected JSONArray jsonArrayFromListGrid() {
         JSONArray list = new JSONArray();
@@ -365,8 +380,13 @@
                     nameString = xString + "/" + yString;
                 }
 
-                data.set(0, new JSONNumber(record.
-                    getAttributeAsDouble(PointRecord.ATTRIBUTE_X)));
+                if(fieldTypeX.equals(ListGridFieldType.DATE)) {
+                    data.set(0, new JSONString(record.getAttribute(PointRecord.ATTRIBUTE_X)));
+                }
+                else {
+                    data.set(0, new JSONNumber(record.
+                            getAttributeAsDouble(PointRecord.ATTRIBUTE_X)));
+                }
                 data.set(1, new JSONNumber(record.
                     getAttributeAsDouble(PointRecord.ATTRIBUTE_Y)));
                 data.set(2, new JSONString(nameString));
@@ -479,8 +499,6 @@
         protected static final String ATTRIBUTE_NAME = "name";
         protected static final String ATTRIBUTE_ACTIVE = "active";
 
-        private PointRecord() {;}
-
         public PointRecord(boolean b, double x, double y, String name) {
             setActive(b);
             setName(name);
@@ -526,9 +544,14 @@
     protected boolean isDialogValid() {
         boolean valid = true;
         for (ListGridRecord record : listGrid.getRecords()) {
-            if (record.getAttributeAsDouble(PointRecord.ATTRIBUTE_X) == null
-                || record.getAttributeAsDouble(PointRecord.ATTRIBUTE_Y) == null) {
-                return false;
+            try {
+                if (record.getAttribute(PointRecord.ATTRIBUTE_X) == null
+                    || record.getAttribute(PointRecord.ATTRIBUTE_Y) == null) {
+                    return false;
+                }
+            }
+            catch(IllegalArgumentException ex) {
+
             }
         }
         if (listGrid.hasErrors()) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,9 +1,5 @@
 package de.intevation.flys.client.client.ui.fixation;
 
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
@@ -18,7 +14,24 @@
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 public class FixFunctionSelect extends FixationPanel {
+    private static final Map<String, String> funcDesc = new HashMap<String, String>();
+
+    static {
+        funcDesc.put("log", "W(Q) = m*ln(Q + b)");
+        funcDesc.put("linear", "W(Q) = m * Q + b");
+        funcDesc.put("log-linear", "W(Q) = a*ln(m*Q+b)");
+        funcDesc.put("exp", "W(Q) = m * a^Q + b");
+        funcDesc.put("quad", "W(Q) = n*Q^2+m*Q+b");
+        funcDesc.put("pow", "W(Q) = a * Q^c + d");
+        funcDesc.put("sq-pow", "S(Q) = a * Q^b");
+    }
+
     /** The combobox.*/
     protected DynamicForm form;
 
@@ -45,7 +58,7 @@
             SelectItem combobox = new SelectItem(d.getLabel());
             combobox.setWidth(250);
 
-            LinkedHashMap<String, String> it = new LinkedHashMap<String, String>();
+            LinkedHashMap<String, String> funcTypes = new LinkedHashMap<String, String>();
 
             boolean  defaultSet = false;
             boolean  first      = true;
@@ -65,11 +78,11 @@
                     first = false;
                 }
 
-                it.put(item.getStringValue(), item.getLabel());
+                funcTypes.put(item.getStringValue(), item.getLabel());
             }
 
             label.setWidth(50);
-            combobox.setValueMap(it);
+            combobox.setValueMap(funcTypes);
             combobox.setShowTitle(false);
             form.setItems(combobox);
 
@@ -85,6 +98,7 @@
     }
 
 
+    @Override
     public Canvas createOld(DataList dataList) {
         HLayout layout  = new HLayout();
         VLayout vLayout = new VLayout();
@@ -101,8 +115,10 @@
             for (DataItem item: items) {
                 HLayout hLayout = new HLayout();
 
+                String desc = funcDesc.containsKey(item.getLabel()) ?
+                        funcDesc.get(item.getLabel()) : item.getLabel();
                 hLayout.addMember(label);
-                hLayout.addMember(new Label(item.getLabel()));
+                hLayout.addMember(new Label(desc));
 
                 vLayout.addMember(hLayout);
                 vLayout.setWidth("130px");
@@ -119,6 +135,7 @@
     }
 
 
+    @Override
     public Data[] getData() {
         Map values    = form.getValues();
         Iterator keys = values.keySet().iterator();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,29 +1,26 @@
 package de.intevation.flys.client.client.ui.fixation;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-
 import com.google.gwt.core.client.GWT;
 
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
-
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.SelectItem;
-import com.smartgwt.client.widgets.form.fields.StaticTextItem;
-
 import de.intevation.flys.client.client.FLYSConstants;
-
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
 
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
 /**
  * This UIProvider creates a panel for location or distance input.
  *
@@ -41,18 +38,19 @@
     protected SelectItem from;
     protected SelectItem to;
 
-    protected LinkedHashMap mapValues;
+    protected LinkedHashMap<String, String> mapValues;
 
     public FixGaugeSelectPanel() {
         htmlOverview = "";
-        // TODO: i18n
-        mapValues = new LinkedHashMap();
-        mapValues.put("0", "um MNQ");
-        mapValues.put("1", "um MQ");
-        mapValues.put("2", "um MHQ");
-        mapValues.put("3", "\u00fcber HQ5");
+
+        mapValues = new LinkedHashMap<String, String>();
+        mapValues.put("0", MESSAGES.gauge_mnq());
+        mapValues.put("1", MESSAGES.gauge_mq());
+        mapValues.put("2", MESSAGES.gauge_mhq());
+        mapValues.put("3", MESSAGES.gauge_hq5());
     }
 
+    @Override
     public Canvas createWidget(DataList data) {
         instances.put(this.artifact.getUuid(), this);
 
@@ -122,6 +120,7 @@
      *
      * @return the selected/inserted data.
      */
+    @Override
     public Data[] getData() {
         List<Data> data = new ArrayList<Data>();
 
@@ -157,6 +156,7 @@
     }
 
 
+    @Override
     public void success() {}
 
     protected boolean saveClassValues() {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixMultiPeriodPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixMultiPeriodPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,38 +1,33 @@
 package de.intevation.flys.client.client.ui.fixation;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Date;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.DateTimeFormat;
 
-import com.smartgwt.client.data.Record;
-
+import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.events.ClickEvent;
 import com.smartgwt.client.widgets.events.ClickHandler;
-
 import com.smartgwt.client.widgets.grid.ListGrid;
 import com.smartgwt.client.widgets.grid.ListGridField;
 import com.smartgwt.client.widgets.grid.ListGridRecord;
-
+import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
-import com.smartgwt.client.types.ListGridFieldType;
-
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-
+import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DataList;
 import de.intevation.flys.client.shared.model.DefaultData;
 import de.intevation.flys.client.shared.model.DefaultDataItem;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * This UIProvider creates a panel for location or distance input.
  *
@@ -41,6 +36,8 @@
 public class FixMultiPeriodPanel
 extends      FixPeriodPanel
 {
+    /** The message class that provides i18n strings. */
+    protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
 
     protected ListGrid elements;
 
@@ -54,12 +51,13 @@
         super(startName, endName);
     }
 
+    @Override
     public Canvas createWidget(DataList data) {
         HLayout input = new HLayout();
         VLayout root = new VLayout();
         VLayout grid = new VLayout();
         VLayout layout = (VLayout) super.createWidget(data);
-        Button add = new Button("Add");
+        Button add = new Button(MESSAGES.add());
         elements = new ListGrid();
 
         add.addClickHandler(new ClickHandler() {
@@ -169,6 +167,7 @@
      *
      * @return the selected/inserted data.
      */
+    @Override
     public Data[] getData() {
         List<Data> data = new ArrayList<Data>();
 
@@ -185,6 +184,7 @@
     }
 
 
+    @Override
     protected boolean saveDateValues() {
         ListGridRecord[] lgr = elements.getRecords();
         if (lgr.length == 0) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,26 +1,18 @@
 package de.intevation.flys.client.client.ui.fixation;
 
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Date;
-
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
 
 import com.smartgwt.client.util.SC;
-
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
-
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.DateRangeItem;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.DateRangeItem;
-
+import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYSConstants;
-
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataItem;
 import de.intevation.flys.client.shared.model.DataList;
@@ -28,6 +20,10 @@
 import de.intevation.flys.client.shared.model.DefaultDataItem;
 import de.intevation.flys.client.shared.model.FixingsOverviewInfo.FixEvent;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * This UIProvider creates a panel for location or distance input.
  *
@@ -57,6 +53,7 @@
         htmlOverview = "";
     }
 
+    @Override
     public Canvas createWidget(DataList data) {
         instances.put(this.artifact.getUuid(), this);
 
@@ -133,6 +130,7 @@
      *
      * @return the selected/inserted data.
      */
+    @Override
     public Data[] getData() {
         List<Data> data = new ArrayList<Data>();
 
@@ -170,23 +168,59 @@
         return false;
     }
 
+    protected String getLocaleDateFormat() {
+        String loc = Config.getInstance().getLocale();
+        if ("de".equals(loc)) {
+            return "yy.MM.yyyy";
+        }
+        else {
+            return "MM/dd/yyyy";
+        }
+    }
 
+    @Override
     public void success() {
         List<FixEvent> list = fixInfo.getEvents();
-        DateTimeFormat df = DateTimeFormat.getFormat(
-                DateTimeFormat.PredefinedFormat.DATE_MEDIUM);
 
+        // The date in FixEvent is always "de" locale, so it seems...
+        DateTimeFormat df = DateTimeFormat.getFormat("yy.MM.yyyy");
+
+        if (!setFromAndToDate(list, df)) {
+            // or perhaps "en"?
+            df = DateTimeFormat.getFormat("MM/dd/yyyy");
+
+            if (!setFromAndToDate(list, df)) {
+                GWT.log("FixPeriodPanel::success(): could not set from and to dates!");
+            }
+        }
+    }
+
+    protected boolean setFromAndToDate(List<FixEvent> list, DateTimeFormat df) {
         try {
-            Date f = df.parse(list.get(0).getDate());
-            Date t = df.parse(list.get(list.size() - 1).getDate());
-            this.inputPanel.setFromDate(f);
-            this.inputPanel.setToDate(t);
+            setFromDate(list.get(0).getDate(), df);
+            setToDate(list.get(list.size() - 1).getDate(), df);
+            return true;
         }
-        catch(IllegalArgumentException pe) {
-            GWT.log(pe.toString());
+        catch(IllegalArgumentException ex) {
+            GWT.log("FixPeriodPanel::setFromAndToDate(): " + ex.toString());
+            return false;
         }
     }
 
+    protected void setFromDate(String date, DateTimeFormat df)
+        throws IllegalArgumentException
+    {
+        Date from = df.parse(date);
+        this.inputPanel.setFromDate(from);
+    }
+
+    protected void setToDate(String date, DateTimeFormat df)
+        throws IllegalArgumentException
+    {
+        Date to = df.parse(date);
+        this.inputPanel.setToDate(to);
+    }
+
     protected boolean saveDateValues() {
         Date st = inputPanel.getFromDate();
         Date en = inputPanel.getToDate();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Fri Sep 28 12:15:45 2012 +0200
@@ -74,7 +74,7 @@
     protected FixingsOverviewServiceAsync overviewService =
         GWT.create(FixingsOverviewService.class);
 
-    protected String   htmlOverview;
+    protected String htmlOverview;
     protected FixingsOverviewInfo fixInfo;
     protected TabSet tabs;
     protected Tab events;
@@ -91,6 +91,8 @@
         htmlOverview = "";
     }
 
+    
+    /** Get the (master) artifact UUID. */
     protected String getArtifactUuid() {
         return this.artifact.getUuid();
     }
@@ -477,3 +479,4 @@
         return root;
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/widgets/KMSpinner.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/widgets/KMSpinner.java	Fri Sep 28 12:15:45 2012 +0200
@@ -2,6 +2,7 @@
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.i18n.client.NumberFormat;
+
 import com.smartgwt.client.data.Record;
 import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Label;
@@ -38,6 +39,7 @@
         this.value = initialValue;
 
         setWidth("99%");
+        setHeight(18);
 
         // minusButton shall ask service for previous available cs.
         Button minusButton = new Button("-");
@@ -65,7 +67,10 @@
                         return nf.format(d);
                     }
                     catch (Exception e) {
-                        return value.toString();
+                        GWT.log("EditorValueFormatter exception: " + e.toString());
+
+                        // Remove junk chars from input string
+                        return doublefyString(value.toString());
                     }
                 }
                 else {
@@ -147,5 +152,25 @@
             listener.spinnerValueEntered(this, val, facetRecord, up);
         }
     }
+
+    /**
+     * Remove junk chars from double string.
+     * This method should work for most locales, but not for
+     * exotic ones that do not use "." or "," as decimal
+     * separator.
+     * @return
+     */
+    protected String doublefyString(String str) {
+        StringBuilder buf = new StringBuilder(str.length());
+
+        for (int n = 0; n < str.length(); n++) {
+            char c = str.charAt(n);
+            if ((c >= '0' && c <= '9') || c == '.' || c == ',') {
+                buf.append(c);
+            }
+        }
+
+        return buf.toString();
+    }
 }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,6 +1,7 @@
 package de.intevation.flys.client.server;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import org.apache.log4j.Logger;
 
@@ -14,13 +15,14 @@
 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
+import de.intevation.artifacts.httpclient.utils.ArtifactNamespaceContext;
+import de.intevation.artifacts.httpclient.utils.XMLUtils;
 
 import de.intevation.flys.client.shared.exceptions.ServerException;
 import de.intevation.flys.client.shared.model.Artifact;
 
 import de.intevation.flys.client.shared.model.Recommendation;
 
-
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
@@ -33,6 +35,11 @@
      * creation.*/
     public static final String ERROR_CREATE_ARTIFACT = "error_create_artifact";
 
+    /**
+     * Name of the factory to generate a GaugeDischargeCurveArtifact
+     */
+    private static final String GAUGE_DISCHARGE_CURVE_ARTIFACT = "gaugedischargecurve";
+
 
     private ArtifactHelper() {
     }
@@ -68,10 +75,58 @@
         Document create = ClientProtocolUtils.newCreateDocument(
             factory, uuid, ids, filter);
 
+        return sendCreate(serverUrl, locale, create);
+
+    }
+
+    /**
+     * Creates a new GaugeDischargeCurverArtifact
+     *
+     * @param river the name of the river
+     * @param reference the reference id of the gauge (official number)
+     */
+    public static Artifact createGaugeDischargeCurveArtifact(
+            String serverUrl,
+            String locale,
+            String river,
+            Long   reference)
+    throws ServerException
+    {
+        Document create = ClientProtocolUtils.newCreateDocument(
+                GAUGE_DISCHARGE_CURVE_ARTIFACT);
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            create,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element root = create.getDocumentElement();
+
+        Element eriver = ec.create("river");
+        ec.addAttr(eriver, "name", river);
+
+        Element egauge = ec.create("gauge");
+        ec.addAttr(egauge, "reference", reference.toString());
+
+        root.appendChild(eriver);
+        root.appendChild(egauge);
+
+        return sendCreate(serverUrl, locale, create);
+    }
+
+    /**
+     * Sends a create document to the artifact server
+     */
+    private static Artifact sendCreate(
+            String   serverUrl,
+            String   locale,
+            Document doc)
+    throws ServerException
+    {
         HttpClient client = new HttpClientImpl(serverUrl, locale);
 
         try {
-            return (Artifact) client.create(create, new FLYSArtifactCreator());
+            return (Artifact) client.create(doc, new FLYSArtifactCreator());
         }
         catch (ConnectionException ce) {
             logger.error(ce, ce);
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java	Fri Sep 28 12:15:45 2012 +0200
@@ -8,6 +8,7 @@
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.client.services.ArtifactService;
 
+import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.Recommendation;
 
 /**
@@ -48,5 +49,34 @@
 
         return ArtifactHelper.createArtifact(url, locale, factory, recom);
     }
+
+    /**
+     * Create a new GaugeDischageCurveArtifact
+     *
+     * @param river    the river
+     * @param gaugeref reference id of the gauge
+     */
+    public Artifact createGaugeDischargeCurveArtifact(
+            Collection collection,
+            String locale,
+            String river,
+            Long   gaugeref)
+    throws ServerException
+    {
+        logger.info("ArtifactServiceImpl.createGaugeDischargeCurverArtifact");
+        String url  = getServletContext().getInitParameter("server-url");
+
+        Artifact artifact = ArtifactHelper.createGaugeDischargeCurveArtifact(url,
+                locale, river, gaugeref);
+        if (artifact == null) {
+            return null;
+        }
+        logger.info("GaugeDischargeCurveArtifact created successfully");
+
+        CollectionHelper.addArtifact(collection, artifact, url, locale);
+
+        return artifact;
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java	Fri Sep 28 12:15:45 2012 +0200
@@ -18,12 +18,13 @@
 
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.CalculationMessage;
+import de.intevation.flys.client.shared.model.ChartArtifact;
 import de.intevation.flys.client.shared.model.DefaultArtifact;
+import de.intevation.flys.client.shared.model.FixAnalysisArtifact;
+import de.intevation.flys.client.shared.model.GaugeDischargeCurveArtifact;
+import de.intevation.flys.client.shared.model.MapArtifact;
 import de.intevation.flys.client.shared.model.MINFOArtifact;
 import de.intevation.flys.client.shared.model.WINFOArtifact;
-import de.intevation.flys.client.shared.model.MapArtifact;
-import de.intevation.flys.client.shared.model.ChartArtifact;
-import de.intevation.flys.client.shared.model.FixAnalysisArtifact;
 
 
 /**
@@ -144,6 +145,10 @@
             logger.debug("+++++ NEW FIXANALYSIS ARTIFACT.");
             return new FixAnalysisArtifact(uuid, hash, background, msg);
         }
+        else if (name.length() > 0 && name.equals("gaugedischargecurve")) {
+            logger.debug("+++++ NEW WINFO ARTIFACT.");
+            return new GaugeDischargeCurveArtifact(uuid, hash, background, msg);
+        }
 
         return new DefaultArtifact(uuid, hash, background, msg);
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java	Fri Sep 28 12:15:45 2012 +0200
@@ -34,6 +34,10 @@
     private String authmethod;
     private ServletContext sc;
 
+    public static final String LOGIN_JSP     = "/login.jsp";
+    public static final String LOGIN_SERVLET = "/flys/login";
+    public static final String FLYS_CSS      = "/FLYS.css";
+
 
     /**
      * Initialize.
@@ -46,6 +50,7 @@
     {
         String deactivate = config.getInitParameter("deactivate");
         this.sc = config.getServletContext();
+        logger.debug("GGInAFilter context " + this.sc.getContextPath());
         this.authmethod = sc.getInitParameter("authentication");
         if (deactivate != null && deactivate.equalsIgnoreCase("true")) {
             this.deactivate = true;
@@ -81,8 +86,10 @@
 
         // Allow access to login pages
         // TODO Maybe replace with Filter <url-pattern>
-        if (requesturi.equals("/login.jsp") || requesturi.equals("/flys/login")
-                || requesturi.equals("/FLYS.css")) {
+        String path = this.sc.getContextPath();
+        if (requesturi.equals(path + "/login.jsp") ||
+                requesturi.equals(path + "/flys/login")
+                || requesturi.equals(path + "/FLYS.css")) {
             logger.debug("Request for login " + requesturi);
             chain.doFilter(req, resp);
             return;
@@ -127,7 +134,8 @@
 
     private void redirect(ServletResponse resp) throws IOException {
         logger.debug("Redirect to login");
-        ((HttpServletResponse) resp).sendRedirect("/login.jsp");
+        ((HttpServletResponse) resp).sendRedirect(this.sc.getContextPath() +
+            "/login.jsp");
     }
 
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java	Fri Sep 28 12:15:45 2012 +0200
@@ -81,6 +81,8 @@
                     ArtifactNamespaceContext.NAMESPACE_URI, "minq");
             String rmaxq = riverresp.getAttributeNS(
                     ArtifactNamespaceContext.NAMESPACE_URI, "maxq");
+            String rofficial = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "official");
 
             logger.debug("River is " + rname);
 
@@ -125,10 +127,13 @@
                             ArtifactNamespaceContext.NAMESPACE_URI, "maxw");
                     String gstation = gaugeele.getAttributeNS(
                             ArtifactNamespaceContext.NAMESPACE_URI, "station");
+                    String gofficial = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "official");
 
                     logger.debug("Found gauge with name " + gname);
 
                     GaugeInfo gaugeinfo = new DefaultGaugeInfo(
+                            rname,
                             gname,
                             kmup,
                             parseDouble(gstation),
@@ -140,7 +145,8 @@
                             parseDouble(gmaxq),
                             parseDouble(gminw),
                             parseDouble(gmaxw),
-                            rwstunit
+                            rwstunit,
+                            parseLong(gofficial)
                             );
 
                     gauges.add(gaugeinfo);
@@ -155,6 +161,7 @@
                     rwstunit,
                     parseDouble(rminq),
                     parseDouble(rmaxq),
+                    parseLong(rofficial),
                     gauges);
 
             logger.debug("Finished RiverInfoService.");
@@ -184,4 +191,17 @@
             return null;
         }
     }
+
+    private Long parseLong(String value) {
+        if (value == null || value.isEmpty()) {
+            return null;
+        }
+        try {
+            return Long.valueOf(value);
+        }
+        catch(NumberFormatException e) {
+            logger.error(e, e);
+            return null;
+        }
+    }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -22,20 +22,25 @@
 
     private static Logger logger = Logger.getLogger(LoginServlet.class);
 
-    private void redirectFailure(HttpServletResponse resp) throws IOException {
-        resp.sendRedirect("/login.jsp");
+    private void redirectFailure(HttpServletResponse resp, String path)
+        throws IOException {
+        resp.sendRedirect(path + "/login.jsp");
     }
 
-    private void redirectFailure(HttpServletResponse resp, Exception e) throws IOException {
-        this.redirectFailure(resp, e.getMessage());
+    private void redirectFailure(HttpServletResponse resp, String path,
+            Exception e) throws IOException {
+        this.redirectFailure(resp, path, e.getMessage());
     }
 
-    private void redirectFailure(HttpServletResponse resp, String message) throws IOException {
-        resp.sendRedirect("/login.jsp?error=" + message);
+    private void redirectFailure(HttpServletResponse resp, String path,
+            String message) throws IOException {
+        resp.sendRedirect(path + "/login.jsp?error=" + message);
     }
-    private void redirectSuccess(HttpServletResponse resp, String uri) throws IOException {
+
+    private void redirectSuccess(HttpServletResponse resp, String path,
+            String uri) throws IOException {
         if (uri == null) {
-            uri = "/FLYS.html";
+            uri = path + "/FLYS.html";
         }
         resp.sendRedirect(uri);
     }
@@ -44,7 +49,7 @@
     protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
         logger.debug("Processing get request");
-        this.redirectFailure(resp);
+        this.redirectFailure(resp, req.getContextPath());
     }
 
     @Override
@@ -59,7 +64,7 @@
 
         if (username == null || password == null) {
             logger.debug("No username or password provided");
-            this.redirectFailure(resp);
+            this.redirectFailure(resp, req.getContextPath());
             return;
         }
 
@@ -67,7 +72,7 @@
             Authentication aresp = this.auth(username, password, encoding);
             if (aresp == null || !aresp.isSuccess()) {
                 logger.debug("Authentication not successful");
-                this.redirectFailure(resp);
+                this.redirectFailure(resp, req.getContextPath());
             }
             User user = aresp.getUser();
 
@@ -76,7 +81,8 @@
             if (!client.userExists(user)) {
                 logger.debug("Creating db user");
                 if (!client.createUser(user)) {
-                    this.redirectFailure(resp, "Could not create new user");
+                    this.redirectFailure(resp, req.getContextPath(),
+                            "Could not create new user");
                 }
             }
 
@@ -85,11 +91,11 @@
 
             String uri = (String)session.getAttribute("requesturi");
 
-            this.redirectSuccess(resp, uri);
+            this.redirectSuccess(resp, req.getContextPath(), uri);
         }
         catch(AuthenticationException e) {
             logger.error(e);
-            this.redirectFailure(resp, e);
+            this.redirectFailure(resp, req.getContextPath(), e);
         }
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java	Fri Sep 28 12:15:45 2012 +0200
@@ -15,3 +15,4 @@
         return (User)session.getAttribute("user");
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java	Fri Sep 28 12:15:45 2012 +0200
@@ -21,10 +21,13 @@
 extends      RemoteServiceServlet
 implements   UserService
 {
+    /** Private logger. */
     private static final Logger logger = Logger.getLogger(UserServiceImpl.class);
 
     public static final String ERROR_NO_SUCH_USER = "error_no_such_user";
 
+    public static final String ERROR_NO_USERS = "error_no_users";
+
     public User getCurrentUser(String locale)
     throws AuthenticationException
     {
@@ -55,7 +58,7 @@
         }
 
         logger.error("No users existing in the server.");
-        throw new AuthenticationException(ERROR_NO_SUCH_USER);
+        throw new AuthenticationException(ERROR_NO_USERS);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java	Fri Sep 28 12:15:45 2012 +0200
@@ -17,11 +17,14 @@
     private boolean kmup;
     private Double station;
     private String wstunit;
+    private Long officialnumber;
+    private String rivername;
 
     public DefaultGaugeInfo() {
     }
 
     public DefaultGaugeInfo(
+            String rivername,
             String name,
             boolean kmup,
             Double station,
@@ -33,19 +36,23 @@
             Double maxq,
             Double minw,
             Double maxw,
-            String wstunit)
+            String wstunit,
+            Long official)
     {
-        this.name    = name;
-        this.station = station;
-        this.start   = start;
-        this.end     = end;
-        this.datum   = datum;
-        this.aeo     = aeo;
-        this.minq    = minq;
-        this.maxq    = maxq;
-        this.minw    = minw;
-        this.maxw    = maxw;
-        this.wstunit = wstunit;
+        this.rivername      = rivername;
+        this.name           = name;
+        this.kmup           = kmup;
+        this.station        = station;
+        this.start          = start;
+        this.end            = end;
+        this.datum          = datum;
+        this.aeo            = aeo;
+        this.minq           = minq;
+        this.maxq           = maxq;
+        this.minw           = minw;
+        this.maxw           = maxw;
+        this.wstunit        = wstunit;
+        this.officialnumber = official;
     }
     /**
      * Returns the name of the gauge
@@ -127,4 +134,18 @@
     public String getWstUnit() {
         return this.wstunit;
     }
+
+    /**
+     * Returns the official number of this gauge
+     */
+    public Long getOfficialNumber() {
+        return this.officialnumber;
+    }
+
+    /**
+     * Returns the river to which this gauge belongs
+     */
+    public String getRiverName() {
+        return this.rivername;
+    }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java	Fri Sep 28 12:15:45 2012 +0200
@@ -15,6 +15,7 @@
     private String wstunit;
     private Double minq;
     private Double maxq;
+    private Long officialnumber;
 
     private List<GaugeInfo> gaugeinfo;
 
@@ -29,16 +30,18 @@
             String wstunit,
             Double minq,
             Double maxq,
+            Long official,
             List<GaugeInfo> gaugeinfo)
     {
-        this.name = name;
-        this.kmup = kmup;
-        this.start = start;
-        this.end = end;
-        this.wstunit = wstunit;
-        this.minq = minq;
-        this.maxq = maxq;
-        this.gaugeinfo = gaugeinfo;
+        this.name           = name;
+        this.kmup           = kmup;
+        this.start          = start;
+        this.end            = end;
+        this.wstunit        = wstunit;
+        this.minq           = minq;
+        this.maxq           = maxq;
+        this.officialnumber = official;
+        this.gaugeinfo      = gaugeinfo;
     }
 
 
@@ -94,4 +97,11 @@
     public Double getMaxQ() {
         return maxq;
     }
+
+    /**
+     * Returns the official number of the river
+     */
+    public Long getOfficialNumber() {
+        return this.officialnumber;
+    }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DoubleProperty.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DoubleProperty.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,10 +1,10 @@
 package de.intevation.flys.client.shared.model;
 
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.i18n.client.NumberFormat;
+
 import java.util.HashMap;
 
-import com.google.gwt.i18n.client.NumberFormat;
-import com.google.gwt.core.client.GWT;
-
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
@@ -74,6 +74,7 @@
         return nf.format(dv);
     }
 
+    @Override
     public Object clone() {
         DoubleProperty clone = new DoubleProperty(this.getName(),
                                                   this.getValue());
@@ -82,5 +83,4 @@
         }
         return clone;
     }
-
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeDischargeCurveArtifact.java	Fri Sep 28 12:15:45 2012 +0200
@@ -0,0 +1,39 @@
+package de.intevation.flys.client.shared.model;
+
+import java.util.List;
+
+/**
+ * The GaugeDischargeCurveArtifact implementation of an Artifact.
+ *
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class GaugeDischargeCurveArtifact extends DefaultArtifact {
+
+    /** The name of this artifact */
+    public static final String NAME = "gauge_discharge_curve";
+
+
+    public GaugeDischargeCurveArtifact() {
+    }
+
+
+    public GaugeDischargeCurveArtifact(String uuid, String hash) {
+        super(uuid, hash);
+    }
+
+
+    public GaugeDischargeCurveArtifact(
+        String                   uuid,
+        String                   hash,
+        boolean                  inBackground,
+        List<CalculationMessage> messages
+    ) {
+        super(uuid, hash, inBackground, messages);
+    }
+
+
+    public String getName() {
+        return NAME;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 tw=80 :
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java	Fri Sep 28 12:15:45 2012 +0200
@@ -63,4 +63,14 @@
      * Returns the wst unit as a String
      */
     String getWstUnit();
+
+    /**
+     * Returns the official number of this gauge
+     */
+    Long getOfficialNumber();
+
+    /**
+     * Returns the river to which this gauge belongs
+     */
+    String getRiverName();
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerOptionsData.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerOptionsData.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,6 +1,7 @@
 package de.intevation.flys.client.shared.model;
 
 
+/** Data matching to labelled integer(s). */
 public class IntegerOptionsData implements Data {
 
     public static final String TYPE = "intoptions";
@@ -87,5 +88,6 @@
         }
         return data;
     }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
 
-}
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapMode.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapMode.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,21 +1,23 @@
 package de.intevation.flys.client.shared.model;
 
-import java.util.List;
-
 import de.intevation.flys.client.client.ui.CollectionView;
 import de.intevation.flys.client.client.ui.OutputTab;
 import de.intevation.flys.client.client.ui.map.MapOutputTab;
 
+import java.util.List;
+
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class MapMode extends DefaultOutputMode {
 
+    /**
+     * Default constructor required for serialization.
+     */
     public MapMode() {
     }
 
-
     public MapMode(String name, String desc, String mimeType) {
         super(name, desc, mimeType);
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertyGroup.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertyGroup.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,9 +1,10 @@
 package de.intevation.flys.client.shared.model;
 
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
 
 /**
+ * A group of properties.
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
  */
 public class PropertyGroup implements Property, Cloneable {
@@ -14,7 +15,6 @@
     protected List<Property> properties;
 
     public PropertyGroup() {
-
     }
 
     public PropertyGroup(String name) {
@@ -51,7 +51,7 @@
         return null;
     }
 
-
+    @Override
     public Object clone() {
         PropertyGroup clone = new PropertyGroup(this.getName());
         List<Property> cloneList = new ArrayList<Property>();
@@ -61,4 +61,20 @@
         clone.setProperties(cloneList);
         return clone;
     }
+
+    @Override
+    public String toString() {
+        StringBuilder buf = new StringBuilder();
+
+        for(Property p : properties) {
+            buf.append(p.getName());
+            buf.append("=");
+            if(p instanceof PropertySetting) {
+                buf.append(((PropertySetting)p).getValue().toString());
+            }
+            buf.append(" ");
+        }
+
+        return buf.toString();
+    }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertySetting.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertySetting.java	Fri Sep 28 12:15:45 2012 +0200
@@ -1,7 +1,8 @@
 package de.intevation.flys.client.shared.model;
 
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.ArrayList;
+import java.util.List;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
@@ -63,11 +64,11 @@
         return attributes.get(key);
     }
 
-    public ArrayList<String> getAttributeList() {
+    public List<String> getAttributeList() {
         return new ArrayList<String>(attributes.keySet());
     }
 
-
+    @Override
     public Object clone() {
         PropertySetting clone = new PropertySetting(this.getName(),
                                                     this.getValue().toString());
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java	Fri Sep 28 12:15:45 2012 +0200
@@ -45,6 +45,11 @@
      * Returns the max q value of the river
      */
     Double getMaxQ();
+
+    /**
+     * Returns the official number of the river
+     */
+    Long getOfficialNumber();
 }
 
 
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:15:45 2012 +0200
@@ -92,6 +92,16 @@
   </servlet-mapping>
 
   <servlet>
+    <servlet-name>gaugeoverviewinfo</servlet-name>
+    <servlet-class>de.intevation.flys.client.server.GaugeOverviewInfoServiceImpl</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>gaugeoverviewinfo</servlet-name>
+    <url-pattern>/flys/gaugeoverviewinfo</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
     <servlet-name>forward</servlet-name>
     <servlet-class>de.intevation.flys.client.server.StepForwardServiceImpl</servlet-class>
   </servlet>
--- a/flys-client/src/main/webapp/login.jsp	Fri Sep 28 12:14:48 2012 +0200
+++ b/flys-client/src/main/webapp/login.jsp	Fri Sep 28 12:15:45 2012 +0200
@@ -6,7 +6,7 @@
     </head>
 
     <body>
-        <form method="POST" action="/flys/login" id="authentication">
+        <form method="POST" action="<%= request.getContextPath() + "/flys/login" %>" id="authentication">
             <h1>FLYS Anmeldung</h1>
             <% String error = request.getParameter("error"); %>
             <% if (error != null) { %>

http://dive4elements.wald.intevation.org