changeset 3973:86106b4fc464

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:44 +0200
parents 0da10f22bbfd (diff) c938e568c4a2 (current diff)
children 22cd60315e08
files flys-artifacts/ChangeLog flys-client/ChangeLog
diffstat 286 files changed, 15835 insertions(+), 3330 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/ChangeLog	Fri Sep 28 12:15:44 2012 +0200
@@ -1,4 +1,1224 @@
-2012-09-09	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+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:
+	  Removed superfluous imports.
+
+2012-09-19  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java:
+	  New. CSV exporter for bed quality calculation result.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiameterResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedParametersResult.java:
+	  Added getter with km as parameter.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Added facet for csv export.
+
+	* doc/conf/artifacts/minfo.xml:
+	  Added output mode.
+
+	* doc/conf/conf.xml:
+	  Added export generator.
+
+2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Return also the station in a service response.
+
+2012-09-18	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java:
+	  Cosmetics.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java:
+	  A and B facets of fix analysis are now deactivated by default (#717).
+
+2012-09-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java:
+	  Extract parameters needed for calculation from access.
+
+	* src/main/java/de/intevation/flys/utils/DoubleUtil.java(isValid):
+	  Added method to check if 2d double array is valid.
+
+2012-09-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java,
+	  src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java:
+	  Use generics aware Collections.emptyList().
+
+2012-09-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java,
+	  src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java,
+	  src/main/java/de/intevation/flys/exports/OutputHelper.java,
+	  src/main/java/de/intevation/flys/exports/ChartGenerator.java,
+	  src/main/java/de/intevation/flys/themes/ThemeFactory.java,
+	  src/main/java/de/intevation/flys/themes/ThemeMapping.java,
+	  src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java:
+	  The usual whitespace and import cleanups.
+
+2012-09-18  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java:
+	  Avoid loading empty data sets.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java:
+	  Load bedload data sets...
+
+2012-09-18  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java:
+	  Removed incorrect characteristic diameter.
+
+2012-09-18	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/default-themes.xml:
+	  Update point themes of fixing W/Q chart to show point descriptions
+	  per default (#685).
+
+2012-09-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	i18n for area label (fix issue487).
+
+	* src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java,
+	  src/main/java/de/intevation/flys/exports/ChartGenerator.java:
+	  Get internationalized label and numberformat, pass it to renderer,
+	  where its used.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: Area label translations.
+
+2012-09-18	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java,
+	  src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java:
+	  Add robustness checks to prevent NPEs (#859).
+
+2012-09-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Brought showarea-theme setting back (fix issue865).
+
+	* doc/conf/default-themes.xml, doc/conf/second-themes.xml:
+	  Define showarea theme prop where its needed.
+
+2012-09-17  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java:
+	  Added setter for date range.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java
+	  Set correct date range for result.
+
+2012-09-17  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Refactor MINFO bed quality resultsets and facets.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedLoadBedQualityResult.java,
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java:
+	  Removed.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java:
+	  Container wrapping the single calculation results.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiameterResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityDiameterResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedParametersResult.java:
+	  New. Results containing calculated average diameter, porosity and density.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedPorosityFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDensityFacet.java:
+	  Facets now return the concrete datatype using the facet index.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Create a facet for each resultset.
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  Use the classes containing the results.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java:
+	  Use new classes for results and calculate porosity and density once
+	  each period.
+
+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,
+	  src/main/resources/messages_de.properties: Added still missing
+	  translations for state.
+
+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,
+	  src/main/resources/messages_de.properties: Added missing translations
+	  for state to select soundings.
+
+	* src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java:
+	  Added more debug output to find out how many single and epochs where
+	  found.
+
+2012-09-17  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml: Defined initial colors.
+
+	* src/main/java/de/intevation/flys/exports/OutputHelper.java,
+	  src/main/java/de/intevation/flys/themes/ThemeFactory.java,
+	  src/main/java/de/intevation/flys/themes/ThemeMapping.java: Added more
+	  debug output to understand why theme mappings don't match to facets.
+
+2012-09-17  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Extract characteristic diameter only if the user selected a diameter.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java:
+	  Calculate for selected diameter only.
+
+2012-09-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java,
+	  src/main/java/de/intevation/flys/artifacts/model/SQOverview.java,
+	  src/main/java/de/intevation/flys/exports/DurationCurveExporter.java,
+	  src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java:
+	  Fixed wrong assigned loggers.
+
+2012-09-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java:
+	  Please _DO NOT_ use FLYSUtils in new code based on Access*!
+	  Now the river name is fetch via access.getRiver().
+
+	* src/main/java/de/intevation/flys/artifacts/access/RiverAccess.java:
+	  New. Almost all calculations need accessing the river name.
+
+	* src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/access/FixAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java:
+	  Now extend RiverAccess.
+
+2012-09-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java:
+	  Implemented the access methods needed for
+	  "Auslagerung extremer Wasserspiegellagen".
+
+	* src/main/java/de/intevation/flys/artifacts/model/Segment.java:
+	  Move segment parsing to DoubleUtil to be usable with more data types.
+	  The wire protocol should be the same for:
+	  - "WINFO: W fuer ungleichwertige Abfluesse",
+	  - "WINFO: Auslagerung extremer Wasserspiegellagen"
+	  - "Fixierungsanalyse: Auslagerung von Wasserspiegellagen"
+
+	* src/main/java/de/intevation/flys/utils/DoubleUtil.java:
+	  Now contains the the code to parse segments. Found segments
+	  are propagated back with a callback.
+
+	* src/main/java/de/intevation/flys/artifacts/model/RangeWithValues.java:
+	  Added toString() method.
+
+2012-09-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	More infrastructure stuff for the "Auslagerung extremer Wasserspiegellagen".
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java:
+	  New. Stub for "Auslagerung extremer Wasserspiegellagen" calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java:
+	  New. Stub for the cacheable results of the calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java:
+	  New. Stub compute state for the calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java:
+	  New. Sub access to the artifact to extract the relevant data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java:
+	  A little code reordering to keep related stuff together more closely.
+
+2012-09-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/BedHeightsArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/MINFOArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/QSectorArtifact.java,
+	  src/main/java/de/intevation/flys/artifacts/FixationArtifact.java:
+	  Removed some superfluous implementations of FacetTypes.
+	  TODO: FacetTypes should be broken into smaller pieces.
+	  ATM a lof of class implement it and share a lot of unnecessary
+	  stuff.
+
+2012-09-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/geom/Polygon2D.java,
+	  src/main/java/de/intevation/flys/artifacts/geom/VectorUtils.java:
+	  Deleted. Some nice code from the early days of the cross sections
+	  but its unused nowadays.
+
+2012-09-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java:
+	  Removed superfluous imports.
+
+	* src/main/java/de/intevation/flys/jfree/JFreeUtil.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedLoadBedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDensityFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedPorosityFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedQualityInfoGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  Removed trailing whitespace.
+
+2012-09-15	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/resources/Resources.java,
+	  src/main/java/de/intevation/flys/utils/Formatter.java,
+	  src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java:
+	  i18n messages are now formatted with correct (client) locale, not
+	  server VM locale (#852)..
+
+2012-09-15	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/artifacts/manualpoints.xml,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java:
+	  Try to add support for ManualPoints in fixing charts (not working yet).  
+
+2012-09-14  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java:
+	  Fixed SQL-statement.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurements.java:
+	  Added getter for all kms.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java:
+	  Implemented the bed quality calculation. There are still some fixes to do,
+	  e.g. extract a single result object for porosity and density.
+
+2012-09-14  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Getter for characteristic diameter.
+
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Create i18n facet descriptions.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: New i18n strings for facets
+	  in bed quality calculation.
+
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml: Splitted facets for diameter of bed into
+	  two facets: diameter for sublayer and toplayer.
+
+	* doc/conf/themes.xml,
+	  doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml: Splitted themes for diameter of bed into
+	  two themes.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
+	  Splitted facets for diameter of bed into two facets.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java:
+	  New method to retrieve the diameter data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java:
+	  New methods to retrieve the porosity, density and diameter data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Create two facets for bed diameter instead of a single one.
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  Insert data supported by facets into chart.
+
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/jfree/JFreeUtil.java: Added function to
+	  generate a randomized line.
+
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/themes.xml: Defined new mappings for the six bed quality
+	  facets.
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml: Added themes for new mappings in
+	  themes.xml. The themes in second-themes are the same as in
+	  default-themss.
+
+2012-09-14  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedLoadBedQualityResult.java:
+	  Updated bed quality result objects.
+
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml: Splitted porosity and density facets into
+	  two facets: a toplayer and a sublayer facet for each.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: Added
+	  the new facets for toplayer and sublayer for porosity and density.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Create Facets based on the calculation results.
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  Use concrete result types in doXXXOut().
+
+2012-09-13	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/themes.xml,
+	  src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java:
+	  Work on ManualPoints integration in fix analysis charts (wip).
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Fix missing import.
+
+2012-09-13  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Added getter for calculation parameters.
+
+	* src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java:
+	  Removed. Moved to package de.intevation.flys.artifacts.model.minfo.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedLoadBedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityCalculation.java:
+	  New. Calculation results and some more calculation stub.
+
+2012-09-13  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml,
+	  src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/states/DischargeState.java,
+	  src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: Renamed MINFO parameter
+	  'main.channel' -> 'main_channel' and 'total.channel' -> 'total_channel'.
+
+2012-09-13  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurement.java:
+	  Added depth parameter to bed quality data.
+
+2012-09-13  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/conf.xml: Registered new OutGenerators BedQualityGenerator and
+	  BedQualityInfoGenerator.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedPorosityFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterFacet.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedDensityFacet.java:
+	  New Facets for serving data for bed quality exports/charts.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Add some dummy Facets to force chart creation.
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityInfoGenerator.java,
+	  src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  New OutGenerators for bed quality charts.
+
+	* src/main/resources/messages.properties,
+	  src/main/resources/messages_de_DE.properties,
+	  src/main/resources/messages_en.properties,
+	  src/main/resources/messages_de.properties: New I18N strings for bed
+	  quality charts.
+
+2012-09-13  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java:
+	  The factory can load bedload and bed data from seddb now.
+
+2012-09-13  Raimund Renkert <raimund.renkert@intevation.de>
+
+	Objects and factory for minfo bedquality calculation data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurements.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurement.java:
+	  New. Data objects and factory for minfo bed quality calculation.
+
+2012-09-13	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Added missing images for datacage config manual doc.
+
+	* doc/datacage-config-manual/figures/bsh_logo.png,
+	  doc/datacage-config-manual/figures/intevation-logo.eps,
+	  doc/datacage-config-manual/figures/intevation-logo.pdf:
+	  Logos for DC conf doc.
+
+2012-09-13	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Add also min and max q values to the river info.
+
+2012-09-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/BedloadKMChartService.java,
+	  src/main/java/de/intevation/flys/artifacts/services/BedKMChartService.java:
+	  Removed trailing whitespace.
+
+2012-09-12  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/BedloadKMChartService.java,
+	  src/main/java/de/intevation/flys/artifacts/services/BedKMChartService.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedOverview.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedOverviewFactory.java,
+	  src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverviewFactory.java:
+	  New. Services, data structures and factories for overview charts in minfo
+	  bed quality calculation.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityPeriodsSelect.java:
+	  New. State for period input in minfo bed quality that displays the overview
+	  charts.
+
+	* doc/conf/artifacts/minfo.xml:
+	  Added states and transitions for minfo bed quality calculation.
+
+	* doc/conf/conf.xml:
+	  Added services.
+
+2012-09-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java,
+	  src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
+	  src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java,
+	  src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Removed trailing whitespace.
+
+2012-09-12  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml: Defined facets for bed quality chart.
+
+	* src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java:
+	  Calculation stub for bed quality.
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Access stub for bed quality data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: Added
+	  facets defined in minfo.xml.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Override computeAdvance; no calculation and facet creation takes place
+	  yet.
+
+2012-09-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Made AEo and datum attributes NPE proof.
+
+2012-09-11	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Use getGaugeValue method also for aeo and datum. Also add some javadoc for
+	  the getGaugeValue method.
+
+2012-09-11	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:
+	  Fix for line text annotations in Delta W(t) charts (#837).
+
+2012-09-10	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/GaugeTimerangeState.java:
+	  Add additional check to prevent NPE (fix for #844)
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/RangeWithValues.java:
+	  Extends Range now.
+
+	* src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java:
+	  Adjusted to use slightly different method names of Range.
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/Range.java:
+	  Added disjoint method.
+
+	* src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java:
+	  Find a list of segments intersecting a given range.
+
+	* src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
+	  Generate a list of ranges needed for the input of Qs
+	  in the "Auslagerung extremer Wasserspiegellagen.".
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/Curve.java:
+	  Added type safety.
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml: Java 1.5 -> 1.6
+
+2012-09-10	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml:
+	  Remove unnecessary attributes for fixation derived curve (#836).
+
+2012-09-10	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* doc/conf/conf.xml,
+	  src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
+	  Add new artifact service for the gauge overview
+
+2012-09-09	Christian Lins 	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  doc/conf/virtual-themes.xml,
+	  src/main/java/de/intevation/flys/utils/ThemeUtil.java,
+	  src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java:
+	  Theme transparency attribute support (part of #840).
+
+2012-09-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/Curve.java:
+	  Store Ws and Qs in double arrays instead of WQ objects (as
+	  they are return from WstValueTable.interpolateTabular()).
+	  This simplifies the code and should be more memory effective.
+
+2012-09-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/math/Linear.java:
+	  Added a vectorwise weighting.
+
+	  src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java:
+	  Added methods to interpolate tabulated values only.
+	  Need in "Auslagerung extremer Wasserspiegellagen".
+
+2012-09-09	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  doc/conf/virtual-themes.xml:
+	  Updating themes for issue #840 (wip).
+
+2012-09-09	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/second-themes.xml:
+	  Modify every theme to differ from default theme (#835).
+
+	* src/main/java/de/intevation/flys/artifacts/services/MainValuesService.java:
+	  Use gauge.getMainValues() instead of gauge.fetchMainValues() which fixes
+	  a compiling issue on my setup.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Some models for representing results for the upcoming
+	"Auslagerung extremer Wasserspiegellagen". Work im progress.
+
+	* src/main/java/de/intevation/flys/artifacts/math/NaNFunction.java:
+	  New. Function always return NaNs.
+
+	* src/main/java/de/intevation/flys/artifacts/math/UnivariateRealFunctionFunction.java:
+	  New. Adapter to bridge between our Functions and UnivariateRealFunctions
+	  of Apache Common Math.
+
+	* src/main/java/de/intevation/flys/artifacts/model/extreme/Curve.java:
+	  New. Part of the result model of "Auslagerung extremer Wasserspiegellagen".
+	  Its a function for a given km that uses a spline interpolation
+	  for the tabulated Q range (which is effectively the same as the
+	  calculated discharge curve for this km) and an extrapolated
+	  function beyond the tabulated values.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/DefaultState.java,
+	  src/main/java/de/intevation/flys/themes/DefaultTheme.java:
+	  More iterator code simplification.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/themes/DefaultThemeField.java:
+	  Simplified code.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java:
+	  Simplified code.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java:
+	  Improved robustness and performance.
+	  Only expose date events as Collections not TreeSets.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/QW.java:
+	  New. a pure model for discharge and waterlevel. No extras.
+
+	  Makes reuse in upcoming "Auslagerung extremer Wasserspiegellagen"
+	  a lot easier.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/QW.java:
+	  Removed.
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/QWI.java:
+	  Re-inserted here. Extends the new QW and adds all the extra bells
+	  and whistles needed in the fixings analysis.
+
+	* src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java,
+	  src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingResult.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java,
+	  src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java:
+	  Adjusted QW to QWI.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/MainValuesFactory.java;
+	  Removed because code is found in backend already.
+
+	* src/main/java/de/intevation/flys/artifacts/services/MainValuesService.java:
+	  Simplified. Please _DO_NOT_ use NullPointerExceptions for regular flow control!
+	  This hides unintended errors.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Removed code duplication.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java:
+	   Removed trailing whitespace.
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java:
+	  Removed superfluous imports.
+
+2012-09-08	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/datacage/DatacageBackendListener.java,
 	  src/main/java/de/intevation/flys/artifacts/datacage/Datacage.java,
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -158,6 +158,7 @@
                         <facet name="other.wq"    description="Point-like data like fixations"/>
                         <facet name="heightmarks_points" description="facet.other.wkms.heightmarks_points"/>
                         <facet name="discharge_curve.curve" description="facet.discharge_curve.curve"/>
+                        <facet name="fix_wq_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_deltawt_curve" description="output.fix_deltawt_curve" mine-type="image/png" type="chart">
@@ -170,6 +171,8 @@
                         <facet name="fix_reference_events_dwt" description="Raw event values used in the calculation"/>
                         <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">
@@ -186,11 +189,13 @@
                         <facet name="fix_deviation_ls" description="The standard variance"/>
                         <facet name="fix_analysis_events_ls" description="Average values for Ws in Q sectors."/>
                         <facet name="fix_reference_events_ls" description="Average values for Ws in Q sectors."/>
+                        <facet name="fix_longitudinal_section_curve.manualpoints" description="Manual points"/>
                     </facets>
                 </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>
                 <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report">
@@ -247,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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/manualpoints.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -18,6 +18,10 @@
             <facet name="reference_curve_normalized.manualpoints" description="points"/>
             <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." />
           </facets>
         </outputmode>
       </outputmodes>
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -58,12 +58,9 @@
             <data name="ld_locations" type="double"/>
         </state>
 
-        <state id="state.minfo.bed.location" description="state.minfo.bed.location" state="de.intevation.flys.artifacts.states.LocationDistanceSelect" helpText="help.minfo.bed.loaction">
-            <data name="ld_mode" type="String" />
-            <data name="ld_locations" type="Double[]" />
+        <state id="state.minfo.bed.location" description="state.minfo.bed.location" state="de.intevation.flys.artifacts.states.DistanceOnlySelect" helpText="help.minfo.bed.loaction">
             <data name="ld_from" type="Double" />
             <data name="ld_to" type="Double" />
-            <data name="ld_step" type="Double" />
         </state>
 
         <transition transition="de.intevation.flys.artifacts.transitions.ValueCompareTransition">
@@ -94,8 +91,8 @@
         </transition>
 
         <state id="state.minfo.dischargestate" description="state.minfo.dischargestate" state="de.intevation.flys.artifacts.states.DischargeState" helpText="help.minfo.dischargestate">
-            <data name="total.channel" type="intoptions"/>
-            <data name="main.channel"  type="intoptions"/>
+            <data name="total_channel" type="intoptions"/>
+            <data name="main_channel"  type="intoptions"/>
         </state>
 
         <state id="state.minfo.soundings" description="state.minfo.soundingsstate" state="de.intevation.flys.artifacts.states.SoundingsSelect" helpText="help.minfo.soundingsstate">
@@ -111,7 +108,7 @@
             <data name="diffids" type="String" />
         </state>
 
-        <state id="state.minfo.bed.periods" description="state.minfo.bed.periods" state="de.intevation.flys.artifacts.states.PeriodsSelect">
+        <state id="state.minfo.bed.periods" description="state.minfo.bed.periods" state="de.intevation.flys.artifacts.states.minfo.BedQualityPeriodsSelect">
             <data name="periods" type="String"/>
         </state>
 
@@ -185,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>
@@ -285,6 +297,18 @@
             <outputmodes>
                 <outputmode name="bed_longitudinal_section" description="output.bed_longitudinal_section" mime-type="image/png" type="chart">
                     <facets>
+                    	<facet name="bed_longitudinal_section.porosity_toplayer"/>
+                    	<facet name="bed_longitudinal_section.porosity_sublayer"/>
+                    	<facet name="bed_longitudinal_section.sediment_density_toplayer"/>
+                    	<facet name="bed_longitudinal_section.sediment_density_sublayer"/>
+                    	<facet name="bed_longitudinal_section.bed_diameter_toplayer"/>
+                    	<facet name="bed_longitudinal_section.bed_diameter_sublayer"/>
+                    	<facet name="bed_longitudinal_section.bedload_diameter"/>
+                    </facets>
+                </outputmode>
+                <outputmode name="bed_quality_export" description="output.bed_quality_export" type="export">
+                    <facets>
+                        <facet name="csv" description="facet.bed_quality_export.csv" />
                     </facets>
                 </outputmode>
             </outputmodes>
--- a/flys-artifacts/doc/conf/conf.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/doc/conf/conf.xml	Fri Sep 28 12:15:44 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>
@@ -186,6 +190,18 @@
                 name="modules"
                 service="de.intevation.flys.artifacts.services.ModuleService"
                 description="Returns a list of available modules.">de.intevation.artifactdatabase.DefaultServiceFactory</service-factory>
+            <service-factory
+                name="bed-km-chart"
+                service="de.intevation.flys.artifacts.services.BedKMChartService"
+                description="Returns a chart of km and date of meassuring points of a given river.">de.intevation.artifactdatabase.DefaultServiceFactory</service-factory>
+            <service-factory
+                name="bedload-km-chart"
+                service="de.intevation.flys.artifacts.services.BedloadKMChartService"
+                description="Returns a chart of km and date of meassuring points of a given river.">de.intevation.artifactdatabase.DefaultServiceFactory</service-factory>
+            <service-factory
+                name="gaugeoverviewinfo"
+                service="de.intevation.flys.artifacts.services.GaugeOverviewInfoService"
+                description="Returns an overview of the fixings of a given river.">de.intevation.artifactdatabase.DefaultServiceFactory</service-factory>
         </service-factories>
 
     </factories>
@@ -274,6 +290,15 @@
         <output-generator name="bedheight_middle">de.intevation.flys.exports.MiddleBedHeightGenerator</output-generator>
         <output-generator name="bedheight_middle_chartinfo">de.intevation.flys.exports.MiddleBedHeightInfoGenerator</output-generator>
         <output-generator name="bedheight_middle_export">de.intevation.flys.exports.MiddleBedHeightExporter</output-generator>
+        <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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/default-themes.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -52,7 +52,7 @@
                 default="0"/>
             <field name="fillcolor" type="Color" display="Bandbreitenfarbe"
                 default="104, 104, 104"/> 
-    	    <field name="alpha" type="int" default="50" display="Alpha-Transparenz"/>
+    	    <field name="transparency" type="int" default="20" display="Transparenz"/>
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="204, 204, 204" />
         </fields>
@@ -949,7 +949,11 @@
     <theme name="Area">
         <inherits>
             <inherit from="Areas" />
-        </inherits>
+         </inherits>
+         <fields>
+            <field name="showarea" type="boolean" display="Show Area"
+                default="true"/>
+         </fields>
     </theme>
 
     <!-- Map -->
@@ -1061,6 +1065,151 @@
                 default="0, 0, 102" />
         </fields>
     </theme>
+    
+    <!-- Bed Quality -->
+    <theme name="PorosityTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+        </fields>
+    </theme>
+    
+    <theme name="PorositySubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+        </fields>
+    </theme>
+    
+    <theme name="DensityTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#996366" />
+        </fields>
+    </theme>
+    
+    <theme name="DensitySubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#996366" />
+        </fields>
+    </theme>
+    
+    <theme name="BedDiameterTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#FF0000" />
+        </fields>
+    </theme>
+    
+    <theme name="BedDiameterSubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#FF0000" />
+        </fields>
+    </theme>
+    
+    <theme name="BedLoadDiameter">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#00FF00" />
+        </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 -->
@@ -1144,6 +1293,10 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" default="227, 27, 162" />
+            <field name="showpoints" type="boolean" display="Datenpunkte anzeigen"
+                default="false" hints="h" hidden="true" />
+            <field name="pointsize" type="int" display="Punktdicke"
+                default="5" hints="h" hidden="true" />
         </fields>
     </theme>
 
@@ -1160,7 +1313,7 @@
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="0, 128, 0" />
             <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+                display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ1">
@@ -1176,7 +1329,7 @@
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="0, 0, 255" />
             <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+                display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ2">
@@ -1192,7 +1345,7 @@
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="255, 0, 255" />
             <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+                display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ3">
@@ -1208,7 +1361,7 @@
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="255, 0, 0" />
             <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+                display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
     </theme>
 
@@ -1223,7 +1376,7 @@
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="0, 255, 0" />
             <field name="showpointlabel" type="boolean"
-                display="Punktbeschriftung anzeigen" default="false"/>
+                display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
     </theme>
 
@@ -1265,9 +1418,10 @@
         </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"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage1">
@@ -1276,9 +1430,10 @@
         </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"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage2">
@@ -1287,9 +1442,10 @@
         </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"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage3">
@@ -1298,9 +1454,10 @@
         </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"/>
         </fields>
     </theme>
 
@@ -1311,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" />
@@ -1366,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">
@@ -1377,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">
@@ -1388,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">
@@ -1399,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">
@@ -1410,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">
@@ -1441,8 +1590,8 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="50" display="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
+    		<field name="backgroundcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
     	</fields>
     </theme>
     <theme name="FixingDeltaWtAnalysisPeriods">
@@ -1450,17 +1599,26 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="80" display="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="255, 0, 0" display="Hauptfarbe"/>
-    		<field name="backgroundcolor" type="Color" default="0, 0, 255" display="Wechselfarbe"/>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
+            <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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/mapserver/db_layer.vm	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/mapserver/mapfile.vm	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/meta-data.xml	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/doc/conf/second-themes.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -7,9 +7,9 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 153" />
+                default="153, 0, 153" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="1" hints="h" />
         </fields>
     </theme>
 
@@ -21,9 +21,9 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 153" />
+                default="153, 0, 153" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="1" hints="h" />
         </fields>
     </theme>
 
@@ -34,9 +34,9 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="0, 204, 204" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="1" hints="h" />
         </fields>
     </theme>
 
@@ -48,8 +48,13 @@
             <inherit from="MinMaxPoints" />
         </inherits>
         <fields>
+            <field name="bandwidth" type="double" display="Bandbreite"
+                default="0"/>
+            <field name="fillcolor" type="Color" display="Bandbreitenfarbe"
+                default="104, 104, 104"/> 
+    	    <field name="transparency" type="int" default="30" display="Transparenz"/>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -59,7 +64,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -69,7 +74,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -79,7 +84,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 153, 51" />
+                default="51, 153, 51" />
         </fields>
     </theme>
 
@@ -89,7 +94,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -99,7 +104,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 153, 0" />
+                default="153, 0, 153" />
         </fields>
     </theme>
 
@@ -109,7 +114,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 51, 0" />
+                default="102, 0, 51" />
         </fields>
     </theme>
 
@@ -119,7 +124,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 153, 0" />
+                default="255, 153, 255" />
         </fields>
     </theme>
 
@@ -129,7 +134,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 255" />
+                default="255, 128, 255" />
         </fields>
     </theme>
 
@@ -139,7 +144,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 255" />
+                default="255, 128, 255" />
         </fields>
     </theme>
 
@@ -149,7 +154,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 128, 102" />
         </fields>
     </theme>
 
@@ -159,7 +164,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 128, 0" />
         </fields>
     </theme>
 
@@ -169,7 +174,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 128, 102" />
         </fields>
     </theme>
 
@@ -179,7 +184,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="253, 153, 0" />
+                default="253, 153, 128" />
         </fields>
     </theme>
 
@@ -189,7 +194,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 255, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -199,7 +204,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 255, 255" />
+                default="255, 0, 255" />
         </fields>
     </theme>
 
@@ -209,7 +214,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 51, 204" />
+                default="204, 51, 204" />
         </fields>
     </theme>
 
@@ -219,7 +224,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 204, 255" />
+                default="153, 204, 0" />
         </fields>
     </theme>
 
@@ -229,7 +234,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 255, 0" />
         </fields>
     </theme>
 
@@ -251,7 +256,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="64, 0, 102" />
         </fields>
     </theme>
 
@@ -261,7 +266,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="64, 0, 102" />
         </fields>
     </theme>
 
@@ -271,7 +276,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 153, 51" />
+                default="64, 153, 51" />
         </fields>
     </theme>
 
@@ -281,7 +286,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 204, 204" />
+                default="64, 204, 204" />
         </fields>
     </theme>
 
@@ -291,7 +296,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 153, 0" />
+                default="153, 153, 64" />
         </fields>
     </theme>
 
@@ -301,7 +306,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 51, 0" />
+                default="102, 51, 64" />
         </fields>
     </theme>
 
@@ -311,7 +316,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 153, 153" />
+                default="255, 0, 153" />
         </fields>
     </theme>
 
@@ -321,7 +326,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 51" />
+                default="255, 10, 0" />
         </fields>
     </theme>
 
@@ -331,7 +336,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 255" />
+                default="255, 64, 255" />
         </fields>
     </theme>
 
@@ -341,7 +346,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 64, 102" />
         </fields>
     </theme>
 
@@ -351,7 +356,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 0, 255" />
         </fields>
     </theme>
 
@@ -361,7 +366,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 64, 102" />
         </fields>
     </theme>
 
@@ -371,7 +376,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="253, 153, 0" />
+                default="253, 153, 64" />
         </fields>
     </theme>
 
@@ -381,7 +386,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 255, 102" />
+                default="102, 128, 102" />
         </fields>
     </theme>
 
@@ -391,7 +396,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 255, 255" />
+                default="0, 255, 0" />
         </fields>
     </theme>
 
@@ -401,7 +406,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 51, 204" />
+                default="64, 51, 178" />
         </fields>
     </theme>
 
@@ -411,7 +416,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 204, 255" />
+                default="153, 0, 255" />
         </fields>
     </theme>
 
@@ -421,7 +426,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 64, 0" />
         </fields>
     </theme>
 
@@ -434,7 +439,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 64, 204" />
         </fields>
     </theme>
 
@@ -444,7 +449,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -454,7 +459,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -464,7 +469,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 153, 51" />
+                default="102, 153, 51" />
         </fields>
     </theme>
 
@@ -474,7 +479,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -484,7 +489,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 153, 0" />
+                default="153, 0, 153" />
         </fields>
     </theme>
 
@@ -494,7 +499,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 51, 0" />
+                default="102, 51, 102" />
         </fields>
     </theme>
 
@@ -504,7 +509,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 153, 153" />
+                default="255, 0, 153" />
         </fields>
     </theme>
 
@@ -514,7 +519,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 51" />
+                default="255, 50, 51" />
         </fields>
     </theme>
 
@@ -524,7 +529,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0, 255" />
+                default="255, 255, 0" />
         </fields>
     </theme>
 
@@ -534,7 +539,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 102, 64" />
         </fields>
     </theme>
 
@@ -544,7 +549,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 102, 0" />
         </fields>
     </theme>
 
@@ -554,7 +559,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 0, 102" />
+                default="102, 102, 0" />
         </fields>
     </theme>
 
@@ -564,7 +569,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="253, 153, 0" />
+                default="253, 153, 102" />
         </fields>
     </theme>
 
@@ -574,7 +579,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="102, 255, 102" />
+                default="102, 0, 102" />
         </fields>
     </theme>
 
@@ -584,7 +589,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 255, 255" />
+                default="0, 0, 255" />
         </fields>
     </theme>
 
@@ -594,7 +599,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 51, 204" />
+                default="55, 51, 204" />
         </fields>
     </theme>
 
@@ -604,7 +609,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="153, 204, 255" />
+                default="153, 204, 0" />
         </fields>
     </theme>
 
@@ -614,7 +619,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="0, 128, 0" />
         </fields>
     </theme>
 
@@ -626,7 +631,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Farbe"
-                default="200, 0, 15" />
+                default="200, 64, 0" />
             <field name="textcolor" type="Color" display="Farbe"
                 default="200, 0, 15" />
             <field name="showhorizontalline" type="boolean"
@@ -645,7 +650,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Farbe"
-                default="0, 215, 0" />
+                default="0, 0, 215" />
             <field name="textcolor" type="Color" display="Farbe"
                 default="0, 215, 0" />
             <field name="showhorizontalline" type="boolean"
@@ -667,7 +672,7 @@
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0, 0, 153" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="4" hints="h" />
         </fields>
     </theme>
 
@@ -679,7 +684,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Farbe"
-                default="200, 0, 15" />
+                default="200, 255, 15" />
             <field name="textcolor" type="Color" display="Farbe"
                 default="200, 0, 15" />
         </fields>
@@ -693,7 +698,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Farbe"
-                default="0, 215, 0" />
+                default="0, 215, 128" />
             <field name="textcolor" type="Color" display="Farbe"
                 default="0, 215, 0" />
             <field name="textorientation" type="boolean" display="Textausrichtung"
@@ -711,7 +716,7 @@
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0,0,0" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="1" hints="h" />
+                default="3" hints="h" />
         </fields>
     </theme>
 
@@ -721,13 +726,15 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0,0,153" />
+                default="255,0,153" />
             <field name="linesize" type="int" display="Liniendicke"
                 default="1" hints="h" />
             <field name="showwidth" type="boolean" display="Breite anzeigen"
                 default="false" />
             <field name="showlevel" type="boolean" display="Wasserstand anzeigen"
-                default="false" />
+                default="true" />
+            <field name="showlinelabel" type="boolean" default="true"
+                display="Beschriftung anzeigen" />
             <field name="showmiddleheight" type="boolean"
                 display="Wasserstand anzeigen" default="false" />
         </fields>
@@ -762,7 +769,7 @@
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0,51,204" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="1" hints="h" />
         </fields>
     </theme>
 
@@ -775,7 +782,7 @@
             <field name="linecolor" type="Color" display="Linienfarbe"
                 default="0,204,0" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="2" hints="h" />
+                default="1" hints="h" />
         </fields>
     </theme>
 
@@ -787,7 +794,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -799,7 +806,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -810,7 +817,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -822,7 +829,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -833,7 +840,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -847,7 +854,7 @@
             <field name="showpoints" type="boolean" display="Punkte anzeigen"
                 default="true" />
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 0, 0" />
+                default="204, 0, 200" />
         </fields>
     </theme>
 
@@ -859,7 +866,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -871,7 +878,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="255, 0 , 0" />
+                default="255, 0 , 255" />
         </fields>
     </theme>
 
@@ -882,7 +889,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -896,7 +903,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="99, 99, 99" />
         </fields>
     </theme>
 
@@ -907,7 +914,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="250, 0, 0" />
+                default="250, 255, 0" />
             <field name="font" type="Font" display="Schriftart"
                 default="arial" />
             <field name="textcolor" type="Color" display="Schriftfarbe"
@@ -917,9 +924,9 @@
             <field name="textstyle" type="Style" display="Schriftstil"
                 default="standard" />
             <field name="pointsize" type="int" display="Punktdicke"
-                default="3" hints="h" />
+                default="2" hints="h" />
             <field name="backgroundcolor" type="Color" display="Texthintergrund"
-                default="255, 255, 255" />
+                default="55, 55, 55" />
             <field name="textorientation" type="boolean" display="Textausrichtung"
                 default="true" />
             <field name="showbackground" type="boolean"
@@ -934,7 +941,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 0" />
+                default="330, 33, 33" />
         </fields>
     </theme>
 
@@ -943,6 +950,10 @@
         <inherits>
             <inherit from="Areas" />
         </inherits>
+        <fields>
+            <field name="showarea" type="boolean" display="Show Area"
+                default="true"/>
+        </fields>
     </theme>
 
     <!-- Map -->
@@ -1041,7 +1052,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="128, 128, 128" />
         </fields>
     </theme>
 
@@ -1051,7 +1062,153 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="64, 0, 102" />
+        </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>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="100, 100, 100" />
+        </fields>
+    </theme>
+    
+    <theme name="PorositySubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="100, 100, 100" />
+        </fields>
+    </theme>
+    
+    <theme name="DensityTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#990000" />
+        </fields>
+    </theme>
+    
+    <theme name="DensitySubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#990000" />
+        </fields>
+    </theme>
+    
+    <theme name="BedDiameterTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#FF4444" />
+        </fields>
+    </theme>
+    
+    <theme name="BedDiameterSubLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#FF4444" />
+        </fields>
+    </theme>
+    
+    <theme name="BedLoadDiameter">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="#33FF11" />
         </fields>
     </theme>
 
@@ -1064,7 +1221,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="204, 204, 204" />
+                default="204, 0, 204" />
         </fields>
     </theme>
 
@@ -1074,7 +1231,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 0, 102" />
+                default="64, 0, 102" />
         </fields>
     </theme>
 
@@ -1085,7 +1242,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" display="Linienfarbe"
-                default="0, 204, 204" />
+                default="0, 204, 0" />
         </fields>
     </theme>
 
@@ -1098,7 +1255,7 @@
         <fields>
             <field name="showlines" type="boolean" display="Linie anzeigen"
                 default="false" hidden="true" />
-            <field name="pointcolor" type="Color" default="#0099FF" />
+            <field name="pointcolor" type="Color" default="0, 99, 255" />
         </fields>
     </theme>
 
@@ -1109,7 +1266,7 @@
         <fields>
             <field name="showlines" type="boolean" display="Linie anzeigen"
                 default="false" hidden="true" />
-            <field name="pointcolor" type="Color" default="#CC0000" />
+            <field name="pointcolor" type="Color" default="0, 99, 0" />
         </fields>
     </theme>
 
@@ -1119,6 +1276,7 @@
         </inherits>
         <fields>
             <field name="linecolor" type="Color" default="#000000" />
+            <field name="linesize" type="int" default="3" />
         </fields>
     </theme>
 
@@ -1127,7 +1285,20 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="227, 27, 162" />
+            <field name="linecolor" type="Color" default="0, 27, 162" />
+        </fields>
+    </theme>
+
+    <theme name="FixingDerivedCurve">
+        <inherits>
+            <inherit from="HiddenColorLines" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" default="0, 27, 162" />
+            <field name="showpoints" type="boolean" display="Datenpunkte anzeigen"
+                default="false" hints="h" hidden="true" />
+            <field name="pointsize" type="int" display="Punktdicke"
+                default="5" hints="h" hidden="true" />
         </fields>
     </theme>
 
@@ -1142,9 +1313,9 @@
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 128, 0" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+                default="0, 128, 128" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ1">
@@ -1158,9 +1329,9 @@
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 0, 255" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+                default="0, 64, 255" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ2">
@@ -1172,11 +1343,11 @@
                 display="Beschriftung anzeigen" default="false" hints="h" />
             <field name="showlines" type="boolean" default="false" />
             <field name="pointsize" type="int" display="Punktdicke"
-                default="3" />
+                default="2" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="255, 0, 255" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
     <theme name="FixingSectorAverageWQ3">
@@ -1190,9 +1361,9 @@
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="255, 0, 0" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+                default="255, 0, 255" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
 
@@ -1201,15 +1372,13 @@
             <inherit from="ColorPoints" />
         </inherits>
         <fields>
-            <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
             <field name="showlines" type="boolean" default="false" />
             <field name="pointsize" type="int" display="Punktdicke"
                 default="3" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 255, 0" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+                default="0, 255, 255" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
 
@@ -1225,11 +1394,11 @@
             <field name="linetype" type="Dash" display="Linienart"
                 default="10" hidden="true" />
             <field name="linesize" type="int" display="Liniendicke"
-                default="1" hidden="true" />
+                default="2" hidden="true" />
             <field name="pointsize" type="int" display="Punktdicke"
-                default="3" />
+                default="4" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 80, 160" />
+                default="0, 80, 255" />
             <field name="showpointlabel" type="boolean"
                 display="Punktbeschriftung anzeigen" default="true"/>
         </fields>
@@ -1240,62 +1409,65 @@
             <inherit from="ColorPoints" />
         </inherits>
         <fields>
-            <field name="showlines" type="boolean" default="false" />
-            <field name="textorientation" type="boolean" display="Textausrichtung"
-                default="true" />
+            <field name="showpointlabel" type="boolean"
+                display="Punktbeschriftung anzeigen" default="false"/>
         </fields>
     </theme>
 
     <theme name="FixingDeltaWtAverage0">
         <inherits>
-            <inherit from="ColorPoints" />
+            <inherit from="ColorLines" />
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
-            <field name="pointsize" type="int" display="Punktdicke"
+                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"
                 default="3" />
-            <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 128, 0" />
+            <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage1">
         <inherits>
-            <inherit from="ColorPoints" />
+            <inherit from="ColorLines" />
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
-            <field name="pointsize" type="int" display="Punktdicke"
+                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"
                 default="3" />
-            <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="0, 0, 255" />
+            <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage2">
         <inherits>
-            <inherit from="ColorPoints" />
+            <inherit from="ColorLines" />
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
-            <field name="pointsize" type="int" display="Punktdicke"
+                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"
                 default="3" />
-            <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="255, 0, 255" />
+            <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
         </fields>
     </theme>
     <theme name="FixingDeltaWtAverage3">
         <inherits>
-            <inherit from="ColorPoints" />
+            <inherit from="ColorLines" />
         </inherits>
         <fields>
             <field name="showlinelabel" type="boolean"
-                display="Beschriftung anzeigen" default="false" hints="h" />
-            <field name="pointsize" type="int" display="Punktdicke"
+                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"
                 default="3" />
-            <field name="pointcolor" type="Color" display="Punktfarbe"
-                default="255, 0, 0" />
+            <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
         </fields>
     </theme>
 
@@ -1307,11 +1479,14 @@
         <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" />
             <field name="pointcolor" type="Color" display="Punktfarbe"
                 default="0, 255, 0" />
+            <field name="textorientation" type="boolean" default="true" display="Text horizontal"/>
         </fields>
     </theme>
 
@@ -1320,7 +1495,7 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="0, 128, 0" />
+            <field name="linecolor" type="Color" default="0, 128, 64" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
@@ -1330,7 +1505,7 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="0, 0, 255" />
+            <field name="linecolor" type="Color" default="0, 64, 255" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
@@ -1340,7 +1515,7 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="255, 0, 255" />
+            <field name="linecolor" type="Color" default="255, 64, 255" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
@@ -1350,7 +1525,7 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="255, 0, 0" />
+            <field name="linecolor" type="Color" default="255, 0, 64" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
@@ -1361,10 +1536,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
-                default="0, 128, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
+                default="0, 128, 64" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS1">
@@ -1372,10 +1545,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
-                default="0, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
+                default="64, 0, 255" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS2">
@@ -1383,10 +1554,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
-                default="255, 0, 255" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
+                default="255, 64, 255" />
         </fields>
     </theme>
     <theme name="FixingSectorDeviationLS3">
@@ -1394,10 +1563,8 @@
             <inherit from="Areas" />
         </inherits>
         <fields>
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
-                default="255, 0, 0" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="true" />
+            <field name="backgroundcolor" type="Color" display="Fuellfarbe"
+                default="255, 64, 0" />
         </fields>
     </theme>
     <theme name="FixLSDeviation">
@@ -1406,7 +1573,7 @@
         </inherits>
         <fields>
             <field name="fillcolor" type="Color" display="Fuellfarbe"
-                default="100, 100, 100" />
+                default="200, 200, 200" />
             <field name="transparent" type="boolean" display="Transparenz"
                 default="true" />
         </fields>
@@ -1416,7 +1583,7 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="0, 255, 0" />
+            <field name="linecolor" type="Color" default="0, 0, 255" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
@@ -1426,26 +1593,18 @@
             <inherit from="HiddenColorLines" />
         </inherits>
         <fields>
-            <field name="linecolor" type="Color" default="0, 80, 160" />
+            <field name="linecolor" type="Color" default="160, 80, 160" />
             <field name="showlinelabel" type="boolean"
                 display="Beschriftung anzeigen" default="false" hints="h" />
         </fields>
     </theme>
-    <theme name="FixingDerivedCurve">
-        <inherits>
-            <inherit from="HiddenColorLines" />
-        </inherits>
-        <fields>
-            <field name="linecolor" type="Color" default="227, 27, 162" />
-        </fields>
-    </theme>
     <theme name="FixDeltaWtDeviation">
     	<inherits>
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="50" disply="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
+    		<field name="transparency" type="int" default="30" display="Transparenz"/>
+    		<field name="backgroundcolor" type="Color" default="0, 0, 0" display="Füllfarbe"/>
     	</fields>
     </theme>
     <theme name="FixingDeltaWtAnalysisPeriods">
@@ -1453,10 +1612,38 @@
     		<inherit from="Areas"/>
     	</inherits>
     	<fields>
-    		<field name="alpha" type="int" default="80" disply="Alpha-Transparenz"/>
-    		<field name="fillcolor" type="Color" default="255, 0, 0" display="Hauptfarbe"/>
-    		<field name="backgroundcolor" type="Color" default="0, 0, 255" display="Wechselfarbe"/>
+    		<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>
+            <field name="linecolor" type="Color" default="32, 27, 162" />
+            <field name="showlinelabel" type="boolean"
+                display="Beschriftung anzeigen" default="false" hints="h" />
+            <field name="linetype" type="Dash" display="Linienart"
+                default="10" hidden="true" />
+            <field name="linesize" type="int" display="Liniendicke"
+                default="2" hidden="true" />
+            <field name="labelfontface" type="Font"
+                display="Beschriftung: Schriftart" default="arial" />
+            <field name="labelfontcolor" type="Color"
+                display="Beschriftung: Schriftfarbe" default="0, 0, 0" />
+            <field name="labelfontsize" type="int"
+                display="Beschriftung: Schriftgröße" default="9" />
+            <field name="labelfontstyle" type="Style"
+                display="Beschriftung: Schriftstil" default="standard" />
+        </fields>
+    </theme>
+
 </themegroup>
--- a/flys-artifacts/doc/conf/themes.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/doc/conf/themes.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -9,192 +9,262 @@
     &second-themes;
     &virtual-themes;
 
-    <!--
-      Mappings are following now. A mapping maps between a name of a facet
-      and a theme.
-      Always the first matching mapping is taken, so consider putting most
-      specific mappings on top of the list.
-    -->
-    <mappings>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ1)(\D.*)*" to="LongitudinalSectionW_HQ1_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ2)(\D.*)*" to="LongitudinalSectionW_HQ2_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ5)(\D.*)*" to="LongitudinalSectionW_HQ5_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ10)(\D.*)*" to="LongitudinalSectionW_HQ10_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ20)(\D.*)*" to="LongitudinalSectionW_HQ20_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ25)(\D.*)*" to="LongitudinalSectionW_HQ25_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ50)(\D.*)*" to="LongitudinalSectionW_HQ50_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ100)(\D.*)*" to="LongitudinalSectionW_HQ100_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ200)(\D.*)*" to="LongitudinalSectionW_HQ200_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ500)(\D.*)*" to="LongitudinalSectionW_HQ500_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQ1000)(\D.*)*" to="LongitudinalSectionW_HQ1000_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQExtrem)(\D.*)*" to="LongitudinalSectionW_HQExtrem_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HQRZ)(\D.*)*" to="LongitudinalSectionW_HQRZ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(HSQ)(\D.*)*" to="LongitudinalSectionW_HSQ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(MHQ)(\D.*)*" to="LongitudinalSectionW_MHQ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(MNQ)(\D.*)*" to="LongitudinalSectionW_MNQ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(MQ)(\D.*)*" to="LongitudinalSectionW_MQ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" pattern=".*(NQ)(\D.*)*" to="LongitudinalSectionW_NQ_Points"/>
-        <mapping from="longitudinal_section.w" masterAttr="ld_mode==location" to="LongitudinalSectionPoints"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ1)(\D.*)*" to="LongitudinalSectionW_HQ1"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ2)(\D.*)*" to="LongitudinalSectionW_HQ2"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ5)(\D.*)*" to="LongitudinalSectionW_HQ5"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ10)(\D.*)*" to="LongitudinalSectionW_HQ10"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ20)(\D.*)*" to="LongitudinalSectionW_HQ20"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ25)(\D.*)*" to="LongitudinalSectionW_HQ25"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ50)(\D.*)*" to="LongitudinalSectionW_HQ50"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ100)(\D.*)*" to="LongitudinalSectionW_HQ100"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ200)(\D.*)*" to="LongitudinalSectionW_HQ200"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ500)(\D.*)*" to="LongitudinalSectionW_HQ500"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQ1000)(\D.*)*" to="LongitudinalSectionW_HQ1000"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQExtrem)(\D.*)*" to="LongitudinalSectionW_HQExtrem"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HQRZ)(\D.*)*" to="LongitudinalSectionW_HQRZ"/>
-        <mapping from="longitudinal_section.w" pattern=".*(HSQ)(\D.*)*" to="LongitudinalSectionW_HSQ"/>
-        <mapping from="longitudinal_section.w" pattern=".*(MHQ)(\D.*)*" to="LongitudinalSectionW_MHQ"/>
-        <mapping from="longitudinal_section.w" pattern=".*(MNQ)(\D.*)*" to="LongitudinalSectionW_MNQ"/>
-        <mapping from="longitudinal_section.w" pattern=".*(MQ)(\D.*)*" to="LongitudinalSectionW_MQ"/>
-        <mapping from="longitudinal_section.w" pattern=".*(NQ)(\D.*)*" to="LongitudinalSectionW_NQ"/>
-        <mapping from="longitudinal_section.w" to="LongitudinalSectionW"/>
-
-        <mapping from="longitudinal_section.q" pattern="(HQ1)(\D.*)*" to="LongitudinalSectionQ_HQ1"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ2)(\D.*)*" to="LongitudinalSectionQ_HQ2"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ5)(\D.*)*" to="LongitudinalSectionQ_HQ5"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ10)(\D.*)*" to="LongitudinalSectionQ_HQ10"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ20)(\D.*)*" to="LongitudinalSectionQ_HQ20"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ25)(\D.*)*" to="LongitudinalSectionQ_HQ25"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ50)(\D.*)*" to="LongitudinalSectionQ_HQ50"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ100)(\D.*)*" to="LongitudinalSectionQ_HQ100"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ200)(\D.*)*" to="LongitudinalSectionQ_HQ200"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ500)(\D.*)*" to="LongitudinalSectionQ_HQ500"/>
-        <mapping from="longitudinal_section.q" pattern="(HQ1000)(\D.*)*" to="LongitudinalSectionQ_HQ1000"/>
-        <mapping from="longitudinal_section.q" pattern="(HQExtrem)(\D.*)*" to="LongitudinalSectionQ_HQExtrem"/>
-        <mapping from="longitudinal_section.q" pattern="(HQRZ)(\D.*)*" to="LongitudinalSectionQ_HQRZ"/>
-        <mapping from="longitudinal_section.q" pattern="(HSQ)(\D.*)*" to="LongitudinalSectionQ_HSQ"/>
-        <mapping from="longitudinal_section.q" pattern="(MHQ)(\D.*)*" to="LongitudinalSectionQ_MHQ"/>
-        <mapping from="longitudinal_section.q" pattern="(MNQ)(\D.*)*" to="LongitudinalSectionQ_MNQ"/>
-        <mapping from="longitudinal_section.q" pattern="(MQ)(\D.*)*" to="LongitudinalSectionQ_MQ"/>
-        <mapping from="longitudinal_section.q" pattern="(NQ)(\D.*)*" to="LongitudinalSectionQ_NQ"/>
-        <mapping from="longitudinal_section.q" to="LongitudinalSectionQ"/>
+	<!-- Mappings are following now. A mapping maps between a name of a facet 
+		and a theme. Always the first matching mapping is taken, so consider putting 
+		most specific mappings on top of the list. -->
+	<mappings>
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ1)(\D.*)*" to="LongitudinalSectionW_HQ1_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ2)(\D.*)*" to="LongitudinalSectionW_HQ2_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ5)(\D.*)*" to="LongitudinalSectionW_HQ5_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ10)(\D.*)*" to="LongitudinalSectionW_HQ10_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ20)(\D.*)*" to="LongitudinalSectionW_HQ20_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ25)(\D.*)*" to="LongitudinalSectionW_HQ25_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ50)(\D.*)*" to="LongitudinalSectionW_HQ50_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ100)(\D.*)*" to="LongitudinalSectionW_HQ100_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ200)(\D.*)*" to="LongitudinalSectionW_HQ200_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ500)(\D.*)*" to="LongitudinalSectionW_HQ500_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQ1000)(\D.*)*" to="LongitudinalSectionW_HQ1000_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQExtrem)(\D.*)*" to="LongitudinalSectionW_HQExtrem_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HQRZ)(\D.*)*" to="LongitudinalSectionW_HQRZ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(HSQ)(\D.*)*" to="LongitudinalSectionW_HSQ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(MHQ)(\D.*)*" to="LongitudinalSectionW_MHQ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(MNQ)(\D.*)*" to="LongitudinalSectionW_MNQ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(MQ)(\D.*)*" to="LongitudinalSectionW_MQ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			pattern=".*(NQ)(\D.*)*" to="LongitudinalSectionW_NQ_Points" />
+		<mapping from="longitudinal_section.w" masterAttr="ld_mode==location"
+			to="LongitudinalSectionPoints" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ1)(\D.*)*"
+			to="LongitudinalSectionW_HQ1" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ2)(\D.*)*"
+			to="LongitudinalSectionW_HQ2" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ5)(\D.*)*"
+			to="LongitudinalSectionW_HQ5" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ10)(\D.*)*"
+			to="LongitudinalSectionW_HQ10" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ20)(\D.*)*"
+			to="LongitudinalSectionW_HQ20" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ25)(\D.*)*"
+			to="LongitudinalSectionW_HQ25" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ50)(\D.*)*"
+			to="LongitudinalSectionW_HQ50" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ100)(\D.*)*"
+			to="LongitudinalSectionW_HQ100" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ200)(\D.*)*"
+			to="LongitudinalSectionW_HQ200" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ500)(\D.*)*"
+			to="LongitudinalSectionW_HQ500" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQ1000)(\D.*)*"
+			to="LongitudinalSectionW_HQ1000" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQExtrem)(\D.*)*"
+			to="LongitudinalSectionW_HQExtrem" />
+		<mapping from="longitudinal_section.w" pattern=".*(HQRZ)(\D.*)*"
+			to="LongitudinalSectionW_HQRZ" />
+		<mapping from="longitudinal_section.w" pattern=".*(HSQ)(\D.*)*"
+			to="LongitudinalSectionW_HSQ" />
+		<mapping from="longitudinal_section.w" pattern=".*(MHQ)(\D.*)*"
+			to="LongitudinalSectionW_MHQ" />
+		<mapping from="longitudinal_section.w" pattern=".*(MNQ)(\D.*)*"
+			to="LongitudinalSectionW_MNQ" />
+		<mapping from="longitudinal_section.w" pattern=".*(MQ)(\D.*)*"
+			to="LongitudinalSectionW_MQ" />
+		<mapping from="longitudinal_section.w" pattern=".*(NQ)(\D.*)*"
+			to="LongitudinalSectionW_NQ" />
+		<mapping from="longitudinal_section.w" to="LongitudinalSectionW" />
 
-        <mapping from="discharge_curve.curve" to="DischargeCurve"/>
-        <mapping from="historical_discharge.historicalq" to="HistoricalDischargeCurveQ"/>
-        <mapping from="historical_discharge.historicalq.diff" to="HistoricalDischargeCurveQDiff"/>
-        <mapping from="cross_section" to="CrossSection"/>
-        <mapping from="cross_section_water_line" to="CrossSectionWaterLine"/>
-        <mapping from="computed_discharge_curve.q" to="ComputedDischargeCurve"/>
-        <mapping from="duration_curve.w" to="DurationCurveW"/>
-        <mapping from="duration_curve.q" to="DurationCurveQ"/>
-        <mapping from="discharge_longitudinal_section.w" to="DischargeLongitudinalSectionW"/>
-        <mapping from="discharge_longitudinal_section.c" to="DischargeLongitudinalSectionC"/>
-        <mapping from="discharge_longitudinal_section.q" to="DischargeLongitudinalSectionQ"/>
-        <mapping from="computed_discharge_curve.mainvalues.q" to="MainValuesQ"/>
-        <mapping from="computed_discharge_curve.mainvalues.w" to="MainValuesW"/>
-        <mapping from="duration_curve.mainvalues.q" to="MainValuesQ"/>
-        <mapping from="mainvalues.q" to="MainValuesQ"/>
-        <mapping from="mainvalues.w" to="MainValuesW"/>
-        <mapping from="longitudinal_section.annotations" to="Annotations"/>
-        <mapping from="w_differences" to="Differences"/>
-        <mapping from="floodmap.wsplgen" to="WSPLGEN"/>
-        <mapping from="floodmap.riveraxis" to="RiverAxis"/>
-        <mapping from="floodmap.kms" to="Kms"/>
-        <mapping from="floodmap.qps" to="Qps"/>
-        <mapping from="floodmap.hws" to="Hws"/>
-        <mapping from="floodmap.hydr_boundaries" to="HydrBoundariesLines"/>
-        <mapping from="floodmap.hydr_boundaries_poly" to="HydrBoundariesPolys"/>
-        <mapping from="floodmap.catchment" to="Catchment"/>
-        <mapping from="floodmap.floodplain" to="Floodplains"/>
-        <mapping from="floodmap.lines" to="FloodmapLines"/>
-        <mapping from="floodmap.buildings" to="Buildings"/>
-        <mapping from="floodmap.fixpoints" to="Fixpoints"/>
-        <mapping from="floodmap.floodmaps" to="Floodmaps"/>
-        <mapping from="floodmap.gauge_location" to="GaugeLocation"/>
-        <mapping from="other.wq" to="WQPoints"/>
-        <mapping from="other.wkms" to="WKms"/>
-        <mapping from="other.wqkms" to="WQKms"/>
-        <mapping from="other.wqkms.w" to="WQKms"/>
-        <mapping from="other.wqkms.q" to="WQKms"/>
-        <mapping from="heightmarks_points" to="heightmarks_points"/>
-        <mapping from="area" to="Area"/>
-        <mapping from="cross_section.area" to="Area"/>
-        <mapping from="hyk" to="Hyk"/>
-        <mapping from="longitudinal_section.area" to="Area"/>
-        <mapping from="longitudinal_section.manualpoints" to="ManualPoints"/>
-        <mapping from="cross_section.manualpoints" to="ManualPoints"/>
-        <mapping from="cross_section.manualline" to="CrossSectionWaterLine"/>
-        <mapping from="computed_discharge_curve.manualpoints" to="ManualPoints"/>
-        <mapping from="duration_curve.manualpoints" to="ManualPoints"/>
-        <mapping from="wdifferences.manualpoints" to="ManualPoints"/>
-        <mapping from="discharge_longitudinal_section.manualpoints" to="ManualPoints"/>
-        <mapping from="discharge_curve.manualpoints" to="ManualPoints"/>
-        <mapping from="reference_curve.manualpoints" to="ManualPoints"/>
-        <mapping from="reference_curve_normalized.manualpoints" to="ManualPoints"/>
-        <mapping from="historical_discharge.manualpoints" to="ManualPoints"/>
-        <mapping from="manualpoints" to="ManualPoints"/>
-        <mapping from="reference_curve" to="ReferenceCurve"/>
-        <mapping from="reference_curve_normalized" to="ReferenceCurveNormalized"/>
-        <mapping from="flow_velocity.totalchannel" to="FlowVelocityVTotalChannel"/>
-        <mapping from="flow_velocity.mainchannel" to="FlowVelocityVMainChannel"/>
-        <mapping from="flow_velocity.tau" to="FlowVelocityTau"/>
-        <mapping from="bedheight_middle.single" to="MiddleBedHeightSingle"/>
-        <mapping from="bedheight_middle.epoch" to="MiddleBedHeightEpoch"/>
-        <mapping from="relativepoint" to="RelativePoint"/>
-        <mapping from="sq_a_measurement" to="SQMeasurements"/>
-        <mapping from="sq_a_outlier" to="SQOutliers"/>
-        <mapping from="sq_a_curve" to="SQCurve"/>
-        <mapping from="sq_a_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_a_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="sq_b_measurement" to="SQMeasurements"/>
-        <mapping from="sq_b_outlier" to="SQOutliers"/>
-        <mapping from="sq_b_curve" to="SQCurve"/>
-        <mapping from="sq_b_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_b_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="sq_c_measurement" to="SQMeasurements"/>
-        <mapping from="sq_c_outlier" to="SQOutliers"/>
-        <mapping from="sq_c_curve" to="SQCurve"/>
-        <mapping from="sq_c_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_c_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="sq_d_measurement" to="SQMeasurements"/>
-        <mapping from="sq_d_outlier" to="SQOutliers"/>
-        <mapping from="sq_d_curve" to="SQCurve"/>
-        <mapping from="sq_d_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_d_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="sq_e_measurement" to="SQMeasurements"/>
-        <mapping from="sq_e_outlier" to="SQOutliers"/>
-        <mapping from="sq_e_curve" to="SQCurve"/>
-        <mapping from="sq_e_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_e_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="sq_f_measurement" to="SQMeasurements"/>
-        <mapping from="sq_f_outlier" to="SQOutliers"/>
-        <mapping from="sq_f_curve" to="SQCurve"/>
-        <mapping from="sq_f_outlier_curve" to="SQCurve"/>
-        <mapping from="sq_f_outlier_measurement" to="SQMeasurements"/>
-        <mapping from="fix_sector_average_wq_0" to="FixingSectorAverageWQ0"/>
-        <mapping from="fix_sector_average_wq_1" to="FixingSectorAverageWQ1"/>
-        <mapping from="fix_sector_average_wq_2" to="FixingSectorAverageWQ2"/>
-        <mapping from="fix_sector_average_wq_3" to="FixingSectorAverageWQ3"/>
-        <mapping from="fix_analysis_events_wq" to="FixingAnalysisEventsWQ"/>
-        <mapping from="fix_outlier" to="FixingOutlier"/>
-        <mapping from="fix_wq_curve" to="FixingWQCurve"/>
-        <mapping from="fix_reference_events_wq" to="FixingReferenceEvents"/>
-        <mapping from="fix_sector_average_dwt_0" to="FixingDeltaWtAverage0"/>
-        <mapping from="fix_sector_average_dwt_1" to="FixingDeltaWtAverage1"/>
-        <mapping from="fix_sector_average_dwt_2" to="FixingDeltaWtAverage2"/>
-        <mapping from="fix_sector_average_dwt_3" to="FixingDeltaWtAverage3"/>
-        <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_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"/>
-        <mapping from="fix_sector_average_ls_deviation_3" to="FixingSectorDeviationLS3"/>
-        <mapping from="fix_sector_average_ls_0" to="FixingLSAverage0"/>
-        <mapping from="fix_sector_average_ls_1" to="FixingLSAverage1"/>
-        <mapping from="fix_sector_average_ls_2" to="FixingLSAverage2"/>
-        <mapping from="fix_sector_average_ls_3" to="FixingLSAverage3"/>
-        <mapping from="fix_deviation_ls" to="FixLSDeviation"/>
-        <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="qsectors" to="QSectors"/>
-    </mappings>
+		<mapping from="longitudinal_section.q" pattern="(HQ1)(\D.*)*"
+			to="LongitudinalSectionQ_HQ1" />
+		<mapping from="longitudinal_section.q" pattern="(HQ2)(\D.*)*"
+			to="LongitudinalSectionQ_HQ2" />
+		<mapping from="longitudinal_section.q" pattern="(HQ5)(\D.*)*"
+			to="LongitudinalSectionQ_HQ5" />
+		<mapping from="longitudinal_section.q" pattern="(HQ10)(\D.*)*"
+			to="LongitudinalSectionQ_HQ10" />
+		<mapping from="longitudinal_section.q" pattern="(HQ20)(\D.*)*"
+			to="LongitudinalSectionQ_HQ20" />
+		<mapping from="longitudinal_section.q" pattern="(HQ25)(\D.*)*"
+			to="LongitudinalSectionQ_HQ25" />
+		<mapping from="longitudinal_section.q" pattern="(HQ50)(\D.*)*"
+			to="LongitudinalSectionQ_HQ50" />
+		<mapping from="longitudinal_section.q" pattern="(HQ100)(\D.*)*"
+			to="LongitudinalSectionQ_HQ100" />
+		<mapping from="longitudinal_section.q" pattern="(HQ200)(\D.*)*"
+			to="LongitudinalSectionQ_HQ200" />
+		<mapping from="longitudinal_section.q" pattern="(HQ500)(\D.*)*"
+			to="LongitudinalSectionQ_HQ500" />
+		<mapping from="longitudinal_section.q" pattern="(HQ1000)(\D.*)*"
+			to="LongitudinalSectionQ_HQ1000" />
+		<mapping from="longitudinal_section.q" pattern="(HQExtrem)(\D.*)*"
+			to="LongitudinalSectionQ_HQExtrem" />
+		<mapping from="longitudinal_section.q" pattern="(HQRZ)(\D.*)*"
+			to="LongitudinalSectionQ_HQRZ" />
+		<mapping from="longitudinal_section.q" pattern="(HSQ)(\D.*)*"
+			to="LongitudinalSectionQ_HSQ" />
+		<mapping from="longitudinal_section.q" pattern="(MHQ)(\D.*)*"
+			to="LongitudinalSectionQ_MHQ" />
+		<mapping from="longitudinal_section.q" pattern="(MNQ)(\D.*)*"
+			to="LongitudinalSectionQ_MNQ" />
+		<mapping from="longitudinal_section.q" pattern="(MQ)(\D.*)*"
+			to="LongitudinalSectionQ_MQ" />
+		<mapping from="longitudinal_section.q" pattern="(NQ)(\D.*)*"
+			to="LongitudinalSectionQ_NQ" />
+		<mapping from="longitudinal_section.q" to="LongitudinalSectionQ" />
+
+		<mapping from="discharge_curve.curve" to="DischargeCurve" />
+		<mapping from="historical_discharge.historicalq" to="HistoricalDischargeCurveQ" />
+		<mapping from="historical_discharge.historicalq.diff" to="HistoricalDischargeCurveQDiff" />
+		<mapping from="cross_section" to="CrossSection" />
+		<mapping from="cross_section_water_line" to="CrossSectionWaterLine" />
+		<mapping from="computed_discharge_curve.q" to="ComputedDischargeCurve" />
+		<mapping from="duration_curve.w" to="DurationCurveW" />
+		<mapping from="duration_curve.q" to="DurationCurveQ" />
+		<mapping from="discharge_longitudinal_section.w" to="DischargeLongitudinalSectionW" />
+		<mapping from="discharge_longitudinal_section.c" to="DischargeLongitudinalSectionC" />
+		<mapping from="discharge_longitudinal_section.q" to="DischargeLongitudinalSectionQ" />
+		<mapping from="computed_discharge_curve.mainvalues.q" to="MainValuesQ" />
+		<mapping from="computed_discharge_curve.mainvalues.w" to="MainValuesW" />
+		<mapping from="duration_curve.mainvalues.q" to="MainValuesQ" />
+		<mapping from="mainvalues.q" to="MainValuesQ" />
+		<mapping from="mainvalues.w" to="MainValuesW" />
+		<mapping from="longitudinal_section.annotations" to="Annotations" />
+		<mapping from="w_differences" to="Differences" />
+		<mapping from="floodmap.wsplgen" to="WSPLGEN" />
+		<mapping from="floodmap.riveraxis" to="RiverAxis" />
+		<mapping from="floodmap.kms" to="Kms" />
+		<mapping from="floodmap.qps" to="Qps" />
+		<mapping from="floodmap.hws" to="Hws" />
+		<mapping from="floodmap.hydr_boundaries" to="HydrBoundariesLines" />
+		<mapping from="floodmap.hydr_boundaries_poly" to="HydrBoundariesPolys" />
+		<mapping from="floodmap.catchment" to="Catchment" />
+		<mapping from="floodmap.floodplain" to="Floodplains" />
+		<mapping from="floodmap.lines" to="FloodmapLines" />
+		<mapping from="floodmap.buildings" to="Buildings" />
+		<mapping from="floodmap.fixpoints" to="Fixpoints" />
+		<mapping from="floodmap.floodmaps" to="Floodmaps" />
+		<mapping from="floodmap.gauge_location" to="GaugeLocation" />
+		<mapping from="other.wq" to="WQPoints" />
+		<mapping from="other.wkms" to="WKms" />
+		<mapping from="other.wqkms" to="WQKms" />
+		<mapping from="other.wqkms.w" to="WQKms" />
+		<mapping from="other.wqkms.q" to="WQKms" />
+		<mapping from="heightmarks_points" to="heightmarks_points" />
+		<mapping from="area" to="Area" />
+		<mapping from="cross_section.area" to="Area" />
+		<mapping from="hyk" to="Hyk" />
+		<mapping from="longitudinal_section.area" to="Area" />
+		<mapping from="longitudinal_section.manualpoints" to="ManualPoints" />
+		<mapping from="cross_section.manualpoints" to="ManualPoints" />
+		<mapping from="cross_section.manualline" to="CrossSectionWaterLine" />
+		<mapping from="computed_discharge_curve.manualpoints" to="ManualPoints" />
+		<mapping from="duration_curve.manualpoints" to="ManualPoints" />
+		<mapping from="wdifferences.manualpoints" to="ManualPoints" />
+		<mapping from="discharge_longitudinal_section.manualpoints"
+			to="ManualPoints" />
+		<mapping from="discharge_curve.manualpoints" to="ManualPoints" />
+		<mapping from="reference_curve.manualpoints" to="ManualPoints" />
+		<mapping from="reference_curve_normalized.manualpoints" to="ManualPoints" />
+		<mapping from="historical_discharge.manualpoints" to="ManualPoints" />
+		<mapping from="manualpoints" to="ManualPoints" />
+		<mapping from="reference_curve" to="ReferenceCurve" />
+		<mapping from="reference_curve_normalized" to="ReferenceCurveNormalized" />
+		<mapping from="flow_velocity.totalchannel" to="FlowVelocityVTotalChannel" />
+		<mapping from="flow_velocity.mainchannel" to="FlowVelocityVMainChannel" />
+		<mapping from="flow_velocity.tau" to="FlowVelocityTau" />
+		<mapping from="bedheight_middle.single" to="MiddleBedHeightSingle" />
+		<mapping from="bedheight_middle.epoch" to="MiddleBedHeightEpoch" />
+		<mapping from="bed_longitudinal_section.porosity_toplayer" to="PorosityTopLayer" />
+		<mapping from="bed_longitudinal_section.porosity_sublayer" to="PorositySubLayer" />
+		<mapping from="bed_longitudinal_section.sediment_density_toplayer" to="DensityTopLayer" />
+		<mapping from="bed_longitudinal_section.sediment_density_sublayer" to="DensitySublayer" />
+		<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" />
+		<mapping from="sq_a_curve" to="SQCurve" />
+		<mapping from="sq_a_outlier_curve" to="SQCurve" />
+		<mapping from="sq_a_outlier_measurement" to="SQMeasurements" />
+		<mapping from="sq_b_measurement" to="SQMeasurements" />
+		<mapping from="sq_b_outlier" to="SQOutliers" />
+		<mapping from="sq_b_curve" to="SQCurve" />
+		<mapping from="sq_b_outlier_curve" to="SQCurve" />
+		<mapping from="sq_b_outlier_measurement" to="SQMeasurements" />
+		<mapping from="sq_c_measurement" to="SQMeasurements" />
+		<mapping from="sq_c_outlier" to="SQOutliers" />
+		<mapping from="sq_c_curve" to="SQCurve" />
+		<mapping from="sq_c_outlier_curve" to="SQCurve" />
+		<mapping from="sq_c_outlier_measurement" to="SQMeasurements" />
+		<mapping from="sq_d_measurement" to="SQMeasurements" />
+		<mapping from="sq_d_outlier" to="SQOutliers" />
+		<mapping from="sq_d_curve" to="SQCurve" />
+		<mapping from="sq_d_outlier_curve" to="SQCurve" />
+		<mapping from="sq_d_outlier_measurement" to="SQMeasurements" />
+		<mapping from="sq_e_measurement" to="SQMeasurements" />
+		<mapping from="sq_e_outlier" to="SQOutliers" />
+		<mapping from="sq_e_curve" to="SQCurve" />
+		<mapping from="sq_e_outlier_curve" to="SQCurve" />
+		<mapping from="sq_e_outlier_measurement" to="SQMeasurements" />
+		<mapping from="sq_f_measurement" to="SQMeasurements" />
+		<mapping from="sq_f_outlier" to="SQOutliers" />
+		<mapping from="sq_f_curve" to="SQCurve" />
+		<mapping from="sq_f_outlier_curve" to="SQCurve" />
+		<mapping from="sq_f_outlier_measurement" to="SQMeasurements" />
+		<mapping from="fix_sector_average_wq_0" to="FixingSectorAverageWQ0" />
+		<mapping from="fix_sector_average_wq_1" to="FixingSectorAverageWQ1" />
+		<mapping from="fix_sector_average_wq_2" to="FixingSectorAverageWQ2" />
+		<mapping from="fix_sector_average_wq_3" to="FixingSectorAverageWQ3" />
+		<mapping from="fix_analysis_events_wq" to="FixingAnalysisEventsWQ" />
+		<mapping from="fix_outlier" to="FixingOutlier" />
+		<mapping from="fix_wq_curve" to="FixingWQCurve" />
+		<mapping from="fix_reference_events_wq" to="FixingReferenceEvents" />
+		<mapping from="fix_sector_average_dwt_0" to="FixingDeltaWtAverage0" />
+		<mapping from="fix_sector_average_dwt_1" to="FixingDeltaWtAverage1" />
+		<mapping from="fix_sector_average_dwt_2" to="FixingDeltaWtAverage2" />
+		<mapping from="fix_sector_average_dwt_3" to="FixingDeltaWtAverage3" />
+		<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" />
+		<mapping from="fix_sector_average_ls_deviation_3" to="FixingSectorDeviationLS3" />
+		<mapping from="fix_sector_average_ls_0" to="FixingLSAverage0" />
+		<mapping from="fix_sector_average_ls_1" to="FixingLSAverage1" />
+		<mapping from="fix_sector_average_ls_2" to="FixingLSAverage2" />
+		<mapping from="fix_sector_average_ls_3" to="FixingLSAverage3" />
+		<mapping from="fix_deviation_ls" to="FixLSDeviation" />
+		<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_curve" to="FixingDerivedCurve" />
+		<mapping from="fix_derivate_curve.manualpoints" to="ManualPoints" />
+		<mapping from="qsectors" to="QSectors" />
+	</mappings>
 </themes>
--- a/flys-artifacts/doc/conf/virtual-themes.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/doc/conf/virtual-themes.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -133,31 +133,14 @@
 
     <!-- Area relevant theme(s) -->
     <theme name="Areas">
-        <inherits>
-            <inherit from="Text" />
-        </inherits>
         <fields>
-            <field name="backgroundcolor" type="Color" display="Texthintergrund"
-                default="255, 255, 255" />
-            <field name="showbackground" type="boolean"
-                display="Hintergrund anzeigen" default="false" />
-            <field name="linecolor" type="Color" display="Linienfarbe"
-                default="Color.BLACK" />
-            <field name="showlines" type="boolean" display="Linie anzeigen"
-                default="true" />
-            <field name="linesize" type="int" display="Liniendicke"
-                default="1" />
-            <field name="linetype" type="Dash" display="Linienart"
-                default="10" />
-            <field name="fillcolor" type="Color" display="Fuellfarbe"
+            <field name="backgroundcolor" type="Color" display="Füllfarbe"
                 default="0, 100, 0" />
-            <field name="showarea" type="boolean" display="Flaeche beschriften"
-                default="false" />
-            <field name="showborder" type="boolean"
-                display="Flaechebegrenzungslinie anzeigen" default="false" />
-            <field name="transparent" type="boolean" display="Transparenz"
-                default="false" />
-            <field name="alpha" type="int" default="255" display="Alpha-Transparenzwert" />
+            <!-- <field name="showbackground" type="boolean"
+                display="Hintergrund anzeigen" default="true" hidden="true" /> //-->
+            <!-- <field name="showborder" type="boolean"
+                display="Flaechebegrenzungslinie anzeigen" default="false" /> //-->
+            <field name="transparency" type="int" default="50" display="Transparenz" />
         </fields>
     </theme>
 
Binary file flys-artifacts/doc/datacage-config-manual/figures/bsh_logo.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/doc/datacage-config-manual/figures/intevation-logo.eps	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,1222 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%For: Frank Koormann,,,
+%%CreationDate: Thu Mar 29 14:37:25 2001
+%%Title: intevation_logo-thin.eps
+%%Creator: Sketch 0.6.8
+%%Pages: 1
+%%BoundingBox: 78 68 132 94
+%%Extensions: CMYK
+%%DocumentSuppliedResources: (atend)
+%%EndComments
+
+%%BeginProlog
+%%BeginResource: procset Linux-Sketch-Procset 1.0 2
+/SketchDict 100 dict def
+SketchDict begin
+/bd { bind def } bind def
+/x { exch } bd
+/xd { exch def } bd
+/PI 3.14159265358979323846264338327 def
+/radgrad { 180 mul PI div } bd
+/skstartmatrix matrix currentmatrix def
+/tmpmat matrix def
+/ISOLatin1Encoding dup where
+{ pop pop }
+{  [/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /space /exclam /quotedbl /numbersign /dollar /percent /ampersand
+/quoteright /parenleft /parenright /asterisk /plus /comma /minus /period
+/slash /zero /one /two /three /four /five /six /seven /eight /nine /colon
+/semicolon /less /equal /greater /question /at /A /B /C /D /E /F /G /H /I /J
+/K /L /M /N /O /P /Q /R /S /T /U /V /W /X /Y /Z /bracketleft /backslash
+/bracketright /asciicircum /underscore /quoteleft /a /b /c /d /e /f /g /h /i
+/j /k /l /m /n /o /p /q /r /s /t /u /v /w /x /y /z /braceleft /bar /braceright
+/asciitilde /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef /.notdef
+/.notdef /.notdef /dotlessi /grave /acute /circumflex /tilde /macron /breve
+/dotaccent /dieresis /.notdef /ring /cedilla /.notdef /hungarumlaut /ogonek
+/caron /space /exclamdown /cent /sterling /currency /yen /brokenbar /section
+/dieresis /copyright /ordfeminine /guillemotleft /logicalnot /hyphen
+/registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu
+/paragraph /periodcentered /cedilla /onesuperior /ordmasculine /guillemotright
+/onequarter /onehalf /threequarters /questiondown /Agrave /Aacute /Acircumflex
+/Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex
+/Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve
+/Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute
+/Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute
+/acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute
+/ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde
+/ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave
+/uacute /ucircumflex /udieresis /yacute /thorn /ydieresis] def
+}
+ifelse
+/arct dup where
+{pop pop}
+{
+/arct {arcto pop pop pop pop} bd
+}
+ifelse
+/size 0 def
+/fontname 0 def
+/newfont 0 def
+/sf {
+/size xd
+/fontname xd
+fontname findfont
+dup /Encoding get StandardEncoding eq
+{
+dup
+length dict /newfont xd
+{
+1 index
+/FID ne
+{ newfont 3 1 roll put }
+{ pop pop }
+ifelse
+} forall
+newfont /Encoding ISOLatin1Encoding put
+fontname newfont definefont
+}
+if
+size scalefont setfont
+} bd
+/pusht {matrix currentmatrix} bd
+/popt {setmatrix} bd
+/pushc {gsave} bd
+/popc {grestore} bd
+/rgb {setrgbcolor} bd
+/w { setlinewidth } bd
+/j { setlinejoin } bd
+/J { setlinecap } bd
+/d { setdash } bd
+/F { eofill } bd
+/f { closepath F } bd
+/S {
+pusht
+skstartmatrix setmatrix stroke 
+popt
+} bd
+/s { closepath S } bd
+/m { moveto } bd
+/l { lineto } bd
+/c { curveto } bd
+/txt {
+/tmpmat tmpmat currentmatrix def
+dup type /arraytype eq {concat} {translate} ifelse
+0 0 m
+tmpmat
+} bd
+/T {txt x show popt} bd
+/P {txt x true charpath popt} bd
+/TP {txt x dup show 0 0 m true charpath popt} bd
+/C {newpath 0 360 arc} bd
+/R {
+2 copy m
+x 2 index l
+x 2 index x l
+l
+closepath
+} bd
+/ellipse { 
+dup type /arraytype eq
+{
+pusht x concat
+0 0 1.0 C 
+popt
+}	
+{
+pusht 5 1 roll
+4 -1 roll concat
+newpath
+dup 2 eq {
+0 0 m 
+} if 
+3 1 roll
+radgrad x
+radgrad x
+0 0 1   5 -2 roll
+arc
+0 ne { closepath } if
+popt
+}
+ifelse
+} bd
+/radius1 0 def
+/radius2 0 def
+/factor 0 def
+/rect {
+dup type /arraytype eq
+{
+pusht x concat
+0 0 m  1 0 l  1 1 l  0 1 l  closepath
+popt
+}
+{
+/radius2 xd
+/radius1 xd
+pusht x concat
+radius1 radius2 div  1  scale
+0 radius2 m
+0 1  radius2 1  radius2  arct
+radius2 radius1 div
+dup 1  1 index 0  radius2  arct
+0  0 0  radius2  arct
+0 0  0 1  radius2 arct
+closepath
+popt
+}
+ifelse
+} bd
+/buf 0 def
+/width 0 def
+/height 0 def
+/skcimg {
+/tmpmat tmpmat currentmatrix def
+{ concat } if
+/height xd
+/width xd
+/buf width 3 mul string def
+width height scale
+width height 8
+[width	 0   0	 height neg	  0  height]
+{ currentfile buf readhexstring pop } bind
+false 3 colorimage
+tmpmat setmatrix
+} bd
+/skgimg {
+/tmpmat tmpmat currentmatrix def
+{ concat } if
+/height xd
+/width xd
+/buf width string def
+width height scale
+width height 8
+[width	 0   0	 height neg	  0  height]
+{ currentfile buf readhexstring pop } bind
+image
+tmpmat setmatrix
+} bd
+/rclip {
+4 2 roll m
+dup 0 x rlineto
+x 0 rlineto
+neg 0 x rlineto
+closepath
+clip
+} bd
+/skeps {
+10 dict begin
+/sk_state save def
+concat
+3 index neg 3 index neg translate
+rclip
+0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin
+10 setmiterlimit [ ] 0 setdash
+newpath
+/sk_dict_count countdictstack def
+/sk_count count 1 sub def
+userdict begin
+/showpage { } def
+/languagelevel where
+{
+pop
+languagelevel 1 ne
+{
+false setstrokeadjust
+false setoverprint
+} if
+} if
+} bd 
+/skepsend {
+count sk_count sub { pop } repeat
+countdictstack sk_dict_count sub { end } repeat
+sk_state restore
+end
+} bd
+/gradidx 0 def
+/gradient { 
+3 mul array
+/gradidx 0 def
+} bd
+/$ {
+3 index gradidx       5 -1 roll put 
+2 index gradidx 1 add 4 -1 roll put 
+1 index gradidx 2 add 3 -1 roll put 
+/gradidx gradidx 3 add def
+} bd
+/! { 
+3 
+{
+dup dup gradidx dup 3 1 roll 3 sub get put
+/gradidx gradidx 1 add def
+}
+repeat
+} bd
+/gradcolor {
+3 mul dup 2 add 1 exch	% idx  1  idx+2
+{
+1 index exch	% array array i
+get		% array component
+exch		% component array
+}
+for
+4 1 roll
+} bd
+/x0 0 def /y0 0 def /x1 0 def /y1 0 def
+/left 0 def /right 0 def /top 0 def /bottom 0 def
+/numcolors 0 def
+/axial	{
+/y1 xd /x1 xd /y0 xd /x0 xd
+dup length 3 idiv /numcolors xd
+pusht exch  % ctm array
+x0 x1 ne y0 y1 ne or
+{
+x0 y0 translate
+[x1 x0 sub  y1 y0 sub	dup neg    2 index    0	    0] concat
+clippath flattenpath pathbbox
+/top xd /right xd /bottom xd /left xd
+newpath
+0 gradcolor rgb clippath f
+0 1 numcolors 1 sub
+{
+dup numcolors div
+3 1 roll
+gradcolor rgb
+exch
+bottom right top R f
+}
+for
+}
+if 
+pop
+popt
+} bd
+/r0 0 def /r1 0 def /dr 0 def
+/radial	{
+/r1 xd /r0 xd /y0 xd /x0 xd
+/dr r1 r0 sub def
+dup length 3 idiv /numcolors xd
+pusht exch  % ctm array
+r0 r1 ne
+{
+x0 y0 translate
+clippath flattenpath pathbbox
+/top xd /right xd /bottom xd /left xd
+newpath
+dr 0 gt {numcolors 1 sub}{0} ifelse gradcolor rgb
+clippath f
+dr 0 gt {numcolors 1 sub -1 0} { 0 1 numcolors 1 sub} ifelse
+{
+dup numcolors div dr mul r0 add
+3 1 roll
+gradcolor rgb
+exch
+0 0 3 -1 roll C f
+}
+for
+}
+if 
+pop
+popt
+} bd
+/max {
+2 copy lt {exch} if pop
+} bd
+/conical {
+pusht 5 1 roll
+3 1 roll /y0 xd /x0 xd
+x0 y0 translate
+radgrad rotate
+dup length 3 idiv /numcolors xd
+clippath flattenpath pathbbox newpath
+4 { abs 4 1 roll} repeat
+3 { max } repeat
+2 mul
+dup scale
+0 gradcolor rgb
+0 0 1 0 360 arc f
+1 1 numcolors 1 sub
+{
+dup numcolors div 180 mul
+3 1 roll
+gradcolor rgb
+exch
+0 0 moveto
+0 0 1  4 -1 roll  dup neg  arc
+closepath f
+}
+for
+pop
+popt
+} bd
+/XStep 0 def /YStep 0 def /imagedata 0 def /components 0 def
+/tileimage2 {
+exch 4 2 roll
+/height xd
+/width xd
+mark
+/components 2 index
+/PatternType 1
+/PaintType 1
+/TilingType 1
+/BBox [0 0 width height]
+/XStep width
+/YStep height
+/PaintProc {
+begin
+XStep YStep 8
+matrix
+imagedata
+false
+components
+colorimage
+end
+}
+counttomark 2 div cvi dup dict begin
+{ def } repeat
+pop currentdict end
+dup
+/imagedata
+4 -1 roll
+width height mul mul string
+currentfile exch readhexstring pop
+put
+exch
+makepattern
+setpattern
+clippath
+eofill
+} bd
+/tileimage1 {
+concat
+/components xd
+/height xd
+/width xd
+/imagedata
+currentfile
+width height mul components mul string
+readhexstring pop
+def
+clippath flattenpath pathbbox
+/top xd /right xd /bottom xd /left xd
+left width div floor width mul
+bottom height div floor height mul
+translate
+top bottom sub height div ceiling cvi
+{
+gsave
+right left sub width div ceiling cvi
+{
+width height 8 matrix
+components 1 eq
+{
+{ imagedata }
+image
+}
+{
+imagedata
+false components
+colorimage
+}
+ifelse
+width 0 translate
+}
+repeat
+grestore
+0 height translate
+}
+repeat
+} bd
+/makepattern where
+{
+pop
+/tileimage /tileimage2 load def
+}
+{
+/tileimage /tileimage1 load def
+}
+ifelse
+end
+%%EndResource
+%%EndProlog
+
+%%BeginSetup
+
+10.433 setmiterlimit
+%%EndSetup
+
+%%Page: 1 1
+SketchDict begin
+newpath
+81.1479 90.3363 m
+83.1262 89.4518 85.8962 89.4399 87.7755 90.732 c
+88.4885 91.2221 89.1744 91.8548 89.1744 92.7451 c
+89.3805 92.7446 89.5146 92.3854 89.7059 92.4617 c
+90.3588 92.7216 91.0745 92.5334 91.5725 92.3012 c
+91.8169 92.1873 92.0442 92.7366 92.3141 92.7358 c
+92.4246 92.4106 93.2359 91.4866 93.2359 91.4372 c
+95.3948 89.4748 99.2768 88.555 102.019 89.186 c
+102.881 89.3844 110.268 92.0436 110.268 92.7837 c
+110.735 92.6454 111.042 92.3763 111.801 92.3588 c
+113.208 92.7366 l
+114.425 92.9532 114.356 92.6862 114.93 92.6609 c
+114.93 90.5837 114.005 87.8389 114.95 85.8136 c
+115.043 85.6129 115.327 85.1931 115.474 85.044 c
+119.365 81.1112 125.41 82.6691 129.868 84.5493 c
+129.868 84.4181 130.124 84.2636 130.124 84.1323 c
+130.124 83.9504 129.868 83.7916 129.868 83.6096 c
+129.521 83.6096 129.294 83.4821 129.005 83.2726 c
+126.771 81.6517 123.827 80.5003 121.756 78.5645 c
+121.551 78.3735 121.558 78.1688 121.558 77.872 c
+121.756 77.6246 122.036 77.2541 122.315 77.061 c
+122.399 77.0029 122.564 76.8961 124.449 75.877 c
+126.015 75.0309 127.68 74.6575 129.194 74.6604 c
+129.194 74.475 129.046 74.2851 129.051 74.0807 c
+129.052 74.0297 129.066 73.9744 129.086 73.9171 c
+129.106 73.8599 129.132 73.8003 129.158 73.7411 c
+129.183 73.6819 129.209 73.6226 129.227 73.5659 c
+129.245 73.5087 129.255 73.4539 129.252 73.4038 c
+129.238 73.1617 129.151 72.9814 129.076 72.7773 c
+126.75 73.9407 124.211 75.0082 121.611 75.7449 c
+120.232 76.1358 118.876 76.4938 117.501 76.7872 c
+116.305 77.0426 113.981 77.2912 113.298 75.7452 c
+112.578 74.1158 113.329 72.4451 113.544 70.8622 c
+113.245 70.9989 113.04 71.6163 112.826 71.3291 c
+112.556 70.799 l
+112.21 71.5408 111.908 72.5375 111.698 73.3754 c
+111.413 74.5161 110.852 75.2644 109.473 75.4597 c
+107.323 75.7648 107.541 75.5249 106.808 75.0986 c
+105.489 74.3316 104.447 72.6469 104.427 70.7633 c
+104.103 70.8166 104.04 71.1029 103.715 71.1562 c
+103.661 71.1361 103.594 71.1001 103.521 71.0624 c
+103.448 71.0247 103.368 70.985 103.288 70.9575 c
+103.209 70.9303 103.129 70.9147 103.056 70.9254 c
+102.983 70.9359 102.916 70.9725 102.862 71.049 c
+102.814 71.2619 102.513 71.4476 102.165 71.1947 c
+101.229 70.799 l
+101.108 71.1117 100.582 71.3382 100.316 71.5037 c
+99.0659 72.2807 97.0528 71.5295 96.2781 70.5102 c
+96.093 70.57 95.9079 70.6298 95.7225 70.6896 c
+95.5289 70.7905 95.2567 70.9099 94.8114 70.6321 c
+94.4917 70.5802 l
+94.4917 70.8373 94.9407 70.8557 95.0994 71.1094 c
+95.4787 71.7155 95.856 72.5599 96.434 73.236 c
+97.4233 74.3934 98.3768 75.7545 97.6356 77.2578 c
+97.415 77.7045 97.576 77.5078 96.6749 78.2941 c
+96.1414 78.7598 95.3594 79.3486 94.7173 79.6468 c
+91.9201 80.9465 88.4556 81.0936 85.1714 80.6681 c
+83.4604 80.4467 81.7831 80.1902 80.3068 79.6031 c
+80.2609 79.585 80.3031 79.5122 80.2535 79.5122 c
+80.306 79.6936 80.6359 79.9461 80.4556 80.0496 c
+80.2343 80.1389 80.2481 80.2886 80.2552 80.4833 c
+80.2731 80.7971 l
+80.4213 80.7971 80.3077 80.824 80.4554 80.8396 c
+82.6332 81.0712 84.5517 81.7552 86.5887 82.4718 c
+87.2231 82.6952 87.987 83.0019 88.527 83.452 c
+88.8771 83.744 89.3216 84.2214 89.3216 84.6667 c
+89.3216 85.0624 88.8949 85.959 88.6166 86.1815 c
+86.4209 87.9381 80.8845 88.8736 80.8346 88.9422 c
+80.7828 89.0136 l
+80.7856 89.1103 81.0512 89.1729 81.1198 89.3575 c
+81.1731 89.5006 81.0506 89.7858 81.1017 89.9232 c
+81.1924 90.1679 81.2247 90.3363 81.1479 90.3363 c
+closepath
+gsave
+0.9 0.9 0.9 rgb
+F
+grestore
+0.9 0.9 0.9 rgb
+0.215433 w
+0 j
+0 J
+[] 0 d
+S
+newpath
+108.203 84.2032 m
+107.659 84.1536 106.67 83.9557 106.373 83.5107 c
+106.324 83.5107 106.274 83.4611 106.274 83.4118 c
+106.126 83.3622 106.027 82.9665 105.829 82.8675 c
+105.829 82.1257 105.533 81.4828 106.126 80.8396 c
+106.225 80.7407 l
+106.423 80.6914 l
+107.907 79.8999 109.341 79.9989 110.726 80.8892 c
+110.776 80.9882 l
+110.875 81.0375 111.072 81.3343 111.27 81.3343 c
+111.27 81.8782 111.765 82.4225 111.418 83.115 c
+111.32 83.3129 110.825 83.4611 110.825 83.659 c
+110.726 83.659 110.132 84.0054 110.132 84.0547 c
+109.935 84.0547 l
+109.737 84.2525 108.401 84.2525 108.203 84.2032 c
+closepath
+gsave
+0.8 0.8 0.8 rgb
+F
+grestore
+0.7 0.7 0.7 rgb
+0.566929 w
+0 j
+0 J
+[] 0 d
+S
+newpath
+129.218 74.6074 m
+126.745 74.9042 123.636 75.6956 121.805 77.5256 c
+121.657 77.6742 121.459 78.0203 121.459 78.2677 c
+121.558 78.3171 l
+121.558 78.3667 121.757 78.5634 121.805 78.6139 c
+123.135 79.9966 125.128 80.6576 126.673 81.7561 c
+128.047 82.7323 129.427 83.5107 129.67 83.5107 c
+129.775 83.5629 130.033 83.615 130.115 83.659 c
+129.109 72.8173 m
+127.427 73.3119 125.912 74.363 124.229 74.9042 c
+121.542 75.7684 l
+120.528 76.0947 119.51 76.4014 118.523 76.5599 c
+116.741 76.8465 115.229 77.6229 113.743 76.2892 c
+112.805 75.4467 113.006 74.657 113.006 73.4205 c
+113.121 72.9094 113.569 71.2846 113.569 70.7888 c
+112.54 70.8024 m
+111.897 72.0885 111.86 74.2406 110.585 75.1462 c
+109.981 75.576 107.912 75.6808 107.214 75.4484 c
+106.724 75.2851 106.373 74.7559 106.027 74.4095 c
+105.087 73.4698 104.431 72.0363 104.431 70.7009 c
+101.387 70.7216 m
+100.435 71.9918 98.2462 72.4301 97.0247 71.1409 c
+96.8801 71.0068 96.6052 70.7772 96.0915 70.388 c
+94.588 70.6593 m
+95.3302 71.0054 95.6213 71.8212 95.9603 72.5171 c
+96.561 73.7499 98.571 75.6363 97.6602 77.1169 c
+97.3518 77.6183 l
+97.063 78.124 95.8361 79.0019 95.7069 79.1312 c
+95.509 79.329 94.9892 79.5357 94.7496 79.6525 c
+90.7346 81.6135 86.2429 80.9354 82.0379 80.1471 c
+81.4945 80.0454 80.7354 79.496 80.1915 79.496 c
+80.855 88.9875 m
+81.4486 88.839 81.943 88.619 82.5326 88.4566 c
+83.9216 88.0751 85.6935 87.8542 86.9841 87.1708 c
+87.3753 86.9639 87.8251 86.5772 88.2209 86.3794 c
+88.9627 86.0333 89.3091 85.2418 89.2595 84.4008 c
+89.2595 84.2032 88.8592 83.7624 88.7155 83.6096 c
+88.0678 82.9214 86.6839 82.482 85.7972 82.175 c
+84.1118 81.5919 82.1369 80.7407 80.3068 80.7407 c
+80.2575 80.6914 l
+81.2564 90.302 m
+81.7865 90.031 81.8707 90.1115 82.3007 89.9334 c
+83.7949 89.3152 85.8009 89.932 87.1823 90.5344 c
+88.1222 90.944 89.2116 91.7442 89.2116 92.8407 c
+92.2753 92.7032 m
+92.9678 91.6646 93.7564 90.8221 94.8982 90.2869 c
+95.3392 90.0803 95.9901 89.7098 96.481 89.5944 c
+98.5129 89.1165 100.233 88.7908 102.318 89.1987 c
+102.511 89.2367 102.58 89.2282 103.109 89.3966 c
+105.253 90.0783 107.678 91.2292 109.638 92.3148 c
+109.697 92.3474 110.336 92.8129 110.352 92.8129 c
+114.93 92.7352 m
+114.815 91.7541 114.609 90.9627 114.61 90.427 c
+114.611 88.8645 114.327 87.8086 114.634 86.6268 c
+115.198 84.4504 118.458 82.8638 119.975 82.7193 c
+123.178 82.4137 126.158 83.2958 129.076 84.3515 c
+129.123 84.3682 129.274 84.4008 129.373 84.4008 c
+129.423 84.4997 129.818 84.6483 129.967 84.6483 c
+0.8 0.8 0.8 rgb
+1 j
+1 J
+S
+newpath
+81.6246 86.9766 m
+82.6698 86.9766 l
+82.6698 79.2655 l
+81.6246 79.2655 l
+81.6246 86.9766 l
+closepath
+84.0446 82.4667 m
+84.0446 82.7598 84.0959 83.0368 84.1988 83.297 c
+84.3014 83.5575 84.4553 83.8013 84.6606 84.0286 c
+84.8734 84.2486 85.1226 84.4155 85.4086 84.5292 c
+85.6946 84.6429 86.0209 84.6996 86.3877 84.6996 c
+86.4464 84.6996 86.5104 84.6959 86.5802 84.6885 c
+86.6499 84.6811 86.725 84.6704 86.8058 84.6556 c
+86.8863 84.6409 86.9688 84.6227 87.0533 84.6006 c
+87.1375 84.5785 87.2236 84.5493 87.3118 84.5125 c
+87.4657 84.4467 87.6123 84.3622 87.7517 84.2596 c
+87.8909 84.157 88.0267 84.0323 88.1588 83.8857 c
+88.2906 83.7463 88.3898 83.5739 88.4559 83.3687 c
+88.5216 83.1632 88.5548 82.9285 88.5548 82.6646 c
+88.5548 82.6572 88.5548 82.6481 88.5548 82.6371 c
+88.5548 82.626 88.5548 82.6133 88.5548 82.5985 c
+88.5548 82.5911 88.5548 82.5821 88.5548 82.571 c
+88.5548 82.56 88.5548 82.5472 88.5548 82.5325 c
+88.5548 79.2655 l
+87.5097 79.2655 l
+87.5097 82.3786 l
+87.5097 82.5398 87.4858 82.6994 87.4382 82.857 c
+87.3906 83.0146 87.3192 83.1632 87.2236 83.3026 c
+87.1284 83.4492 87.0037 83.5592 86.8497 83.6326 c
+86.6958 83.706 86.5124 83.7426 86.2998 83.7426 c
+86.1017 83.7426 85.9276 83.7097 85.7771 83.6437 c
+85.6269 83.5776 85.4968 83.4787 85.3868 83.3466 c
+85.2768 83.2145 85.1906 83.0733 85.1283 82.9231 c
+85.0659 82.7729 85.0237 82.6133 85.0016 82.4446 c
+85.0016 79.2655 l
+84.0446 79.2655 l
+84.0446 82.4667 l
+closepath
+89.6767 85.8436 m
+90.7108 85.8436 l
+90.7108 84.5456 l
+92.7126 84.5456 l
+92.7126 83.5997 l
+90.7108 83.5997 l
+90.7108 80.9156 l
+90.7108 80.813 90.7179 80.7211 90.7326 80.6406 c
+90.7474 80.5598 90.7695 80.483 90.7987 80.4096 c
+90.8279 80.3362 90.8922 80.2832 90.9912 80.25 c
+91.0901 80.2171 91.2276 80.2007 91.4036 80.2007 c
+92.6248 80.2225 l
+92.6248 79.2655 l
+91.3268 79.2655 l
+91.3194 79.2655 91.312 79.2655 91.3047 79.2655 c
+91.2973 79.2655 91.2899 79.2655 91.2826 79.2655 c
+91.2755 79.2655 91.2698 79.2655 91.2661 79.2655 c
+91.2624 79.2655 91.2571 79.2619 91.2497 79.2545 c
+91.2423 79.2545 91.2349 79.2545 91.2276 79.2545 c
+91.2205 79.2545 91.2131 79.2545 91.2057 79.2545 c
+91.1984 79.2545 91.193 79.2545 91.1893 79.2545 c
+91.1856 79.2545 91.18 79.2545 91.1726 79.2545 c
+90.9234 79.2545 90.7071 79.2913 90.5237 79.3645 c
+90.3403 79.4379 90.1901 79.5516 90.0727 79.7055 c
+89.9554 79.8597 89.8655 80.0247 89.8032 80.2007 c
+89.7408 80.3764 89.7023 80.5598 89.6878 80.7506 c
+89.6804 80.7654 89.6767 80.7818 89.6767 80.7999 c
+89.6767 80.8184 89.6767 80.8385 89.6767 80.8606 c
+89.6767 80.8753 89.6767 80.8918 89.6767 80.9099 c
+89.6767 80.9283 89.6767 80.9485 89.6767 80.9706 c
+89.6767 80.9927 l
+89.6767 85.8436 l
+closepath
+96.7829 83.1595 m
+96.7682 83.1669 96.7534 83.1762 96.7387 83.187 c
+96.7242 83.198 96.7095 83.2145 96.6948 83.2366 c
+96.68 83.2513 96.6636 83.2695 96.6454 83.2916 c
+96.627 83.3137 96.6069 83.3355 96.5848 83.3576 c
+96.5629 83.3724 96.5388 83.3888 96.5133 83.407 c
+96.4875 83.4254 96.4637 83.4455 96.4419 83.4676 c
+96.4124 83.4824 96.3832 83.4988 96.3537 83.5172 c
+96.3246 83.5354 96.2914 83.5518 96.2548 83.5666 c
+96.1814 83.6031 96.0952 83.6289 95.9963 83.6437 c
+95.8974 83.6584 95.7854 83.6655 95.6607 83.6655 c
+95.3747 83.6655 95.1235 83.6142 94.9072 83.5116 c
+94.6909 83.4089 94.5095 83.2587 94.3627 83.0606 c
+94.2161 82.8627 94.1062 82.6535 94.0327 82.4335 c
+93.9593 82.2136 93.9228 81.9862 93.9228 81.7515 c
+93.9228 81.7442 93.9228 81.7368 93.9228 81.7297 c
+93.9228 81.7186 l
+93.9228 81.5058 93.9613 81.3025 94.0384 81.1081 c
+94.1152 80.9136 94.2272 80.7285 94.3737 80.5525 c
+94.5206 80.3764 94.702 80.2446 94.9183 80.1565 c
+95.1346 80.0686 95.382 80.0247 95.6607 80.0247 c
+95.9614 80.0247 96.2126 80.0592 96.4144 80.129 c
+96.616 80.1987 96.7682 80.3033 96.8708 80.4425 c
+96.9734 80.5893 97.0669 80.7617 97.1514 80.9595 c
+97.2356 81.1577 97.3107 81.3813 97.3768 81.6305 c
+97.3768 81.6415 l
+97.3878 81.6526 l
+97.3878 81.6637 l
+98.3448 81.6087 l
+98.3448 81.5939 98.3448 81.5812 98.3448 81.5701 c
+98.3448 81.5591 98.3485 81.55 98.3559 81.5426 c
+98.3559 81.5279 98.3559 81.5168 98.3559 81.5094 c
+98.3559 81.5024 98.3559 81.4913 98.3559 81.4766 c
+98.3559 81.4692 98.3559 81.4601 98.3559 81.4491 c
+98.3559 81.438 98.3595 81.4289 98.3669 81.4216 c
+98.3669 81.4068 98.3669 81.3958 98.3669 81.3887 c
+98.3669 81.3813 98.3669 81.374 98.3669 81.3666 c
+98.3669 81.3079 98.3632 81.2475 98.3559 81.1852 c
+98.3485 81.1228 98.3374 81.0585 98.323 80.9927 c
+98.3156 80.9632 98.3063 80.9303 98.2952 80.8935 c
+98.2844 80.8569 98.2751 80.824 98.2677 80.7946 c
+98.2532 80.758 98.2402 80.7231 98.2294 80.69 c
+98.2184 80.6571 98.2056 80.6222 98.1909 80.5856 c
+98.1027 80.4022 97.9854 80.2225 97.8388 80.0465 c
+97.6923 79.8705 97.5126 79.7055 97.3 79.5516 c
+97.0944 79.3976 96.8543 79.282 96.5794 79.2052 c
+96.3044 79.1281 95.9983 79.0895 95.6607 79.0895 c
+95.272 79.0895 94.9129 79.1502 94.5827 79.2709 c
+94.2527 79.392 93.9559 79.5774 93.6917 79.8265 c
+93.4205 80.0833 93.2189 80.3711 93.0868 80.69 c
+92.9547 81.0091 92.8887 81.3629 92.8887 81.7515 c
+92.8887 82.1623 92.9437 82.5254 93.0536 82.8406 c
+93.1636 83.1558 93.3289 83.4274 93.5489 83.6547 c
+93.7688 83.882 93.9999 84.0688 94.2417 84.2157 c
+94.4837 84.3622 94.7369 84.4685 95.0008 84.5346 c
+95.0303 84.542 95.0577 84.5473 95.0833 84.551 c
+95.1091 84.5547 95.1366 84.5604 95.1657 84.5675 c
+95.1952 84.5675 95.2227 84.5695 95.2482 84.5731 c
+95.274 84.5768 95.3015 84.5822 95.3307 84.5896 c
+95.3894 84.5969 95.4464 84.6023 95.5014 84.606 c
+95.5564 84.6097 95.6094 84.6117 95.6607 84.6117 c
+95.9614 84.6117 96.2421 84.5695 96.5023 84.485 c
+96.7628 84.4008 97.0029 84.2744 97.2229 84.1057 c
+97.4354 83.937 97.6279 83.75 97.8003 83.5447 c
+97.9726 83.3392 98.1248 83.1192 98.2569 82.8845 c
+94.6158 80.9156 l
+94.1867 81.6855 l
+96.7829 83.1595 l
+closepath
+99.6431 84.5456 m
+101.282 80.3875 l
+102.756 84.5456 l
+103.889 84.5456 l
+102.063 79.7826 l
+102.019 79.6726 101.969 79.5791 101.914 79.502 c
+101.859 79.4251 101.799 79.3608 101.733 79.3095 c
+101.667 79.2655 101.599 79.229 101.53 79.1995 c
+101.46 79.1703 101.385 79.1519 101.304 79.1445 c
+101.297 79.1445 101.291 79.1445 101.287 79.1445 c
+101.284 79.1445 101.278 79.1445 101.271 79.1445 c
+101.264 79.1445 101.256 79.1445 101.249 79.1445 c
+101.168 79.1445 101.09 79.1556 101.012 79.1777 c
+100.935 79.1995 100.857 79.2327 100.776 79.2766 c
+100.703 79.3353 100.637 79.403 100.578 79.4801 c
+100.519 79.5569 100.468 79.6505 100.424 79.7605 c
+98.5101 84.5456 l
+99.6431 84.5456 l
+closepath
+108.388 82.3015 m
+108.388 82.463 108.357 82.6223 108.294 82.7802 c
+108.232 82.9378 108.139 83.0864 108.014 83.2255 c
+107.889 83.3724 107.713 83.4824 107.486 83.5555 c
+107.259 83.6289 106.984 83.6655 106.661 83.6655 c
+106.609 83.6655 106.556 83.6618 106.501 83.6547 c
+106.447 83.6473 106.386 83.6363 106.32 83.6215 c
+106.254 83.6142 106.188 83.5997 106.122 83.5776 c
+106.056 83.5555 105.99 83.5263 105.924 83.4897 c
+105.807 83.4381 105.693 83.3667 105.583 83.2751 c
+105.473 83.1833 105.367 83.0753 105.264 82.9506 c
+105.169 82.8332 105.092 82.6884 105.033 82.516 c
+104.974 82.3437 104.938 82.1475 104.923 81.9276 c
+104.923 81.6342 104.963 81.3793 105.044 81.1631 c
+105.125 80.9468 105.245 80.7654 105.407 80.6185 c
+105.576 80.4793 105.75 80.3674 105.929 80.2832 c
+106.109 80.1987 106.298 80.1454 106.496 80.1236 c
+106.503 80.1236 106.513 80.1236 106.523 80.1236 c
+106.534 80.1236 106.544 80.1236 106.551 80.1236 c
+106.566 80.1162 106.578 80.1125 106.589 80.1125 c
+106.6 80.1125 106.609 80.1125 106.617 80.1125 c
+106.632 80.1125 106.643 80.1125 106.65 80.1125 c
+106.657 80.1125 106.668 80.1125 106.683 80.1125 c
+106.69 80.1125 106.699 80.1125 106.71 80.1125 c
+106.721 80.1125 106.731 80.1125 106.738 80.1125 c
+106.826 80.1125 106.909 80.1179 106.985 80.129 c
+107.062 80.14 107.138 80.1602 107.211 80.1896 c
+107.248 80.2041 107.282 80.2188 107.315 80.2336 c
+107.348 80.2483 107.383 80.2628 107.42 80.2775 c
+107.449 80.2996 107.482 80.3214 107.519 80.3436 c
+107.556 80.3657 107.589 80.3912 107.618 80.4207 c
+107.655 80.4425 107.689 80.47 107.722 80.5032 c
+107.756 80.536 107.79 80.5672 107.827 80.5967 c
+107.864 80.6333 107.9 80.6681 107.937 80.701 c
+107.974 80.7342 108.01 80.7688 108.047 80.8056 c
+108.047 79.6066 l
+108.04 79.5918 108.032 79.5808 108.025 79.5737 c
+108.025 79.5626 l
+107.937 79.5039 107.845 79.4506 107.75 79.403 c
+107.655 79.3554 107.556 79.3132 107.453 79.2766 c
+107.35 79.2471 107.225 79.2233 107.079 79.2052 c
+106.932 79.1867 106.764 79.1777 106.573 79.1777 c
+106.566 79.1777 106.56 79.1777 106.556 79.1777 c
+106.553 79.1777 106.547 79.1777 106.54 79.1777 c
+106.533 79.1777 106.522 79.1777 106.507 79.1777 c
+106.5 79.1777 106.492 79.1777 106.485 79.1777 c
+106.478 79.1777 106.47 79.1777 106.463 79.1777 c
+106.456 79.1777 106.45 79.1777 106.447 79.1777 c
+106.443 79.1777 106.437 79.1777 106.43 79.1777 c
+106.092 79.1777 105.779 79.238 105.49 79.3591 c
+105.2 79.4801 104.934 79.6652 104.692 79.9147 c
+104.45 80.1712 104.268 80.4663 104.147 80.7999 c
+104.026 81.1339 103.966 81.5094 103.966 81.9276 c
+103.966 82.2944 104.025 82.6354 104.142 82.9506 c
+104.259 83.2658 104.435 83.5555 104.67 83.8197 c
+104.904 84.0836 105.194 84.2817 105.539 84.4135 c
+105.884 84.5456 106.283 84.6117 106.738 84.6117 c
+107.17 84.6117 107.556 84.553 107.893 84.4357 c
+108.23 84.3183 108.513 84.1423 108.74 83.9076 c
+108.975 83.6729 109.149 83.4254 109.262 83.1652 c
+109.376 82.9047 109.433 82.6354 109.433 82.3564 c
+109.433 79.2655 l
+108.388 79.2655 l
+108.388 82.3015 l
+closepath
+110.467 85.8436 m
+111.501 85.8436 l
+111.501 84.5456 l
+113.503 84.5456 l
+113.503 83.5997 l
+111.501 83.5997 l
+111.501 80.9156 l
+111.501 80.813 111.508 80.7211 111.523 80.6406 c
+111.538 80.5598 111.56 80.483 111.589 80.4096 c
+111.618 80.3362 111.683 80.2832 111.782 80.25 c
+111.881 80.2171 112.018 80.2007 112.194 80.2007 c
+113.415 80.2225 l
+113.415 79.2655 l
+112.117 79.2655 l
+112.11 79.2655 112.102 79.2655 112.095 79.2655 c
+112.088 79.2655 112.08 79.2655 112.073 79.2655 c
+112.066 79.2655 112.06 79.2655 112.057 79.2655 c
+112.053 79.2655 112.047 79.2619 112.04 79.2545 c
+112.033 79.2545 112.025 79.2545 112.018 79.2545 c
+112.011 79.2545 112.004 79.2545 111.996 79.2545 c
+111.989 79.2545 111.983 79.2545 111.98 79.2545 c
+111.976 79.2545 111.97 79.2545 111.963 79.2545 c
+111.714 79.2545 111.498 79.2913 111.314 79.3645 c
+111.131 79.4379 110.981 79.5516 110.863 79.7055 c
+110.746 79.8597 110.656 80.0247 110.594 80.2007 c
+110.531 80.3764 110.493 80.5598 110.478 80.7506 c
+110.471 80.7654 110.467 80.7818 110.467 80.7999 c
+110.467 80.8184 110.467 80.8385 110.467 80.8606 c
+110.467 80.8753 110.467 80.8918 110.467 80.9099 c
+110.467 80.9283 110.467 80.9485 110.467 80.9706 c
+110.467 80.9927 l
+110.467 85.8436 l
+closepath
+114.449 84.5456 m
+115.406 84.5456 l
+115.406 79.2655 l
+114.449 79.2655 l
+114.449 84.5456 l
+closepath
+114.372 85.7665 m
+114.372 85.8473 114.387 85.9224 114.416 85.9922 c
+114.446 86.0619 114.493 86.1223 114.559 86.1736 c
+114.618 86.2175 114.682 86.2524 114.752 86.2782 c
+114.821 86.3037 114.893 86.3167 114.966 86.3167 c
+115.047 86.3167 115.12 86.3057 115.186 86.2836 c
+115.252 86.2617 115.318 86.2249 115.384 86.1736 c
+115.45 86.1223 115.5 86.0619 115.533 85.9922 c
+115.566 85.9224 115.582 85.8399 115.582 85.7447 c
+115.582 85.6492 115.566 85.565 115.533 85.4916 c
+115.5 85.4181 115.454 85.3561 115.395 85.3045 c
+115.329 85.2532 115.263 85.2166 115.197 85.1945 c
+115.131 85.1727 115.062 85.1616 114.988 85.1616 c
+114.915 85.1542 114.842 85.1616 114.768 85.1837 c
+114.695 85.2055 114.625 85.2424 114.559 85.2937 c
+114.493 85.345 114.446 85.4091 114.416 85.4862 c
+114.387 85.563 114.372 85.6492 114.372 85.7447 c
+114.372 85.7665 l
+closepath
+116.792 82.0375 m
+116.792 82.4409 116.862 82.804 117.001 83.1266 c
+117.14 83.4492 117.346 83.7315 117.617 83.9736 c
+117.896 84.2157 118.191 84.3971 118.503 84.5181 c
+118.814 84.6392 119.143 84.6996 119.487 84.6996 c
+119.502 84.6996 119.518 84.6996 119.537 84.6996 c
+119.555 84.6996 119.571 84.6996 119.586 84.6996 c
+119.601 84.6922 119.617 84.6885 119.636 84.6885 c
+119.654 84.6885 119.674 84.6885 119.696 84.6885 c
+119.711 84.6885 119.727 84.6885 119.746 84.6885 c
+119.764 84.6885 119.784 84.6885 119.806 84.6885 c
+119.821 84.6811 119.837 84.6777 119.856 84.6777 c
+119.874 84.6777 119.89 84.6777 119.905 84.6777 c
+120.199 84.6335 120.479 84.5473 120.747 84.4192 c
+121.014 84.2908 121.273 84.1202 121.522 83.9076 c
+121.764 83.6876 121.947 83.4126 122.072 83.0827 c
+122.197 82.7527 122.259 82.3675 122.259 81.9276 c
+122.259 81.8984 122.259 81.8689 122.259 81.8397 c
+122.259 81.8102 122.256 81.7847 122.248 81.7626 c
+122.248 81.7331 122.246 81.7039 122.243 81.6747 c
+122.239 81.6452 122.237 81.616 122.237 81.5865 c
+122.23 81.5279 122.221 81.4692 122.21 81.4105 c
+122.199 81.3518 122.186 81.2932 122.171 81.2345 c
+122.105 80.9706 122.004 80.7194 121.869 80.481 c
+121.733 80.2426 121.559 80.0173 121.346 79.8044 c
+121.141 79.5918 120.895 79.4342 120.609 79.3316 c
+120.323 79.229 120.004 79.1777 119.652 79.1777 c
+119.153 79.1777 118.723 79.2454 118.36 79.3809 c
+117.997 79.5167 117.701 79.7239 117.474 80.0025 c
+117.247 80.2812 117.076 80.5893 116.962 80.9266 c
+116.849 81.264 116.792 81.6268 116.792 82.0154 c
+116.792 82.0375 l
+closepath
+117.837 82.0375 m
+117.837 81.9789 117.837 81.9259 117.837 81.878 c
+117.837 81.8303 117.841 81.781 117.848 81.7297 c
+117.855 81.6781 117.865 81.6288 117.876 81.5812 c
+117.887 81.5335 117.896 81.4839 117.903 81.4326 c
+117.94 81.2713 117.999 81.1134 118.079 80.9595 c
+118.16 80.8056 118.259 80.6588 118.376 80.5196 c
+118.501 80.3801 118.655 80.2775 118.838 80.2115 c
+119.022 80.1454 119.238 80.1125 119.487 80.1125 c
+119.722 80.1125 119.942 80.1454 120.147 80.2115 c
+120.352 80.2775 120.54 80.3764 120.708 80.5085 c
+120.877 80.6406 121.003 80.8331 121.088 81.086 c
+121.172 81.3391 121.214 81.6489 121.214 82.0154 c
+121.214 82.2722 121.178 82.505 121.104 82.7142 c
+121.031 82.9231 120.921 83.1082 120.774 83.2695 c
+120.627 83.4237 120.446 83.541 120.23 83.6215 c
+120.013 83.7023 119.766 83.7426 119.487 83.7426 c
+119.223 83.7426 118.996 83.7077 118.805 83.638 c
+118.615 83.5685 118.457 83.4603 118.332 83.3137 c
+118.207 83.1742 118.107 83.024 118.03 82.8627 c
+117.953 82.7011 117.899 82.5362 117.87 82.3675 c
+117.863 82.3383 117.855 82.3088 117.848 82.2796 c
+117.841 82.2501 117.837 82.2209 117.837 82.1915 c
+117.837 82.1623 117.837 82.1328 117.837 82.1036 c
+117.837 82.0741 117.837 82.0449 117.837 82.0154 c
+117.837 82.0375 l
+closepath
+123.205 82.4667 m
+123.205 82.7598 123.257 83.0368 123.359 83.297 c
+123.462 83.5575 123.616 83.8013 123.821 84.0286 c
+124.034 84.2486 124.283 84.4155 124.569 84.5292 c
+124.855 84.6429 125.182 84.6996 125.548 84.6996 c
+125.607 84.6996 125.671 84.6959 125.741 84.6885 c
+125.811 84.6811 125.886 84.6704 125.966 84.6556 c
+126.047 84.6409 126.129 84.6227 126.214 84.6006 c
+126.298 84.5785 126.384 84.5493 126.472 84.5125 c
+126.626 84.4467 126.773 84.3622 126.912 84.2596 c
+127.052 84.157 127.187 84.0323 127.319 83.8857 c
+127.451 83.7463 127.55 83.5739 127.616 83.3687 c
+127.682 83.1632 127.715 82.9285 127.715 82.6646 c
+127.715 82.6572 127.715 82.6481 127.715 82.6371 c
+127.715 82.626 127.715 82.6133 127.715 82.5985 c
+127.715 82.5911 127.715 82.5821 127.715 82.571 c
+127.715 82.56 127.715 82.5472 127.715 82.5325 c
+127.715 79.2655 l
+126.67 79.2655 l
+126.67 82.3786 l
+126.67 82.5398 126.646 82.6994 126.599 82.857 c
+126.551 83.0146 126.48 83.1632 126.384 83.3026 c
+126.289 83.4492 126.164 83.5592 126.01 83.6326 c
+125.856 83.706 125.673 83.7426 125.46 83.7426 c
+125.262 83.7426 125.088 83.7097 124.938 83.6437 c
+124.788 83.5776 124.657 83.4787 124.547 83.3466 c
+124.437 83.2145 124.351 83.0733 124.289 82.9231 c
+124.227 82.7729 124.184 82.6133 124.162 82.4446 c
+124.162 79.2655 l
+123.205 79.2655 l
+123.205 82.4667 l
+closepath
+0 0 0 rgb
+F
+newpath
+113.172 76.343 m
+113.172 76.6049 113.208 76.8397 113.279 77.0474 c
+113.35 77.2549 113.455 77.4355 113.593 77.5889 c
+113.736 77.7422 113.883 77.8732 114.037 77.9817 c
+114.19 78.0903 114.351 78.1745 114.519 78.2343 c
+114.549 78.2456 114.58 78.2558 114.612 78.2652 c
+114.644 78.2746 114.676 78.2848 114.71 78.2961 c
+114.74 78.3035 114.771 78.3111 114.803 78.3185 c
+114.835 78.3259 114.865 78.3315 114.895 78.3352 c
+114.959 78.3465 115.02 78.3551 115.078 78.3607 c
+115.136 78.3661 115.193 78.3689 115.249 78.3689 c
+115.402 78.3689 115.55 78.3539 115.692 78.3242 c
+115.835 78.2941 115.969 78.2513 116.096 78.1952 c
+116.223 78.1391 116.349 78.0659 116.472 77.9761 c
+116.596 77.8865 116.718 77.7816 116.837 77.662 c
+116.484 77.2745 l
+116.469 77.2821 116.454 77.2915 116.441 77.3026 c
+116.428 77.3139 116.414 77.3269 116.4 77.3419 c
+116.392 77.3493 116.384 77.357 116.377 77.3643 c
+116.369 77.372 116.362 77.3794 116.354 77.3867 c
+116.343 77.3944 116.334 77.4018 116.326 77.4094 c
+116.319 77.4168 116.311 77.4242 116.304 77.4318 c
+116.237 77.4879 116.164 77.5412 116.085 77.5917 c
+116.007 77.6421 115.922 77.6917 115.833 77.7405 c
+115.743 77.7853 115.649 77.8199 115.552 77.8443 c
+115.455 77.8686 115.354 77.8808 115.249 77.8808 c
+115.021 77.8808 114.819 77.8479 114.645 77.7825 c
+114.472 77.717 114.325 77.6189 114.205 77.4879 c
+114.089 77.3607 113.995 77.2252 113.921 77.0809 c
+113.849 76.9369 113.799 76.7864 113.773 76.6293 c
+113.769 76.603 113.764 76.5777 113.759 76.5534 c
+113.753 76.5293 113.75 76.5037 113.75 76.4777 c
+113.747 76.4516 113.745 76.4264 113.745 76.402 c
+113.745 76.3776 113.745 76.3541 113.745 76.3317 c
+113.745 76.1446 113.776 75.964 113.837 75.7903 c
+113.899 75.6162 113.992 75.4507 114.115 75.2934 c
+114.239 75.1363 114.395 75.0156 114.584 74.9314 c
+114.773 74.8472 114.994 74.7996 115.249 74.7885 c
+115.253 74.7885 115.255 74.7885 115.257 74.7885 c
+115.259 74.7885 115.262 74.7885 115.266 74.7885 c
+115.269 74.7885 115.273 74.7885 115.277 74.7885 c
+115.281 74.7885 115.284 74.7885 115.288 74.7885 c
+115.296 74.7885 115.301 74.7885 115.305 74.7885 c
+115.309 74.7885 115.312 74.7885 115.313 74.7885 c
+115.315 74.7885 115.318 74.7885 115.322 74.7885 c
+115.49 74.7845 115.644 74.8072 115.782 74.8557 c
+115.92 74.9044 116.042 74.9793 116.147 75.0802 c
+116.255 75.1774 116.346 75.2814 116.419 75.3917 c
+116.492 75.502 116.549 75.6171 116.59 75.737 c
+116.601 75.7667 116.612 75.7957 116.621 75.8237 c
+116.631 75.8518 116.637 75.879 116.641 75.9054 c
+116.644 75.9201 116.647 75.9343 116.649 75.9473 c
+116.651 75.9603 116.652 75.9745 116.652 75.9895 c
+116.656 76.0006 116.659 76.0128 116.66 76.0258 c
+116.662 76.0389 116.663 76.053 116.663 76.0681 c
+115.294 76.0791 l
+115.294 76.6123 l
+117.236 76.6123 l
+117.236 76.1242 l
+117.213 75.8285 117.148 75.5695 117.039 75.3469 c
+116.931 75.1241 116.781 74.9342 116.59 74.7772 c
+116.396 74.6201 116.187 74.5031 115.964 74.4262 c
+115.742 74.3497 115.503 74.3114 115.249 74.3114 c
+114.95 74.3114 114.676 74.3571 114.429 74.4489 c
+114.183 74.5405 113.964 74.6816 113.773 74.8727 c
+113.582 75.0595 113.436 75.2758 113.335 75.5207 c
+113.234 75.7659 113.18 76.0363 113.172 76.3317 c
+113.172 76.343 l
+closepath
+117.724 76.2138 m
+117.724 76.33 117.746 76.4394 117.791 76.5423 c
+117.836 76.6452 117.905 76.7396 117.999 76.8258 c
+118.092 76.9117 118.201 76.9763 118.324 77.0194 c
+118.448 77.0622 118.586 77.0837 118.74 77.0837 c
+118.848 77.0837 118.944 77.0755 119.026 77.0585 c
+119.108 77.0418 119.175 77.0182 119.228 76.9885 c
+119.28 76.9584 119.329 76.9219 119.374 76.8791 c
+119.419 76.836 119.458 76.7864 119.492 76.7302 c
+119.525 76.775 119.567 76.8173 119.615 76.8564 c
+119.664 76.8958 119.722 76.9341 119.789 76.9715 c
+119.857 77.0089 119.931 77.0369 120.014 77.0557 c
+120.096 77.0744 120.188 77.0837 120.289 77.0837 c
+120.416 77.0837 120.536 77.0661 120.648 77.0304 c
+120.76 76.995 120.865 76.9397 120.962 76.8649 c
+121.059 76.7937 121.133 76.7124 121.184 76.6208 c
+121.234 76.5293 121.261 76.4272 121.265 76.315 c
+121.265 76.3113 121.265 76.3084 121.265 76.3065 c
+121.265 76.3048 121.265 76.3019 121.265 76.298 c
+121.265 76.2943 121.265 76.2914 121.265 76.2897 c
+121.265 76.2878 121.265 76.2849 121.265 76.2812 c
+121.261 76.2775 121.26 76.2747 121.26 76.2727 c
+121.26 76.271 121.26 76.2682 121.26 76.2645 c
+121.26 76.2605 121.26 76.258 121.26 76.256 c
+121.26 76.254 121.26 76.2512 121.26 76.2475 c
+121.26 74.3562 l
+120.771 74.3562 l
+120.771 76.0791 l
+120.771 76.0754 120.771 76.0746 120.771 76.0763 c
+120.771 76.0783 120.773 76.0791 120.777 76.0791 c
+120.777 76.0828 120.777 76.0856 120.777 76.0876 c
+120.777 76.0896 120.777 76.0922 120.777 76.0961 c
+120.777 76.1035 120.777 76.11 120.777 76.1157 c
+120.777 76.1214 120.777 76.1259 120.777 76.1296 c
+120.777 76.1409 120.776 76.1523 120.774 76.1633 c
+120.772 76.1746 120.769 76.1877 120.766 76.2027 c
+120.762 76.2138 120.759 76.226 120.757 76.2393 c
+120.756 76.2523 120.753 76.2662 120.749 76.2812 c
+120.734 76.326 120.712 76.3691 120.682 76.4102 c
+120.651 76.4516 120.616 76.4907 120.575 76.5281 c
+120.534 76.5655 120.489 76.5936 120.44 76.6123 c
+120.392 76.631 120.341 76.6404 120.289 76.6404 c
+120.221 76.6404 120.159 76.6282 120.101 76.6038 c
+120.043 76.5797 119.989 76.5432 119.941 76.4944 c
+119.892 76.4459 119.854 76.3943 119.826 76.3402 c
+119.798 76.286 119.778 76.2288 119.767 76.169 c
+119.763 76.1616 119.76 76.1531 119.758 76.1437 c
+119.756 76.1344 119.755 76.1259 119.755 76.1185 c
+119.755 76.1072 119.755 76.0978 119.755 76.0905 c
+119.755 76.0828 119.755 76.0754 119.755 76.0681 c
+119.755 74.3562 l
+119.273 74.3562 l
+119.273 76.0343 l
+119.273 76.1165 119.262 76.1934 119.239 76.2645 c
+119.217 76.3354 119.183 76.4008 119.138 76.4609 c
+119.093 76.5208 119.037 76.5655 118.97 76.5956 c
+118.903 76.6254 118.826 76.6404 118.74 76.6404 c
+118.631 76.6293 118.541 76.6049 118.47 76.5675 c
+118.399 76.5301 118.347 76.4797 118.313 76.4159 c
+118.279 76.3524 118.254 76.2849 118.237 76.2138 c
+118.22 76.1429 118.212 76.0698 118.212 75.9949 c
+118.212 75.9912 118.212 75.9876 118.212 75.9839 c
+118.212 75.9782 l
+118.212 74.3562 l
+117.724 74.3562 l
+117.724 76.2138 l
+closepath
+122.23 78.2456 m
+122.23 75.7256 l
+122.23 75.576 122.249 75.4422 122.286 75.3242 c
+122.324 75.2066 122.378 75.1026 122.449 75.0127 c
+122.524 74.9231 122.613 74.8557 122.716 74.8109 c
+122.819 74.7658 122.936 74.7434 123.067 74.7434 c
+123.19 74.7434 123.3 74.7613 123.398 74.7967 c
+123.495 74.8324 123.579 74.8857 123.65 74.9566 c
+123.718 75.0277 123.774 75.1026 123.819 75.1811 c
+123.864 75.2599 123.897 75.3401 123.92 75.4226 c
+123.927 75.4413 123.932 75.4609 123.934 75.4816 c
+123.936 75.502 123.939 75.5235 123.942 75.5459 c
+123.946 75.5686 123.949 75.5899 123.95 75.6105 c
+123.952 75.6312 123.953 75.6508 123.953 75.6695 c
+123.953 75.8192 123.934 75.9501 123.894 76.0624 c
+123.855 76.1746 123.798 76.2662 123.723 76.3374 c
+123.649 76.4122 123.569 76.4711 123.485 76.5142 c
+123.401 76.5573 123.313 76.5843 123.224 76.5956 c
+123.213 76.5956 123.202 76.5956 123.193 76.5956 c
+123.184 76.5956 123.175 76.5956 123.168 76.5956 c
+123.164 76.5956 123.159 76.5956 123.154 76.5956 c
+123.148 76.5956 123.143 76.5973 123.14 76.6013 c
+123.132 76.6013 123.126 76.6013 123.123 76.6013 c
+123.119 76.6013 123.115 76.6013 123.112 76.6013 c
+123.056 76.6013 123.003 76.5973 122.954 76.5899 c
+122.906 76.5826 122.861 76.5712 122.82 76.5562 c
+122.779 76.5412 122.738 76.5253 122.699 76.5086 c
+122.66 76.4918 122.62 76.474 122.578 76.4553 c
+122.573 76.4496 l
+122.567 76.4496 l
+122.56 76.4459 122.552 76.4422 122.545 76.4383 c
+122.537 76.4346 122.532 76.4329 122.528 76.4329 c
+122.52 76.4289 122.514 76.4252 122.508 76.4215 c
+122.503 76.4179 122.496 76.4142 122.489 76.4102 c
+122.474 76.4065 122.46 76.402 122.446 76.3963 c
+122.433 76.3906 122.419 76.3841 122.404 76.3768 c
+122.404 76.8762 l
+122.446 76.8949 122.486 76.9136 122.525 76.9323 c
+122.564 76.9511 122.605 76.9678 122.646 76.9828 c
+122.687 76.9978 122.728 77.0109 122.769 77.0222 c
+122.81 77.0333 122.853 77.0426 122.898 77.0503 c
+122.917 77.054 122.936 77.0568 122.957 77.0585 c
+122.978 77.0605 122.999 77.0633 123.022 77.067 c
+123.033 77.067 123.043 77.067 123.053 77.067 c
+123.062 77.067 123.072 77.069 123.084 77.0727 c
+123.091 77.0727 123.1 77.0727 123.112 77.0727 c
+123.123 77.0727 123.134 77.0727 123.145 77.0727 c
+123.321 77.0727 123.486 77.0435 123.639 76.9856 c
+123.793 76.9275 123.937 76.8388 124.071 76.7189 c
+124.206 76.603 124.308 76.4646 124.377 76.3036 c
+124.446 76.1429 124.481 75.9615 124.481 75.7594 c
+124.481 75.5723 124.451 75.3926 124.391 75.2205 c
+124.331 75.0484 124.242 74.8838 124.122 74.7267 c
+124.006 74.5694 123.859 74.4534 123.681 74.3786 c
+123.503 74.3038 123.298 74.2664 123.067 74.2664 c
+122.835 74.2664 122.633 74.3029 122.461 74.3758 c
+122.288 74.4489 122.146 74.56 122.034 74.7097 c
+121.922 74.8633 121.837 75.0269 121.781 75.2009 c
+121.725 75.375 121.697 75.5609 121.697 75.7594 c
+121.697 78.2456 l
+122.23 78.2456 l
+closepath
+124.969 78.2904 m
+125.497 78.2904 l
+125.497 76.6965 l
+127.181 76.6965 l
+127.181 78.2904 l
+127.708 78.2904 l
+127.708 74.3562 l
+127.181 74.3562 l
+127.181 76.169 l
+125.497 76.169 l
+125.497 74.3562 l
+124.969 74.3562 l
+124.969 78.2904 l
+closepath
+F
+%%PageTrailer
+showpage
+%%Trailer
+end
+%%DocumentSuppliedResources: procset Linux-Sketch-Procset 1.0 2
+%%EOF
Binary file flys-artifacts/doc/datacage-config-manual/figures/intevation-logo.pdf has changed
--- a/flys-artifacts/pom.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/pom.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -21,8 +21,8 @@
           <artifactId>maven-compiler-plugin</artifactId>
           <version>2.0.2</version>
           <configuration>
-              <source>1.5</source>
-              <target>1.5</target>
+              <source>1.6</source>
+              <target>1.6</target>
           </configuration>
       </plugin>
       <plugin>
--- /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:44 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/BedHeightsArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/BedHeightsArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -12,7 +12,6 @@
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.artifacts.common.utils.XMLUtils;
-import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedHeight;
 import de.intevation.flys.artifacts.model.minfo.BedHeightFacet;
 import de.intevation.flys.artifacts.model.minfo.BedHeightFactory;
@@ -20,7 +19,6 @@
 
 public class BedHeightsArtifact
 extends      StaticFLYSArtifact
-implements   FacetTypes
 {
     /** The logger for this class. */
     private static Logger logger =
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FLYSArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,5 @@
 package de.intevation.flys.artifacts;
 
-import de.intevation.flys.artifacts.model.FacetTypes;
-
 import org.apache.log4j.Logger;
 
 /**
@@ -11,8 +9,7 @@
  */
 public class FixationArtifact
 extends      FLYSArtifact
-implements   FacetTypes {
-
+{
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(FixationArtifact.class);
 
@@ -23,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:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/HYKArtifact.java	Fri Sep 28 12:15:44 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/MINFOArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MINFOArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,5 @@
 package de.intevation.flys.artifacts;
 
-import de.intevation.flys.artifacts.model.FacetTypes;
-
 /**
  * The default MINFO artifact.
  *
@@ -9,8 +7,7 @@
  */
 public class MINFOArtifact
 extends      FLYSArtifact
-implements   FacetTypes {
-
+{
     /** The name of the artifact. */
     public static final String ARTIFACT_NAME = "minfo";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,31 +1,23 @@
 package de.intevation.flys.artifacts;
 
+import java.awt.geom.Point2D;
 import java.util.ArrayList;
 import java.util.List;
 
-import java.awt.geom.Point2D;
-
 import org.apache.log4j.Logger;
-
+import org.json.JSONArray;
+import org.json.JSONException;
 import org.w3c.dom.Document;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-
 import de.intevation.artifactdatabase.state.Facet;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallMeta;
-
+import de.intevation.flys.artifacts.geom.Lines;
 import de.intevation.flys.artifacts.model.FacetTypes;
-
 import de.intevation.flys.artifacts.states.DefaultState;
-
 import de.intevation.flys.model.FastCrossSectionLine;
 
-import de.intevation.flys.artifacts.geom.Lines;
-
 
 /**
  * Artifact to store user-added points and water lines.
@@ -34,6 +26,8 @@
 extends      StaticFLYSArtifact
 implements   FacetTypes, WaterLineArtifact
 {
+    private static final long serialVersionUID = 7096025125474986011L;
+
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(ManualPointsArtifact.class);
 
@@ -41,24 +35,21 @@
     public static final String ARTIFACT_NAME = "manualpoints";
 
 
-    /**
-     * Trivial Constructor.
-     */
     public ManualPointsArtifact() {
         logger.debug("ManualPointsArtifact.ManualPointsArtifact()");
     }
 
 
     /**
-     * Gets called from factory, to set things up.
+     * Gets called from factory to set things up.
      */
     @Override
     public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
+            String          identifier,
+            ArtifactFactory factory,
+            Object          context,
+            CallMeta        callMeta,
+            Document        data)
     {
         logger.debug("ManualPointsArtifact.setup");
         super.setup(identifier, factory, context, callMeta, data);
@@ -67,6 +58,7 @@
 
 
     /** Return the name of this artifact. */
+    @Override
     public String getName() {
         return ARTIFACT_NAME;
     }
@@ -106,7 +98,7 @@
         }
         else {
             logger.debug("No facets to add in ManualPointsArtifact.initialize ("
-                + state.getID() + ").");
+                    + state.getID() + ").");
         }
     }
 
@@ -118,7 +110,7 @@
      */
     protected double getLine(int index) {
         try {
-            JSONArray lines = new JSONArray((String) getLinesData(null));
+            JSONArray lines = new JSONArray(getLinesData(null));
             JSONArray array = lines.getJSONArray(index);
 
             return array.getDouble(0);
@@ -139,10 +131,10 @@
      */
     @Override
     public Lines.LineData getWaterLines(
-        int                  index,
-        FastCrossSectionLine csl,
-        double a, double b
-    ) {
+            int                  index,
+            FastCrossSectionLine csl,
+            double a, double b
+            ) {
         List<Point2D> points = csl.getPoints();
         return Lines.createWaterLines(points, getLine(index));
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MapArtifact.java	Fri Sep 28 12:15:44 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/QSectorArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/QSectorArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -14,7 +14,6 @@
 import de.intevation.artifacts.CallMeta;
 import de.intevation.artifacts.CallContext;
 
-import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.GaugeFinder;
 import de.intevation.flys.artifacts.model.GaugeFinderFactory;
 import de.intevation.flys.artifacts.model.GaugeRange;
@@ -32,7 +31,6 @@
  */
 public class QSectorArtifact
 extends      StaticFLYSArtifact
-implements   FacetTypes
 {
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(QSectorArtifact.class);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/RiverAxisArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticWKmsArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WINFOArtifact.java	Fri Sep 28 12:15:44 2012 +0200
@@ -560,12 +560,12 @@
         StateData wqValues = getData("wq_values");
         if (wqValues == null) {
             logger.warn("no wq_values given");
-            return Collections.emptyList();
+            return Collections.<Segment>emptyList();
         }
         String input = (String) wqValues.getValue();
         if (input == null || (input = input.trim()).length() == 0) {
             logger.warn("wq_values are empty");
-            return Collections.emptyList();
+            return Collections.<Segment>emptyList();
         }
         return Segment.parseSegments(input);
     }
@@ -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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSBuildingsArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSCatchmentArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSDBArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFixpointsArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodmapsArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSFloodplainArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSGaugeLocationArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHwsArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSHydrBoundaryPolyArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSKmArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSLineArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WMSQPSArtifact.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/WaterlevelArtifact.java	Fri Sep 28 12:15:44 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:44 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");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,97 @@
+package de.intevation.flys.artifacts.access;
+
+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.model.DateRange;
+
+
+public class BedQualityAccess extends RiverAccess {
+
+    private static final Logger logger = Logger
+        .getLogger(BedQualityAccess.class);
+
+    private Double from;
+    private Double to;
+    private List<String> bedDiameter;
+    private List<String> bedloadDiameter;
+    private List<DateRange> ranges;
+
+    public BedQualityAccess(FLYSArtifact artifact) {
+        super(artifact);
+    }
+
+    public double getFrom() {
+        if (from == null) {
+            from = getDouble("ld_from");
+        }
+        return from.doubleValue();
+    }
+
+    public double getTo() {
+        if (to == null) {
+            to = getDouble("ld_to");
+        }
+        return to.doubleValue();
+    }
+
+    public List<DateRange> getDateRanges() {
+        if (ranges == null) {
+            ranges = extractRanges(getString("periods"));
+        }
+        return ranges;
+    }
+
+    public List<String> getBedDiameter() {
+        String value = getString("bed_diameter");
+        if (bedDiameter == null && value != null) {
+            bedDiameter = extractDiameter(value);
+        }
+        return bedDiameter;
+    }
+
+    public List<String> getBedloadDiameter() {
+        String value = getString("load_diameter");
+        if (bedloadDiameter == null && value != null) {
+            bedloadDiameter = extractDiameter(value);
+        }
+        return bedloadDiameter;
+    }
+
+    private List<DateRange> extractRanges(String dateString) {
+        List<DateRange> list = new LinkedList<DateRange>();
+        String[] dates = dateString.split(";");
+        for (String s : dates) {
+            String[] pair = s.split(",");
+            try {
+                long l1      = Long.parseLong(pair[0]);
+                long l2      = Long.parseLong(pair[1]);
+                Date first   = new Date(l1);
+                Date second  = new Date(l2);
+                DateRange dr = new DateRange(first, second);
+                list.add(dr);
+            }
+            catch (NumberFormatException nfe) {
+                continue;
+            }
+        }
+        return list;
+    }
+
+    private List<String> extractDiameter(String value) {
+        List<String> result = new LinkedList<String>();
+        String[] diameter = value.split(";");
+        for (String v : diameter) {
+            logger.debug("diameter: " + v);
+            String[] parts = v.split("\\.");
+            result.add(parts[parts.length - 1]);
+            logger.debug(parts[parts.length-1]);
+        }
+        return result;
+    }
+}
+// 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/access/ExtremeAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,126 @@
+package de.intevation.flys.artifacts.access;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import de.intevation.flys.artifacts.model.RangeWithValues;
+
+import de.intevation.flys.utils.DoubleUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+public class ExtremeAccess
+extends      RiverAccess
+{
+    private static Logger log = Logger.getLogger(ExtremeAccess.class);
+
+    protected Double from;
+    protected Double to;
+    protected Double step;
+
+    protected Long start;
+    protected Long end;
+
+    protected Double percent;
+
+    protected String function;
+
+    protected List<RangeWithValues> ranges;
+
+    public ExtremeAccess() {
+    }
+
+    public ExtremeAccess(FLYSArtifact artifact) {
+        super(artifact);
+    }
+
+    public Double getFrom() {
+
+        if (from == null) {
+            from = getDouble("ld_from");
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("from: '" + from + "'");
+        }
+
+        return from;
+    }
+
+    public Double getTo() {
+
+        if (to == null) {
+            to = getDouble("ld_to");
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("to: '" + to + "'");
+        }
+
+        return to;
+    }
+
+    public Double getStep() {
+
+        if (step == null) {
+            step = getDouble("ld_step");
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("step: '" + step + "'");
+        }
+
+        return step;
+    }
+
+    public Double getPercent() {
+
+        if (percent == null) {
+            percent = getDouble("percent");
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("percent: '" + percent + "'");
+        }
+
+        return percent;
+    }
+
+    public String getFunction() {
+        if (function == null) {
+            function = getString("function");
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("function: '" + function + "'");
+        }
+
+        return function;
+    }
+
+    public List<RangeWithValues> getRanges() {
+
+        if (ranges == null) {
+            String rangesS = getString("ranges");
+            if (ranges == null) {
+                return null;
+            }
+            ranges = new ArrayList<RangeWithValues>();
+            DoubleUtil.parseSegments(rangesS, new DoubleUtil.SegmentCallback() {
+                @Override
+                public void newSegment(double from, double to, double [] values) {
+                    ranges.add(new RangeWithValues(from, to, values));
+                }
+            });
+        }
+
+        if (log.isDebugEnabled()) {
+            log.debug("ranges: " + ranges);
+        }
+
+        return ranges;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -7,12 +7,10 @@
 import org.apache.log4j.Logger;
 
 public class FixAccess
-extends      Access
+extends      RiverAccess
 {
     private static Logger log = Logger.getLogger(FixAccess.class);
 
-    protected String river;
-
     protected Double from;
     protected Double to;
     protected Double step;
@@ -36,16 +34,6 @@
         super(artifact);
     }
 
-    public String getRiver() {
-        if (river == null) {
-            river = getString("river");
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("river: '" + river + "'");
-        }
-        return river;
-    }
-
     public Double getFrom() {
 
         if (from == null) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -3,7 +3,8 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 
-public class FlowVelocityAccess extends Access {
+/** Access to data that deals with flow velocity stuff. */
+public class FlowVelocityAccess extends RiverAccess {
 
     private int[] mainChannels;
     private int[] totalChannels;
@@ -19,7 +20,7 @@
 
     public int[] getMainChannels() {
         if (mainChannels == null) {
-            mainChannels = getIntArray("main.channel");
+            mainChannels = getIntArray("main_channel");
         }
 
         return mainChannels;
@@ -28,7 +29,7 @@
 
     public int[] getTotalChannels() {
         if (totalChannels == null) {
-            totalChannels = getIntArray("total.channel");
+            totalChannels = getIntArray("total_channel");
         }
 
         return totalChannels;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RiverAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,31 @@
+package de.intevation.flys.artifacts.access;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import org.apache.log4j.Logger;
+
+public class RiverAccess
+extends      Access
+{
+    private static Logger log = Logger.getLogger(RiverAccess.class);
+
+    protected String river;
+
+    public RiverAccess() {
+    }
+
+    public RiverAccess(FLYSArtifact artifact) {
+        super(artifact);
+    }
+
+    public String getRiver() {
+        if (river == null) {
+            river = getString("river");
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("river: '" + river + "'");
+        }
+        return river;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SQRelationAccess.java	Fri Sep 28 12:15:44 2012 +0200
@@ -8,12 +8,10 @@
 import de.intevation.flys.artifacts.model.DateRange;
 
 public class SQRelationAccess
-extends      Access
+extends      RiverAccess
 {
     private static Logger log = Logger.getLogger(SQRelationAccess.class);
 
-    protected String    river;
-
     protected Double    location;
 
     protected DateRange period;
@@ -27,16 +25,6 @@
         super(artifact);
     }
 
-    public String getRiver() {
-        if (river == null) {
-            river = getString("river");
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("river: '" + river + "'");
-        }
-        return river;
-    }
-
     public Double getLocation() {
         if (location == null) {
             // XXX: The parameter name suggests plural!?
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/Polygon2D.java	Fri Sep 28 12:14:44 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,426 +0,0 @@
-package de.intevation.flys.artifacts.geom;
-
-import java.awt.Shape;
-import java.awt.geom.Path2D;
-import java.awt.geom.Point2D;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import de.intevation.flys.artifacts.math.Linear;
-import static de.intevation.flys.artifacts.geom.VectorUtils.EPSILON;
-import static de.intevation.flys.artifacts.geom.VectorUtils.X;
-import static de.intevation.flys.artifacts.geom.VectorUtils.Y;
-
-public class Polygon2D
-implements   Serializable
-{
-    public static final Comparator<Point2D> POINT_X_CMP =
-        new Comparator<Point2D>() {
-            public int compare(Point2D a, Point2D b) {
-                double d = X(a) - X(b);
-                if (d < 0d) return -1;
-                return d > 0d ? + 1 : 0;
-            }
-        };
-
-    public static final Comparator<Point2D []> FIRST_POINT_X =
-        new Comparator<Point2D []>() {
-            public int compare(Point2D [] a, Point2D [] b) {
-                if (a.length == 0) return -1; // should not happen.
-                if (b.length == 0) return +1; // should not happen.
-                double d = X(a[0]) - Y(b[0]);
-                if (d < 0d) return -1;
-                return d > 0d ? + 1 : 0;
-            }
-        };
-
-    protected List<Point2D> points;
-
-    public Polygon2D() {
-        points = new ArrayList<Point2D>();
-    }
-
-    public Polygon2D(List<Point2D> points) {
-        this.points = points;
-    }
-
-    public void add(double x, double y) {
-        points.add(new Point2D.Double(x, y));
-    }
-
-    protected static boolean addCheck(Point2D p, List<Point2D> points) {
-        switch (points.size()) {
-            case 0:
-                points.add(p);
-                return true;
-            case 1:
-                if (VectorUtils.epsilonEquals(points.get(0), p)) {
-                    return false;
-                }
-                points.add(p);
-                return true;
-            default:
-                int L = points.size()-1;
-                Point2D last = points.get(L);
-                if (VectorUtils.epsilonEquals(last, p)) {
-                    return false;
-                }
-                Point2D before = points.get(L-1);
-                if (VectorUtils.collinear(before, last, p)) {
-                    points.set(L, p);
-                }
-                else {
-                    points.add(p);
-                }
-                return true;
-        }
-    }
-
-    public boolean addCheck(Point2D p) {
-        return addCheck(p, points);
-    }
-
-    public void addReversed(List<Point2D> other) {
-        for (int i = other.size()-1; i >= 0; --i) {
-            addCheck(other.get(i));
-        }
-    }
-
-    public double area() {
-        double area = 0d;
-
-        for (int i = 0, N = points.size(); i < N; ++i) {
-            int j = (i + 1) % N;
-            Point2D pi = points.get(i);
-            Point2D pj = points.get(j);
-            area += X(pi)*Y(pj);
-            area -= X(pj)*Y(pi);
-        }
-
-        return 0.5d*area;
-    }
-
-    public Shape toShape() {
-        Path2D.Double path = new Path2D.Double();
-
-        int N = points.size();
-
-        if (N > 0) {
-            Point2D p = points.get(0);
-            path.moveTo(X(p), Y(p));
-            for (int i = 1; i < N; ++i) {
-                p = points.get(i);
-                path.lineTo(X(p), Y(p));
-            }
-            path.closePath();
-        }
-
-        return path;
-    }
-
-    protected static List<Point2D []> splitByNaNs(
-        double [] xs,
-        double [] ys
-    ) {
-        List<Point2D []> parts = new ArrayList<Point2D []>();
-
-        List<Point2D> tmp = new ArrayList<Point2D>(xs.length);
-
-        for (int i = 0; i < xs.length; ++i) {
-            double x = xs[i];
-            double y = ys[i];
-
-            if (Double.isNaN(x) || Double.isNaN(y)) {
-                if (!tmp.isEmpty()) {
-                    Point2D [] part = new Point2D[tmp.size()];
-                    parts.add(tmp.toArray(part));
-                    tmp.clear();
-                }
-            }
-            else {
-                tmp.add(new Point2D.Double(x, y));
-            }
-        }
-
-        if (!tmp.isEmpty()) {
-            Point2D [] part = new Point2D[tmp.size()];
-            parts.add(tmp.toArray(part));
-        }
-
-        return parts;
-    }
-
-    protected static boolean removeNoneIntersecting(
-        List<Point2D []> As,
-        List<Point2D []> Bs
-    ) {
-        int B = Bs.size()-1;
-        OUTER: for (int i = 0; i < As.size();) {
-            Point2D [] a = As.get(i);
-            int lo = 0, hi = B;
-            while (lo <= hi) {
-                int mid = (lo + hi) >> 1;
-                Point2D [] b = Bs.get(mid);
-                     if (X(a[0]) > X(b[b.length-1])) lo = mid+1;
-                else if (X(a[a.length-1]) < X(b[0])) hi = mid-1;
-                else {
-                    // found: keep
-                    ++i;
-                    continue OUTER;
-                }
-            }
-            // not found: remove
-            As.remove(i);
-        }
-
-        return As.isEmpty();
-    }
-
-    protected static void buildPolygons(
-        Point2D []      as,
-        Point2D []      bs,
-        Point2D [][]    rest,
-        List<Polygon2D> positives,
-        List<Polygon2D> negatives
-    ) {
-        List<Point2D> apoints = new ArrayList<Point2D>();
-        List<Point2D> bpoints = new ArrayList<Point2D>();
-
-        double ax = X(as[0]);
-        double bx = X(bs[0]);
-
-        int ai = 1;
-        int bi = 1;
-
-        boolean intersect = false;
-
-        if (ax == bx) {
-            apoints.add(as[0]);
-            bpoints.add(bs[0]);
-        }
-        else if (ax > bx) {
-            apoints.add(as[0]);
-            double bx1;
-            while ((bx1 = X(bs[bi])) < ax) ++bi;
-            if (bx1 == ax) {
-                bpoints.add(bs[bi]);
-            }
-            else { // need to calculate start b point.
-                intersect = true;
-                double by1 = Linear.linear(
-                    ax,
-                    X(bs[bi-1]), bx1,
-                    Y(bs[bi-1]), Y(bs[bi]));
-
-                bpoints.add(new Point2D.Double(ax, by1));
-            }
-        }
-        else { // bx > ax: Symmetric case
-            bpoints.add(bs[0]);
-            double ax1;
-            while ((ax1 = X(as[ai])) < bx) ++ai;
-            if (ax1 == bx) {
-                apoints.add(as[ai]);
-            }
-            else { // need to calculate start b point.
-                intersect = true;
-                double ay1 = Linear.linear(
-                    bx,
-                    X(as[ai-1]), ax1,
-                    Y(as[ai-1]), Y(as[ai]));
-
-                apoints.add(new Point2D.Double(bx, ay1));
-            }
-        }
-
-        // now we have a point in each list, decide if neg/pos.
-        boolean neg = Y(bpoints.get(0)) > Y(apoints.get(0));
-
-        // Continue with inner points
-
-        Line line = new Line();
-
-        while (ai < as.length && bi < bs.length) {
-            double xan = X(as[ai]);
-            double xbn = X(bs[bi]);
-            if (xan == xbn) {
-                double yan = Y(as[ai]);
-                double ybn = Y(bs[ai]);
-
-                if (neg) {
-                    if (yan > ybn) { // intersection
-                        Point2D ip = VectorUtils.intersection(
-                            apoints.get(apoints.size()-1), as[ai],
-                            bpoints.get(bpoints.size()-1), bs[bi]);
-                        addCheck(ip, apoints);
-                        addCheck(ip, bpoints);
-                        Polygon2D p = new Polygon2D(
-                            new ArrayList<Point2D>(apoints));
-                        p.addReversed(bpoints);
-                        negatives.add(p);
-                        apoints.clear();
-                        bpoints.clear();
-                        apoints.add(ip);
-                        bpoints.add(ip);
-                        neg = !neg;
-                    }
-                    else { // no intersection
-                        addCheck(as[ai], apoints);
-                        addCheck(bs[bi], bpoints);
-                    }
-                }
-                else { // not neg
-                    if (ybn > yan) { // intersection
-                        Point2D ip = VectorUtils.intersection(
-                            apoints.get(apoints.size()-1), as[ai],
-                            bpoints.get(bpoints.size()-1), bs[bi]);
-                        addCheck(ip, apoints);
-                        addCheck(ip, bpoints);
-                        Polygon2D p = new Polygon2D(
-                            new ArrayList<Point2D>(apoints));
-                        p.addReversed(bpoints);
-                        positives.add(p);
-                        apoints.clear();
-                        bpoints.clear();
-                        apoints.add(ip);
-                        bpoints.add(ip);
-                        neg = !neg;
-                    }
-                    else { // no intersection
-                        addCheck(as[ai], apoints);
-                        addCheck(bs[bi], bpoints);
-                    }
-                }
-                ++ai;
-                ++bi;
-            }
-            else if (xan > xbn) {
-                line.set(apoints.get(apoints.size()-1), as[ai]);
-                double dir = neg ? -1d: 1d; // XXX: correct sign?
-                while  (bi < bs.length
-                    && X(bs[bi]) < xan
-                    && line.eval(bs[bi])*dir > EPSILON)
-                    ++bi;
-                if (bi == bs.length) {
-                    // b run out of points
-                    // calculate Y(last_a, as[ai]) for X(bs[bi-1])
-                    double ay1 = Linear.linear(
-                        X(bs[bi-1]),
-                        X(apoints.get(apoints.size()-1)), X(as[ai]),
-                        Y(apoints.get(apoints.size()-1)), Y(as[ai]));
-                    addCheck(new Point2D.Double(X(bs[bi-1]), ay1), apoints);
-                    addCheck(bs[bi-1], bpoints);
-                    Polygon2D p = new Polygon2D(
-                        new ArrayList<Point2D>(apoints));
-                    p.addReversed(bpoints);
-                    apoints.clear();
-                    bpoints.clear();
-                    (neg ? negatives : positives).add(p);
-                    break;
-                }
-                else {
-                    // TODO: intersect line and/or X(bs[bi]) >= xan?
-                }
-            }
-            else { // xbn > xan
-                line.set(bpoints.get(bpoints.size()-1), bs[bi]);
-                // TODO: continue symmetric
-            }
-        }
-
-        // TODO: Continue with closing segment
-    }
-
-    public static final class Line {
-
-        private double a;
-        private double b;
-        private double c;
-
-        public Line() {
-        }
-
-        public Line(Point2D p1, Point2D p2) {
-            set(p1, p2);
-        }
-
-        public void set(Point2D p1, Point2D p2) {
-            Point2D p3 =
-                VectorUtils.normalize(
-                VectorUtils.sub(p1, p2));
-
-            Point2D n = VectorUtils.ortho(p3);
-
-            a = X(n);
-            b = Y(n);
-
-            // a*x + b*y + c = 0
-            // c = -a*x -b*y
-
-            c = -a*X(p1) - b*Y(p1);
-        }
-
-        public double eval(Point2D p) {
-            return a*X(p) + b*Y(p) + c;
-        }
-    }
-
-    public static void createPolygons(
-        double [] xAs, double [] yAs,
-        double [] xBs, double [] yBs,
-        List<Polygon2D> positives,
-        List<Polygon2D> negatives
-    ) {
-        if (xAs.length == 0 || xBs.length == 0) {
-            return;
-        }
-
-        List<Point2D []> splAs = splitByNaNs(xAs, yAs);
-        List<Point2D []> splBs = splitByNaNs(xBs, yBs);
-
-        // They feeded us with NaNs only.
-        if (splAs.isEmpty() || splBs.isEmpty()) {
-            return;
-        }
-
-        // Sort each part by x to ensure that the first
-        // is the smallest.
-        for (Point2D [] splA: splAs) {
-            Arrays.sort(splA, POINT_X_CMP);
-        }
-
-        for (Point2D [] splB: splBs) {
-            Arrays.sort(splB, POINT_X_CMP);
-        }
-
-        // Now sort all parts by there first elements.
-        // Should be good enough to find overlapping regions.
-        Collections.sort(splAs, FIRST_POINT_X);
-        Collections.sort(splBs, FIRST_POINT_X);
-
-        // Check if the two series intersect at all.
-        // If no then there will be no area between them.
-
-        Point2D [] p1 = splAs.get(0);
-        Point2D [] p2 = splBs.get(splBs.size()-1);
-
-        // Sort out the ranges that are not intersecting
-        // the ranges in the other series.
-        // We are going to merge them anyway
-        // so this is not strictly required.
-        // Keep it to recude cases.
-        if (removeNoneIntersecting(splAs, splBs)
-        ||  removeNoneIntersecting(splBs, splAs)
-        ) {
-            // They do not intersect at all.
-            return;
-        }
-
-        // TODO: Intersect/split the two series parts.
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/geom/VectorUtils.java	Fri Sep 28 12:14:44 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-package de.intevation.flys.artifacts.geom;
-
-import java.awt.geom.Point2D;
-
-public final class VectorUtils
-{
-    public static final double EPSILON = 1e-4;
-
-    private VectorUtils() {
-    }
-
-    public static final double X(Point2D p) {
-        return p.getX();
-    }
-
-    public static final double Y(Point2D p) {
-        return p.getY();
-    }
-
-    public static final Point2D sub(Point2D a, Point2D b) {
-        return new Point2D.Double(X(a)-X(b), Y(a)-Y(b));
-    }
-
-    public static final double dot(Point2D a, Point2D b) {
-        return X(a)*X(b) + Y(a)*Y(b);
-    }
-
-    public static final Point2D add(Point2D a, Point2D b) {
-        return new Point2D.Double(X(a)+X(b), Y(a)+Y(b));
-    }
-
-    public static final Point2D negate(Point2D a) {
-        return new Point2D.Double(-X(a), -Y(a));
-    }
-
-    public static final Point2D ortho(Point2D a) {
-        return new Point2D.Double(-Y(a), X(a));
-    }
-
-    public static final Point2D scale(Point2D a, double s) {
-        return new Point2D.Double(s*X(a), s*Y(a));
-    }
-
-    public static final double lengthSq(Point2D a) {
-        double x = X(a);
-        double y = Y(a);
-        return x*x + y*y;
-    }
-
-    public static final double length(Point2D a) {
-        return Math.sqrt(lengthSq(a));
-    }
-
-    public static final Point2D normalize(Point2D a) {
-        double length = length(a);
-        return length != 0d
-            ? scale(a, 1d/length)
-            : new Point2D.Double(X(a), Y(a));
-    }
-
-    public static final double L1(Point2D a, Point2D b) {
-        return Math.abs(X(a)-X(b)) + Math.abs(Y(a)-Y(b));
-    }
-
-    public static final boolean collinear(Point2D a, Point2D b, Point2D c) {
-        double x1 = X(a);
-        double y1 = Y(a);
-        double x2 = X(b);
-        double y2 = Y(b);
-        double x3 = X(c);
-        double y3 = Y(c);
-
-        return Math.abs((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1)) < EPSILON;
-    }
-
-    public static boolean epsilonEquals(Point2D a, Point2D b) {
-        return Math.abs(X(a)-X(b)) < EPSILON
-            && Math.abs(Y(a)-Y(b)) < EPSILON;
-    }
-
-    public static final Point2D intersection(
-        Point2D p1, Point2D p2,
-        Point2D p3, Point2D p4
-    ) {
-        double x1 = X(p1);
-        double y1 = Y(p1);
-        double x2 = X(p2);
-        double y2 = Y(p2);
-        double x3 = X(p3);
-        double y3 = Y(p3);
-        double x4 = X(p4);
-        double y4 = Y(p4);
-
-        // Compute a1, b1, c1, where line joining points 1 and 2
-        // is "a1 x + b1 y + c1 = 0".
-        double a1 = y2 - y1;
-        double b1 = x1 - x2;
-        double c1 = x2*y1 - x1*y2;
-
-        // Compute r3 and r4.
-        double r3 = a1*x3 + b1*y3 + c1;
-        double r4 = a1*x4 + b1*y4 + c1;
-
-        if (r3 != 0d && r4 != 0d && r3*r4 >= 0) {
-            return null;
-        }
-
-        // Compute a2, b2, c2
-        double a2 = y4 - y3;
-        double b2 = x3 - x4;
-        double c2 = (x4 * y3) - (x3 * y4);
-
-        // Compute r1 and r2
-        double r1 = a2*x1 + b2*y1 + c2;
-        double r2 = a2*x2 + b2*y2 + c2;
-
-        if (r1 != 0d && r2 != 0d && r1*r2 >= 0) {
-            return null;
-        }
-
-        // Line segments intersect: compute intersection point.
-        double denom = a1*b2 - a2*b1;
-
-        if (denom == 0d) { // collinear
-            return null;
-        }
-
-        double offset = Math.abs(denom)/2d;
-
-        // The denom/2 is to get rounding instead of truncating. It
-        // is added or subtracted to the numerator, depending upon the
-        // sign of the numerator.
-        double num = b1*c2 - b2*c1;
-
-        double x = num < 0d
-            ? (num - offset)/denom
-            : (num + offset)/denom;
-
-        num = a2*c1 - a1*c2;
-
-        double y = num < 0d
-            ? (num - offset)/denom
-            : (num + offset)/denom;
-
-        return new Point2D.Double(x, y);
-    }
-
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/Linear.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/math/Linear.java	Fri Sep 28 12:15:44 2012 +0200
@@ -64,5 +64,15 @@
         //return (1.0-factor)*a + factor*b;
         return a + factor*(b-a);
     }
+
+    public static final void weight(
+        double factor,
+        double [] a, double [] b, double [] c
+    ) {
+        int N = Math.min(Math.min(a.length, b.length), c.length);
+        for (int i = 0; i < N; ++i) {
+            c[i] = weight(factor, a[i], b[i]);
+        }
+    }
 }
 // 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/math/NaNFunction.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,16 @@
+package de.intevation.flys.artifacts.math;
+
+public final class NaNFunction
+implements         Function
+{
+    public static final Function INSTANCE = new NaNFunction();
+
+    private NaNFunction() {
+    }
+
+    @Override
+    public double value(double x) {
+        return Double.NaN;
+    }
+}
+// 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/math/UnivariateRealFunctionFunction.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,34 @@
+package de.intevation.flys.artifacts.math;
+
+import org.apache.commons.math.FunctionEvaluationException;
+
+import org.apache.commons.math.analysis.UnivariateRealFunction;
+
+public final class UnivariateRealFunctionFunction
+implements         Function
+{
+    private UnivariateRealFunction function;
+
+    public UnivariateRealFunctionFunction(UnivariateRealFunction function) {
+        this.function = function;
+    }
+
+    @Override
+    public double value(double x) {
+        try {
+            return function.value(x);
+        }
+        catch (FunctionEvaluationException fee) {
+            return Double.NaN;
+        }
+    }
+
+    public UnivariateRealFunction getFunction() {
+        return function;
+    }
+
+    public void setFunction(UnivariateRealFunction function) {
+        this.function = function;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AnnotationsFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -100,8 +100,7 @@
         riverQuery.setParameter("name", riverName);
         List<River> rivers = riverQuery.list();
         if (rivers.isEmpty()) {
-            List<Annotation> list = Collections.emptyList();
-            return list.iterator();
+            return Collections.<Annotation>emptyList().iterator();
         }
 
         Query query = session.createQuery(
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/AreaFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -27,8 +27,7 @@
  */
 public class AreaFacet
 extends      DefaultFacet
-implements   FacetTypes {
-
+{
     private static Logger logger = Logger.getLogger(AreaFacet.class);
 
     /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 28 12:15:44 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;
         }
@@ -215,6 +221,23 @@
     String MIDDLE_BED_HEIGHT_EPOCH      = "bedheight_middle.epoch";
     String MIDDLE_BED_HEIGHT_ANNOTATION = "bedheight_middle.annotation";
 
+    String BED_QUALITY_POROSITY_TOPLAYER         = "bed_longitudinal_section.porosity_toplayer";
+    String BED_QUALITY_POROSITY_SUBLAYER         = "bed_longitudinal_section.porosity_sublayer";
+    String BED_QUALITY_BED_DIAMETER_TOPLAYER     = "bed_longitudinal_section.bed_diameter_toplayer";
+    String BED_QUALITY_BED_DIAMETER_SUBLAYER     = "bed_longitudinal_section.bed_diameter_sublayer";
+    String BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER = "bed_longitudinal_section.sediment_density_toplayer";
+    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";
@@ -262,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";
@@ -275,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";
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FlowVelocityCalculation.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,18 +1,21 @@
 package de.intevation.flys.artifacts.model;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
-import org.apache.log4j.Logger;
+import de.intevation.artifacts.Artifact;
 
-import de.intevation.artifacts.Artifact;
+import de.intevation.flys.artifacts.access.FlowVelocityAccess;
+
+import de.intevation.flys.artifacts.model.RiverFactory;
+
 import de.intevation.flys.model.DischargeZone;
 import de.intevation.flys.model.FlowVelocityModel;
 import de.intevation.flys.model.FlowVelocityModelValue;
 import de.intevation.flys.model.River;
 
-import de.intevation.flys.artifacts.access.FlowVelocityAccess;
-import de.intevation.flys.utils.FLYSUtils;
+import org.apache.log4j.Logger;
 
 
 public class FlowVelocityCalculation extends Calculation {
@@ -80,7 +83,17 @@
         FlowVelocityAccess  access,
         List<DischargeZone> zones
     ) {
-        River river = FLYSUtils.getRiver(access.getArtifact());
+        String riverName = access.getRiver();
+        if (riverName == null) {
+            logger.warn("No river name found");
+            return Collections.<FlowVelocityModel>emptyList();
+        }
+
+        River river = RiverFactory.getRiver(riverName);
+        if (river == null) {
+            logger.warn("No such river: " + riverName);
+            return Collections.<FlowVelocityModel>emptyList();
+        }
 
         List<FlowVelocityModel> models = new ArrayList<FlowVelocityModel>();
 
--- /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:44 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/MainValuesFactory.java	Fri Sep 28 12:14:44 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-package de.intevation.flys.artifacts.model;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import org.hibernate.Session;
-import org.hibernate.Query;
-
-import de.intevation.flys.backend.SessionHolder;
-
-import de.intevation.flys.model.Gauge;
-import de.intevation.flys.model.MainValue;
-
-
-/**
- * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
- */
-public class MainValuesFactory {
-
-    private static Logger logger = Logger.getLogger(MainValuesFactory.class);
-
-    public static List<MainValue> getMainValues(Gauge gauge) {
-        Session session = SessionHolder.HOLDER.get();
-
-        Query query = session.createQuery(
-            "from MainValue where gauge=:gauge");
-        query.setParameter("gauge", gauge);
-
-        return query.list();
-    }
-}
-// 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/MainValuesQFacet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesQFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -28,7 +28,7 @@
 implements   FacetTypes {
 
     /** Own logger. */
-    private static Logger logger = Logger.getLogger(RelativePointFacet.class);
+    private static Logger logger = Logger.getLogger(MainValuesQFacet.class);
 
     /** Do we want MainValues at Gauge (not interpolated)? */
     protected boolean isAtGauge;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MainValuesWFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -25,7 +25,7 @@
 implements   FacetTypes {
 
     /** Own logger. */
-    private static Logger logger = Logger.getLogger(RelativePointFacet.class);
+    private static Logger logger = Logger.getLogger(MainValuesWFacet.class);
 
     /** Do we want MainValues at Gauge (not interpolated)? */
     protected boolean isAtGauge;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightCalculation.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/MiddleBedHeightData.java	Fri Sep 28 12:15:44 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/QRangeTree.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QRangeTree.java	Fri Sep 28 12:15:44 2012 +0200
@@ -212,6 +212,35 @@
         return root != null ? root.findQ(pos) : Double.NaN;
     }
 
+    protected Node head() {
+        Node head = root;
+        while (head.left != null) {
+            head = head.left;
+        }
+        return head;
+    }
+
+    public List<Range> findSegments(double a, double b) {
+        if (a > b) { double t = a; a = b; b = t; }
+        return findSegments(new Range(a, b));
+    }
+
+    public List<Range> findSegments(Range range) {
+        List<Range> segments = new ArrayList<Range>();
+
+        // Linear scan should be good enough here.
+        for (Node curr = head(); curr != null; curr = curr.next) {
+            if (!range.disjoint(curr.a, curr.b)) {
+                Range r = new Range(curr.a, curr.b);
+                if (r.clip(range)) {
+                    segments.add(r);
+                }
+            }
+        }
+
+        return segments;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QW.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,35 @@
+package de.intevation.flys.artifacts.model;
+
+import java.io.Serializable;
+
+public class QW
+implements   Serializable
+{
+    protected double q;
+    protected double w;
+
+    public QW() {
+    }
+
+    public QW(double q, double w) {
+        this.q = q;
+        this.w = w;
+    }
+
+    public double getQ() {
+        return q;
+    }
+
+    public void setQ(double q) {
+        this.q = q;
+    }
+
+    public double getW() {
+        return w;
+    }
+
+    public void setW(double w) {
+        this.w = w;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Range.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Range.java	Fri Sep 28 12:15:44 2012 +0200
@@ -30,6 +30,10 @@
         return end;
     }
 
+    public boolean disjoint(double ostart, double oend) {
+        return start > oend || ostart > end;
+    }
+
     public boolean disjoint(Range other) {
         return start > other.end || other.start > end;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RangeWithValues.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RangeWithValues.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,41 +1,32 @@
 package de.intevation.flys.artifacts.model;
 
-import java.io.Serializable;
-
+import java.util.Arrays;
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class RangeWithValues implements Serializable {
+public class RangeWithValues extends Range {
 
-    protected double   lower;
-    protected double   upper;
     protected double[] values;
 
-
     public RangeWithValues() {
     }
 
-
     public RangeWithValues(double lower, double upper, double[] values) {
-        this.lower  = lower;
-        this.upper  = upper;
+        super(lower, upper);
         this.values = values;
     }
 
-
-    public double getLower() {
-        return lower;
-    }
-
-
-    public double getUpper() {
-        return upper;
-    }
-
-
     public double[] getValues() {
         return values;
     }
+
+    @Override
+    public String toString() {
+        return new StringBuilder("start=").append(start)
+            .append(" end=" ).append(end)
+            .append(" values=[").append(Arrays.toString(values)).append(']')
+            .toString();
+    }
 }
 // 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/SQOverview.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/SQOverview.java	Fri Sep 28 12:15:44 2012 +0200
@@ -23,6 +23,7 @@
 public class SQOverview
 implements   Serializable
 {
+    private static Logger log = Logger.getLogger(SQOverview.class);
 
     /**
      * Serial version UId.
@@ -79,8 +80,6 @@
         }
     };
 
-    private static Logger log = Logger.getLogger(FixingsOverview.class);
-
     public static final double EPSILON = 1e-4;
 
     public static final String DATE_FORMAT = "dd.MM.yyyy";
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Segment.java	Fri Sep 28 12:15:44 2012 +0200
@@ -6,8 +6,6 @@
 
 import de.intevation.flys.utils.DoubleUtil;
 
-import gnu.trove.TDoubleArrayList;
-
 import java.io.Serializable;
 
 import java.util.ArrayList;
@@ -124,34 +122,14 @@
 
     public static List<Segment> parseSegments(String input) {
 
-        ArrayList<Segment> segments = new ArrayList<Segment>();
-
-        TDoubleArrayList vs = new TDoubleArrayList();
+        final List<Segment> segments = new ArrayList<Segment>();
 
-        for (String segmentStr: input.split(":")) {
-            String [] parts = segmentStr.split(";");
-            if (parts.length < 3) {
-                log.warn("invalid segment: '" + segmentStr + "'");
-                continue;
-            }
-            try {
-                double from = Double.parseDouble(parts[0].trim());
-                double to   = Double.parseDouble(parts[1].trim());
-
-                vs.clear();
-
-                for (String valueStr: parts[2].split(",")) {
-                    vs.add(DoubleUtil.round(
-                        Double.parseDouble(valueStr.trim())));
-                }
-
-                double [] values = vs.toNativeArray();
+        DoubleUtil.parseSegments(input, new DoubleUtil.SegmentCallback() {
+            @Override
+            public void newSegment(double from, double to, double [] values) {
                 segments.add(new Segment(from, to, values));
             }
-            catch (NumberFormatException nfe) {
-                log.warn("invalid segment: '" + segmentStr + "'");
-            }
-        }
+        });
 
         return segments;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1217,5 +1217,46 @@
         double q2 = columns[index  ].getQRangeTree().findQ(km);
         return Linear.weight(weight, q1, q2);
     }
+
+    public double [][] interpolateTabulated(double km) {
+        return interpolateTabulated(km, new double[2][columns.length]);
+    }
+
+    public double [][] interpolateTabulated(double km, double [][] result) {
+
+        int rowIndex = Collections.binarySearch(rows, new Row(km));
+
+        if (rowIndex >= 0) {
+            // Direct hit -> copy ws.
+            Row row = rows.get(rowIndex);
+            System.arraycopy(
+                row.ws, 0, result[0], 0,
+                Math.min(row.ws.length, result[0].length));
+        }
+        else {
+            rowIndex = -rowIndex -1;
+            if (rowIndex < 1 || rowIndex >= rows.size()) {
+                // Out of bounds.
+                return null;
+            }
+            // Interpolate ws.
+            Row r1 = rows.get(rowIndex-1);
+            Row r2 = rows.get(rowIndex);
+            double factor = Linear.factor(km, r1.km, r2.km);
+            Linear.weight(factor, r1.ws, r2.ws, result[0]);
+        }
+
+        double [] qs = result[1];
+        for (int i = Math.min(qs.length, columns.length)-1; i >= 0; --i) {
+            qs[i] = columns[i].getQRangeTree().findQ(km);
+        }
+        return result;
+    }
+
+    public List<Range> findSegments(double km1, double km2) {
+        return columns.length != 0
+            ? columns[columns.length-1].getQRangeTree().findSegments(km1, km2)
+            : Collections.<Range>emptyList();
+    }
 }
 // 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/extreme/Curve.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,107 @@
+package de.intevation.flys.artifacts.model.extreme;
+
+import de.intevation.flys.artifacts.math.Function;
+import de.intevation.flys.artifacts.math.NaNFunction;
+import de.intevation.flys.artifacts.math.UnivariateRealFunctionFunction;
+
+import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
+
+import java.io.Serializable;
+
+import java.lang.ref.SoftReference;
+
+import org.apache.commons.math.analysis.interpolation.SplineInterpolator;
+
+import org.apache.commons.math.exception.MathIllegalArgumentException;
+
+import org.apache.log4j.Logger;
+
+public class Curve
+implements   Serializable, Function
+{
+    private static Logger log = Logger.getLogger(Curve.class);
+
+    protected double [] qs;
+    protected double [] ws;
+    protected String    function;
+    protected double [] coeffs;
+
+    // The spline is pretty heavy weight so cache it with a soft ref only.
+    protected transient SoftReference<Function> spline;
+    protected transient Function                extrapolation;
+
+    public Curve() {
+    }
+
+    public Curve(
+        double [] qs,
+        double [] ws,
+        String    function,
+        double [] coeffs
+    ) {
+        this.qs       = qs;
+        this.ws       = ws;
+        this.function = function;
+        this.coeffs   = coeffs;
+    }
+
+    public double [] getQs() {
+        return qs;
+    }
+
+    public double [] getWs() {
+        return ws;
+    }
+
+    public String getFunction() {
+        return function;
+    }
+
+    public double [] getCoeffs() {
+        return coeffs;
+    }
+
+    @Override
+    public double value(double x) {
+        if (x < qs[0]) return Double.NaN;
+        return (x <= qs[qs.length-1]
+            ? getSpline()
+            : getExtrapolation()).value(x);
+    }
+
+    protected synchronized Function getExtrapolation() {
+        if (extrapolation == null) {
+            de.intevation.flys.artifacts.math.fitting.Function
+                f = FunctionFactory.getInstance().getFunction(function);
+
+            extrapolation = f != null
+                ? f.instantiate(coeffs)
+                : NaNFunction.INSTANCE;
+        }
+        return extrapolation;
+    }
+
+    protected synchronized Function getSpline() {
+        Function sp;
+        if (spline != null) {
+            if ((sp = spline.get()) != null) {
+                return sp;
+            }
+        }
+        spline = new SoftReference<Function>(sp = createSpline());
+        return sp;
+    }
+
+    protected Function createSpline() {
+        SplineInterpolator interpolator = new SplineInterpolator();
+        try {
+            return new UnivariateRealFunctionFunction(
+                interpolator.interpolate(qs, ws));
+        }
+        catch (MathIllegalArgumentException miae) {
+            log.debug("creation on spline failed", miae);
+            return NaNFunction.INSTANCE;
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCalculation.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,162 @@
+package de.intevation.flys.artifacts.model.extreme;
+
+import de.intevation.flys.artifacts.access.ExtremeAccess;
+
+import de.intevation.flys.artifacts.math.fitting.Function;
+import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
+
+import de.intevation.flys.artifacts.model.Calculation;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.RangeWithValues;
+import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.artifacts.model.WstValueTable;
+import de.intevation.flys.artifacts.model.WstValueTableFactory;
+
+import de.intevation.flys.model.River;
+
+import de.intevation.flys.utils.DoubleUtil;
+
+import java.util.List;
+
+public class ExtremeCalculation
+extends      Calculation
+{
+    protected String                river;
+    protected String                function;
+    protected double                from;
+    protected double                to;
+    protected double                step;
+    protected double                percent;
+    protected List<RangeWithValues> ranges;
+
+    public ExtremeCalculation() {
+    }
+
+    public ExtremeCalculation(ExtremeAccess access) {
+        String                river    = access.getRiver();
+        String                function = access.getFunction();
+        Double                from     = access.getFrom();
+        Double                to       = access.getTo();
+        Double                step     = access.getStep();
+        Double                percent  = access.getPercent();
+        List<RangeWithValues> ranges   = access.getRanges();
+
+        if (river == null) {
+            // TODO: i18n
+            addProblem("extreme.no.river");
+        }
+
+        if (function == null) {
+            // TODO: i18n
+            addProblem("extreme.no.function");
+        }
+
+        if (from == null) {
+            // TODO: i18n
+            addProblem("extreme.no.from");
+        }
+
+        if (to == null) {
+            // TODO: i18n
+            addProblem("extreme.no.to");
+        }
+
+        if (step == null) {
+            // TODO: i18n
+            addProblem("extreme.no.step");
+        }
+
+        if (percent == null) {
+            // TODO: i18n
+            addProblem("extreme.no.percent");
+        }
+
+        if (ranges == null) {
+            // TODO: i18n
+            addProblem("extreme.no.ranges");
+        }
+
+        if (!hasProblems()) {
+            this.river    = river;
+            this.function = function;
+            this.from     = Math.min(from, to);
+            this.to       = Math.max(from, to);
+            this.step     = Math.max(0.001d, Math.abs(step)/1000d);
+            this.percent  = Math.max(0d, Math.min(100d, percent));
+            this.ranges   = ranges;
+        }
+    }
+
+    public CalculationResult calculate() {
+
+        WstValueTable wst = null;
+
+        River river = RiverFactory.getRiver(this.river);
+        if (river == null) {
+            // TODO: i18n
+            addProblem("extreme.no.such.river", this.river);
+        }
+        else {
+            wst = WstValueTableFactory.getTable(river);
+            if (wst == null) {
+                // TODO: i18n
+                addProblem("extreme.no.wst.table");
+            }
+        }
+
+        Function function =
+            FunctionFactory.getInstance().getFunction(this.function);
+        if (function == null) {
+            // TODO: i18n
+            addProblem("extreme.no.such.function", this.function);
+        }
+
+        return hasProblems()
+            ? new CalculationResult(this)
+            : innerCalculate(wst, function);
+    }
+
+    protected CalculationResult innerCalculate(
+        WstValueTable wst,
+        Function      function
+    ) {
+        RangeWithValues range = null;
+
+        KMs: for (double km = from; km <= to; km += step) {
+            double currentKm = DoubleUtil.round(km);
+
+            if (range == null || !range.inside(currentKm)) {
+                for (RangeWithValues r: ranges) {
+                    if (r.inside(currentKm)) {
+                        range = r;
+                        break;
+                    }
+                }
+                // TODO: i18n
+                addProblem(currentKm, "extreme.no.range");
+                continue KMs;
+            }
+
+            double [][] wqs = wst.interpolateTabulated(currentKm);
+            if (wqs == null) {
+                // TODO: i18n
+                addProblem(currentKm, "extreme.no.raw.data");
+                continue;
+            }
+
+            // XXX: This should not be necessary for model data.
+            if (!DoubleUtil.isValid(wqs)) {
+                // TODO: i18n
+                addProblem(currentKm, "extreme.invalid.data");
+                continue;
+            }
+            // TODO: Implement extraction of points for curve fitting.
+            // TODO: Implement curve fitting.
+            // TODO: Implement generating Curve object per km.
+        }
+
+        ExtremeResult result = new ExtremeResult();
+        return new CalculationResult(result, this);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,11 @@
+package de.intevation.flys.artifacts.model.extreme;
+
+import java.io.Serializable;
+
+public class ExtremeResult
+implements   Serializable
+{
+    public ExtremeResult() {
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java	Fri Sep 28 12:15:44 2012 +0200
@@ -37,18 +37,18 @@
         }
     };
 
-    protected boolean       checkOutliers;
-    protected Function      function;
-    protected QWDFactory    qwdFactory;
-    protected double        chiSqr;
-    protected double []     parameters;
-    protected ArrayList<QW> removed;
-    protected QWD []        referenced;
-    protected double        standardDeviation;
+    protected boolean        checkOutliers;
+    protected Function       function;
+    protected QWDFactory     qwdFactory;
+    protected double         chiSqr;
+    protected double []      parameters;
+    protected ArrayList<QWI> removed;
+    protected QWD []         referenced;
+    protected double         standardDeviation;
 
 
     public Fitting() {
-        removed = new ArrayList<QW>();
+        removed = new ArrayList<QWI>();
     }
 
     public Fitting(Function function) {
@@ -102,12 +102,12 @@
         return !removed.isEmpty();
     }
 
-    public List<QW> getOutliers() {
+    public List<QWI> getOutliers() {
         return removed;
     }
 
-    public QW [] outliersToArray() {
-        return removed.toArray(new QW[removed.size()]);
+    public QWI [] outliersToArray() {
+        return removed.toArray(new QWI[removed.size()]);
     }
 
     public QWD [] referencedToArray() {
@@ -117,7 +117,7 @@
     public double getMaxQ() {
         double maxQ = -Double.MAX_VALUE;
         if (referenced != null) {
-            for (QW qw: referenced) {
+            for (QWI qw: referenced) {
                 if (qw.getQ() > maxQ) {
                     maxQ = qw.getQ();
                 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixAnalysisResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,5 +1,6 @@
 package de.intevation.flys.artifacts.model.fixings;
 
+import java.util.Collection;
 import java.util.Date;
 import java.util.TreeSet;
 
@@ -18,7 +19,7 @@
     public FixAnalysisResult(
         Parameters                 parameters,
         KMIndex<QWD []>            referenced,
-        KMIndex<QW []>             outliers,
+        KMIndex<QWI []>            outliers,
         KMIndex<AnalysisPeriod []> analysisPeriods
     ) {
         super(parameters, referenced, outliers);
@@ -40,24 +41,26 @@
         return result;
     }
 
-    public TreeSet<Date> getReferenceEventsDates() {
+    public Collection<Date> getReferenceEventsDates() {
         TreeSet<Date> dates = new TreeSet<Date>();
         for (KMIndex.Entry<QWD []> entry: referenced) {
-            for (int i = 0; i < entry.getValue().length; i++) {
-                QWD qwd = entry.getValue()[i];
-                dates.add(qwd.date);
+            QWD [] values = entry.getValue();
+            for (int i = 0; i < values.length; i++) {
+                dates.add(values[i].date);
             }
         }
         return dates;
     }
 
-    public TreeSet<Date> getAnalysisEventsDates(int analysisPeriod) {
+    public Collection<Date> getAnalysisEventsDates(int analysisPeriod) {
         TreeSet<Date> dates = new TreeSet<Date>();
         for (KMIndex.Entry<AnalysisPeriod []> entry: analysisPeriods) {
-            AnalysisPeriod period = entry.getValue()[analysisPeriod];
-            for (int i = 0; i < period.qwds.length; i++) {
-                QWD qwd = period.qwds[i];
-                dates.add(qwd.date);
+            QWD [] qwds = entry.getValue()[analysisPeriod].getQWDs();
+            if (qwds == null) {
+                continue;
+            }
+            for (int i = 0; i < qwds.length; i++) {
+                dates.add(qwds[i].date);
             }
         }
         return dates;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixCalculation.java	Fri Sep 28 12:15:44 2012 +0200
@@ -47,7 +47,7 @@
 
         protected Parameters      parameters;
         protected KMIndex<QWD []> referenced;
-        protected KMIndex<QW []>  outliers;
+        protected KMIndex<QWI []> outliers;
 
         public FitResult() {
         }
@@ -55,7 +55,7 @@
         public FitResult(
             Parameters      parameters,
             KMIndex<QWD []> referenced,
-            KMIndex<QW []>  outliers
+            KMIndex<QWI []> outliers
         ) {
             this.parameters = parameters;
             this.referenced = referenced;
@@ -70,7 +70,7 @@
             return referenced;
         }
 
-        public KMIndex<QW []> getOutliers() {
+        public KMIndex<QWI []> getOutliers() {
             return outliers;
         }
     } // class FitResult
@@ -323,7 +323,7 @@
             log.debug("number of kms: " + kms.length);
         }
 
-        KMIndex<QW []>  outliers   = new KMIndex<QW []>();
+        KMIndex<QWI []> outliers   = new KMIndex<QWI []>();
         KMIndex<QWD []> referenced = new KMIndex<QWD []>(kms.length);
 
         int kmIndex             = results.columnIndex("km");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixOutlierFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -65,15 +65,17 @@
             double currentKm =
                 ((Double)context.getContextValue("currentKm")).doubleValue();
 
-            KMIndex<QW []>       kmQWs    = result.getOutliers();
-            KMIndex.Entry<QW []> qwsEntry = kmQWs.binarySearch(currentKm);
+            KMIndex<QWI []>       kmQWs    = result.getOutliers();
+            KMIndex.Entry<QWI []> qwsEntry = kmQWs.binarySearch(currentKm);
 
-            QW[] qws = null;
-            if(qwsEntry != null) {
+            QWI [] qws = null;
+            if (qwsEntry != null) {
                 qws = qwsEntry.getValue();
 
-                logger.debug("Found " + (qws != null ? qws.length : 0)
-                    + " KMIndex.Entry for km " + currentKm);
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Found " + (qws != null ? qws.length : 0)
+                        + " KMIndex.Entry for km " + currentKm);
+                }
             }
             else {
                 logger.debug("Found no KMIndex.Entry for km " + currentKm);
@@ -81,10 +83,9 @@
 
             return qws;
         }
-        else {
-            logger.warn("Not an instance of FLYSArtifact.");
-            return null;
-        }
+
+        logger.warn("Not an instance of FLYSArtifact.");
+        return null;
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingResult.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixRealizingResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -17,7 +17,7 @@
     public FixRealizingResult(
         Parameters      parameters,
         KMIndex<QWD []> referenced,
-        KMIndex<QW []>  outliers,
+        KMIndex<QWI []> outliers,
         WQKms []        wqkms
     ) {
         super(parameters, referenced, outliers);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixResult.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -11,7 +11,7 @@
 {
     protected Parameters      parameters;
     protected KMIndex<QWD []> referenced;
-    protected KMIndex<QW []>  outliers;
+    protected KMIndex<QWI []> outliers;
 
     public FixResult() {
     }
@@ -19,7 +19,7 @@
     public FixResult(
         Parameters      parameters,
         KMIndex<QWD []> referenced,
-        KMIndex<QW []>  outliers
+        KMIndex<QWI []> outliers
     ) {
         this.parameters = parameters;
         this.referenced = referenced;
@@ -34,11 +34,11 @@
         this.referenced = referenced;
     }
 
-    public KMIndex<QW []> getOutliers() {
+    public KMIndex<QWI []> getOutliers() {
         return outliers;
     }
 
-    public void setOutliers(KMIndex<QW []> outliers) {
+    public void setOutliers(KMIndex<QWI []> outliers) {
         this.outliers = outliers;
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QW.java	Fri Sep 28 12:14:44 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-package de.intevation.flys.artifacts.model.fixings;
-
-import java.util.Date;
-
-import java.io.Serializable;
-
-public class QW
-implements   Serializable
-{
-    protected double  q;
-    protected double  w;
-    protected String  description;
-    protected Date    date;
-    protected boolean interpolated;
-    protected int     index;
-
-    public QW() {
-    }
-
-    public QW(double q, double w) {
-        this.q = q;
-        this.w = w;
-    }
-
-    public QW(
-        double  q,
-        double  w,
-        String  description,
-        Date    date,
-        boolean interpolated,
-        int     index
-    ) {
-        this(q, w);
-        this.description  = description;
-        this.date         = date;
-        this.interpolated = interpolated;
-        this.index        = index;
-    }
-
-    public double getQ() {
-        return q;
-    }
-
-    public void setQ(double q) {
-        this.q = q;
-    }
-
-    public double getW() {
-        return w;
-    }
-
-    public void setW(double w) {
-        this.w = w;
-    }
-
-    public Date getDate() {
-        return date;
-    }
-
-    public void setDate(Date date) {
-        this.date = date;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public boolean getInterpolated() {
-        return interpolated;
-    }
-
-    public void setInterpolated(boolean interpolated) {
-        this.interpolated = interpolated;
-    }
-
-    public int getIndex() {
-        return index;
-    }
-
-    public void setIndex(int index) {
-        this.index = index;
-    }
-}
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWD.java	Fri Sep 28 12:15:44 2012 +0200
@@ -3,7 +3,7 @@
 import java.util.Date;
 
 public class QWD
-extends      QW
+extends      QWI
 {
     protected double deltaW;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/QWI.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,69 @@
+package de.intevation.flys.artifacts.model.fixings;
+
+import de.intevation.flys.artifacts.model.QW;
+
+import java.util.Date;
+
+public class QWI
+extends      QW
+{
+    protected String  description;
+    protected Date    date;
+    protected boolean interpolated;
+    protected int     index;
+
+    public QWI() {
+    }
+
+    public QWI(double q, double w) {
+        super(q, w);
+    }
+
+    public QWI(
+        double  q,
+        double  w,
+        String  description,
+        Date    date,
+        boolean interpolated,
+        int     index
+    ) {
+        super(q, w);
+        this.description  = description;
+        this.date         = date;
+        this.interpolated = interpolated;
+        this.index        = index;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public boolean getInterpolated() {
+        return interpolated;
+    }
+
+    public void setInterpolated(boolean interpolated) {
+        this.interpolated = interpolated;
+    }
+
+    public int getIndex() {
+        return index;
+    }
+
+    public void setIndex(int index) {
+        this.index = index;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/map/WMSLayerFacet.java	Fri Sep 28 12:15:44 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/BedDensityFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,60 @@
+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;
+
+
+/**
+ * Facet for serving bed density data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDensityFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDensityFacet.class);
+
+    public BedDensityFacet() {
+    }
+
+    public BedDensityFacet(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);
+
+        int ndx = index >> 8;
+        Object[] data =
+            ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        return data != null && data.length > ndy ? data[ndy] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDensityFacet copy = new BedDensityFacet();
+        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/BedDiameterFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,59 @@
+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;
+
+
+/**
+ * Facet for serving bed diameter data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedDiameterFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedDiameterFacet.class);
+
+    public BedDiameterFacet() {
+    }
+
+    public BedDiameterFacet(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 diameter at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] data = ((BedQualityResult[]) res.getData())[ndx].getBedResults(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        return data != null && data.length > ndy ? data[ndy] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedDiameterFacet copy = new BedDiameterFacet();
+        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/BedDiameterResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,64 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+
+public class BedDiameterResult
+extends BedQualityDiameterResult
+{
+    protected TDoubleArrayList diameterCap;
+    protected TDoubleArrayList diameterSub;
+
+    public BedDiameterResult (
+        String type,
+        TDoubleArrayList diameterCap,
+        TDoubleArrayList diameterSub,
+        TDoubleArrayList km
+    ) {
+        super(type, km);
+        this.diameterCap = diameterCap;
+        this.diameterSub = diameterSub;
+    }
+
+    public double getDiameterCap(int ndx) {
+        if (diameterCap != null) {
+            return this.diameterCap.get(ndx);
+        }
+        return Double.NaN;
+    }
+
+    public double getDiameterSub(int ndx) {
+        if (diameterSub != null) {
+            return this.diameterSub.get(ndx);
+        }
+        return Double.NaN;
+    }
+
+    public double getDiameterCap(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return diameterCap.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double getDiameterSub(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return diameterSub.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double[][] getDiameterCapData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameterCap.toNativeArray()
+        };
+    }
+
+    public double[][] getDiameterSubData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameterSub.toNativeArray()
+        };
+    }
+}
--- /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:44 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:44 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:44 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:44 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:44 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:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeight.java	Fri Sep 28 12:15:44 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:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFactory.java	Fri Sep 28 12:15:44 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:44 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;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedOverview.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,200 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.type.StandardBasicTypes;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import de.intevation.flys.utils.KMIndex;
+
+public class BedOverview
+implements Serializable
+{
+    /**
+     * Serial version UId.
+     */
+    private static final long serialVersionUID = -7967134407371364911L;
+
+    public interface Filter {
+        boolean accept(KMIndex<List<Date>> entry);
+
+    } // interface Filter
+
+
+    public static final Filter ACCEPT = new Filter() {
+        public boolean accept(KMIndex<List<Date>> entry) {
+            return true;
+        }
+    };
+
+    public static class KmFilter implements Filter {
+
+        protected double km;
+
+        public KmFilter (double km) {
+            this.km = km;
+        }
+        public boolean accept(KMIndex<List<Date>> list) {
+            for (KMIndex.Entry<List<Date>> e: list){
+                if (e.getKm() == km) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    };
+
+    public static class DateFilter implements Filter {
+
+        protected Date date;
+
+        public DateFilter (Date date) {
+            this.date = date;
+        }
+
+        public boolean accept(KMIndex<List<Date>> list) {
+            for (KMIndex.Entry<List<Date>> e: list){
+                if (e.getValue().equals(this.date)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    };
+
+    private static Logger log = Logger.getLogger(BedOverview.class);
+
+    public static final double EPSILON = 1e-4;
+
+    public static final String DATE_FORMAT = "dd.MM.yyyy";
+
+    public static final String SQL_SQ =
+        "SELECT" +
+        "    so.km    AS km," +
+        "    so.datum AS datum " +
+        "FROM sohltest so " +
+        "    JOIN station s" +
+        "       ON so.stationid = s.stationid " +
+        "    JOIN gewaesser g " +
+        "       ON s.gewaesserid = g.gewaesserid " +
+        "WHERE" +
+        "    g.name = :name AND" +
+        "    so.km IS NOT NULL " +
+        "ORDER by" +
+        "    so.km, so.datum";
+
+    protected String       riverName;
+
+    protected KMIndex<List<Date>> entries;
+
+    public BedOverview() {
+        entries = new KMIndex<List<Date>>();
+    }
+
+    public BedOverview(String riverName) {
+        this();
+        this.riverName = riverName;
+    }
+
+    private static final boolean epsilonEquals(double a, double b) {
+        return Math.abs(a - b) < EPSILON;
+    }
+
+    protected void loadData(Session session) {
+        SQLQuery query = session.createSQLQuery(SQL_SQ)
+            .addScalar("km",    StandardBasicTypes.DOUBLE)
+            .addScalar("datum", StandardBasicTypes.DATE);
+
+        query.setString("name", riverName);
+
+        List<Object []> list = query.list();
+
+        if (list.isEmpty()) {
+            log.warn("No river '" + riverName + "' found.");
+        }
+
+        Double prevKm = -Double.MAX_VALUE;
+        List<Date> dates = new ArrayList<Date>();
+
+        for (Object [] row: list) {
+            Double km = (Double)row[0];
+            if (!epsilonEquals(km, prevKm) && !dates.isEmpty()) {
+                entries.add(prevKm, dates);
+                dates = new ArrayList<Date>();
+            }
+            dates.add((Date)row[1]);
+            prevKm = km;
+        }
+
+        if (!dates.isEmpty()) {
+            entries.add(prevKm, dates);
+        }
+    }
+
+    public boolean load(Session session) {
+
+        loadData(session);
+
+        return true;
+    }
+
+
+    public void generateOverview(Document document) {
+        generateOverview(document, ACCEPT);
+    }
+
+    public KMIndex<List<Date>> filter(Filter f) {
+        // TODO: Apply filter
+        return entries;
+    }
+
+    public void generateOverview(
+        Document document,
+        Filter   filter
+    ) {
+        KMIndex<List<Date>> filtered = filter(ACCEPT);
+
+        Element sqElement = document.createElement("bed");
+
+        Element riverElement = document.createElement("river");
+
+        riverElement.setAttribute("name", riverName);
+
+        sqElement.appendChild(riverElement);
+
+        SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
+
+        Element kmE = document.createElement("km");
+
+        for (KMIndex.Entry<List<Date>> e: filtered) {
+
+            List<Date> dates = e.getValue();
+
+            if (!dates.isEmpty()) {
+                Element dEs = document.createElement("dates");
+
+                for (Date d: dates) {
+                    Element dE = document.createElement("date");
+
+                    dE.setAttribute("value", df.format(d));
+
+                    dEs.appendChild(dE);
+                }
+
+                kmE.appendChild(dEs);
+            }
+        }
+
+        sqElement.appendChild(kmE);
+
+        document.appendChild(sqElement);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedOverviewFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,70 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Session;
+
+import de.intevation.flys.artifacts.cache.CacheFactory;
+import de.intevation.flys.backend.SedDBSessionHolder;
+
+public class BedOverviewFactory {
+
+    private static Logger log = Logger.getLogger(BedOverviewFactory.class);
+
+    public static final String CACHE_NAME = "sq-overviews";
+
+    private BedOverviewFactory() {
+    }
+
+
+    public static BedOverview getOverview(String river) {
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug(
+                "Looking for bed overview for river '" + river + "'");
+        }
+
+        Cache cache = CacheFactory.getCache(CACHE_NAME);
+
+        if (cache == null) {
+            if (debug) {
+                log.debug("Cache not configured.");
+            }
+            return getUncached(river);
+        }
+
+        String key = "bed-over-" + river;
+
+        Element element = cache.get(key);
+
+        if (element != null) {
+            if (debug) {
+                log.debug("Overview found in cache");
+            }
+            return (BedOverview)element.getValue();
+        }
+
+        BedOverview overview = getUncached(river);
+
+        if (overview != null) {
+            if (debug) {
+                log.debug("Store overview in cache.");
+            }
+            cache.put(new Element(key, overview));
+        }
+
+        return overview;
+    }
+
+    public static BedOverview getUncached(String river) {
+        BedOverview overview = new BedOverview(river);
+
+        Session session = SedDBSessionHolder.HOLDER.get();
+
+        return overview.load(session) ? overview : null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedParametersResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,106 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.io.Serializable;
+
+
+public class BedParametersResult
+implements Serializable
+{
+    protected TDoubleArrayList porosityCap;
+    protected TDoubleArrayList porositySub;
+    protected TDoubleArrayList loadDensityCap;
+    protected TDoubleArrayList loadDensitySub;
+    protected TDoubleArrayList kms;
+
+    public BedParametersResult() {
+
+    }
+
+    public BedParametersResult(
+        TDoubleArrayList kms,
+        TDoubleArrayList porosityCap,
+        TDoubleArrayList porositySub,
+        TDoubleArrayList densityCap,
+        TDoubleArrayList densitySub
+    ) {
+        this.kms = kms;
+        this.porosityCap = porosityCap;
+        this.porositySub = porositySub;
+        this.loadDensityCap = densityCap;
+        this.loadDensitySub = densitySub;
+    }
+
+    public double getPorosityCap(int ndx) {
+        return porosityCap.get(ndx);
+    }
+
+    public double getPorositySub(int ndx) {
+        return porositySub.get(ndx);
+    }
+
+    public double getLoadDensityCap(int ndx) {
+        return loadDensityCap.get(ndx);
+    }
+
+    public double getLoadDensitySub(int ndx) {
+        return loadDensitySub.get(ndx);
+    }
+
+    public double getPorosityCap(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return porosityCap.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double getPorositySub(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return porositySub.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double getLoadDensityCap(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return loadDensityCap.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double getLoadDensitySub(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return loadDensitySub.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double[][] getPorosityCapData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            porosityCap.toNativeArray()
+        };
+    }
+
+    public double[][] getPorositySubData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            porositySub.toNativeArray()
+        };
+    }
+
+    public double[][] getDensityCapData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            loadDensityCap.toNativeArray()
+        };
+    }
+
+    public double[][] getDensitySubData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            loadDensitySub.toNativeArray()
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedPorosityFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,59 @@
+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;
+
+
+/**
+ * Facet for serving bed porosity data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedPorosityFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedPorosityFacet.class);
+
+    public BedPorosityFacet() {
+    }
+
+    public BedPorosityFacet(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 porosity at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] data = ((BedQualityResult[]) res.getData())[ndx].getParameters(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        return data != null && data.length > ndy ? data[ndy] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedPorosityFacet copy = new BedPorosityFacet();
+        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/BedQualityCalculation.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,331 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.access.BedQualityAccess;
+import de.intevation.flys.artifacts.model.Calculation;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DateRange;
+import de.intevation.flys.backend.SedDBSessionHolder;
+
+
+public class BedQualityCalculation extends Calculation {
+
+    private static final Logger logger = Logger
+        .getLogger(BedQualityCalculation.class);
+
+    protected String river;
+    protected double from;
+    protected double to;
+    protected List<String> bedDiameter;
+    protected List<String> bedloadDiameter;
+    protected List<DateRange> ranges;
+
+    public BedQualityCalculation() {
+    }
+
+    public CalculationResult calculate(BedQualityAccess access) {
+        logger.info("BedQualityCalculation.calculate");
+
+        String river = access.getRiver();
+        Double from = access.getFrom();
+        Double to = access.getTo();
+        List<String> bedDiameter = access.getBedDiameter();
+        List<String> bedloadDiameter = access.getBedloadDiameter();
+        List<DateRange> ranges = access.getDateRanges();
+
+        if (river == null) {
+            // TODO: i18n
+            addProblem("minfo.missing.river");
+        }
+
+        if (from == null) {
+            // TODO: i18n
+            addProblem("minfo.missing.from");
+        }
+
+        if (to == null) {
+            // TODO: i18n
+            addProblem("minfo.missing.to");
+        }
+
+        if (ranges == null) {
+            // TODO: i18n
+            addProblem("minfo.missing.periods");
+        }
+
+        if (!hasProblems()) {
+            this.river = river;
+            this.from = from;
+            this.to = to;
+            this.ranges = ranges;
+            this.bedDiameter = bedDiameter;
+            this.bedloadDiameter = bedloadDiameter;
+
+            SedDBSessionHolder.acquire();
+            try {
+                return internalCalculate();
+            }
+            finally {
+                SedDBSessionHolder.release();
+            }
+        }
+
+        return new CalculationResult();
+    }
+
+    protected CalculationResult internalCalculate() {
+
+        List<BedQualityResult> results = new LinkedList<BedQualityResult>();
+        // Calculate for all time periods.
+        for (DateRange dr : ranges) {
+            QualityMeasurements loadMeasurements =
+                QualityMeasurementFactory.getBedloadMeasurements(
+                    river,
+                    from,
+                    to,
+                    dr.getFrom(),
+                    dr.getTo());
+            QualityMeasurements bedMeasurements =
+                QualityMeasurementFactory.getBedMeasurements(
+                    river,
+                    from,
+                    to,
+                    dr.getFrom(),
+                    dr.getTo());
+            BedQualityResult result = new BedQualityResult();
+            result.setDateRange(dr);
+            if (bedDiameter != null) {
+                result.add(calculateBedParameter(bedMeasurements, dr));
+                for (String bd : bedDiameter) {
+                    BedDiameterResult bedResult =
+                        calculateBed(bedMeasurements, bd, dr);
+
+                    // Avoid adding empty result sets.
+                    if (!bedResult.isEmpty()) {
+                        result.add(bedResult);
+                    }
+                }
+            }
+            if (bedloadDiameter != null) {
+                for (String bld : bedloadDiameter) {
+                    BedloadDiameterResult loadResult =
+                        calculateBedload(loadMeasurements, bld, dr);
+                    result.add(loadResult);
+                }
+            }
+            results.add(result);
+        }
+
+        return new CalculationResult(
+            results.toArray(new BedQualityResult[results.size()]), this);
+    }
+
+    private BedParametersResult calculateBedParameter(
+        QualityMeasurements qm,
+        DateRange dr
+    ) {
+        List<Double> kms = qm.getKms();
+        QualityMeasurements capFiltered = filterCapMeasurements(qm);
+        QualityMeasurements subFiltered = filterSubMeasurements(qm);
+        TDoubleArrayList location = new TDoubleArrayList();
+        TDoubleArrayList porosityCap = new TDoubleArrayList();
+        TDoubleArrayList porositySub = new TDoubleArrayList();
+        TDoubleArrayList densityCap = new TDoubleArrayList();
+        TDoubleArrayList densitySub = new TDoubleArrayList();
+
+        for(double km : kms) {
+            double[] pCap = calculatePorosity(capFiltered, km);
+            double[] pSub = calculatePorosity(subFiltered, km);
+            double[] dCap = calculateDensity(capFiltered, pCap);
+            double[] dSub = calculateDensity(subFiltered, pSub);
+
+            double pCapRes = 0d;
+            double pSubRes = 0d;
+            double dCapRes = 0d;
+            double dSubRes = 0d;
+            for (int i = 0; i < pCap.length; i++) {
+                pCapRes += pCap[i];
+                dCapRes += dCap[i];
+            }
+            for (int i = 0; i < pSub.length; i++) {
+                pSubRes += pSub[i];
+                dSubRes += dSub[i];
+            }
+            location.add(km);
+            porosityCap.add((pCapRes / pCap.length) * 100 );
+            porositySub.add((pSubRes / pSub.length) * 100);
+            densityCap.add((dCapRes / dCap.length) / 1000);
+            densitySub.add((dSubRes / dSub.length) / 1000);
+
+        }
+
+        return new BedParametersResult(
+            location,
+            porosityCap,
+            porositySub,
+            densityCap,
+            densitySub);
+    }
+
+    protected BedDiameterResult calculateBed(
+        QualityMeasurements qm,
+        String diameter,
+        DateRange range
+    ) {
+        List<Double> kms = qm.getKms();
+        TDoubleArrayList location = new TDoubleArrayList();
+        TDoubleArrayList avDiameterCap = new TDoubleArrayList();
+        TDoubleArrayList avDiameterSub = new TDoubleArrayList();
+        for (double km : kms) {
+            //Filter cap and sub measurements.
+            QualityMeasurements capFiltered = filterCapMeasurements(qm);
+            QualityMeasurements subFiltered = filterSubMeasurements(qm);
+
+            List<QualityMeasurement> cm = capFiltered.getMeasurements(km);
+            List<QualityMeasurement> sm = subFiltered.getMeasurements(km);
+
+            double avCap = calculateAverage(cm, diameter);
+            double avSub = calculateAverage(sm, diameter);
+            location.add(km);
+            avDiameterCap.add(avCap);
+            avDiameterSub.add(avSub);
+        }
+        return new BedDiameterResult(
+            diameter,
+            avDiameterCap,
+            avDiameterSub,
+            location);
+    }
+
+    private double[] calculateDensity(
+        QualityMeasurements capFiltered,
+        double[] porosity
+    ) {
+        double[] density = new double[porosity.length];
+        for (int i = 0; i < porosity.length; i++) {
+            density[i] = (1 - porosity[i]) * 2650;
+        }
+        return density;
+    }
+
+    private double[] calculatePorosity(
+        QualityMeasurements capFiltered,
+        double km
+    ) {
+        List<QualityMeasurement> list = capFiltered.getMeasurements(km);
+        double[] results = new double[list.size()];
+        int i = 0;
+        for (QualityMeasurement qm : list) {
+            double deviation = calculateDeviation(qm);
+            double p = calculateP(qm);
+            double porosity = 0.353 - 0.068 * deviation + 0.146 * p;
+            results[i] = porosity;
+            i++;
+        }
+
+        return results;
+    }
+
+    protected BedloadDiameterResult calculateBedload(
+        QualityMeasurements qm,
+        String diameter,
+        DateRange range
+    ) {
+        List<Double> kms = qm.getKms();
+        TDoubleArrayList location = new TDoubleArrayList();
+        TDoubleArrayList avDiameter = new TDoubleArrayList();
+        for (double km : kms) {
+            List<QualityMeasurement> measurements = qm.getMeasurements(km);
+            double mid = calculateAverage(measurements, diameter);
+            location.add(km);
+            avDiameter.add(mid);
+        }
+        return new BedloadDiameterResult(
+            diameter,
+            avDiameter,
+            location,
+            range);
+    }
+
+    protected double calculateAverage(
+        List<QualityMeasurement> list,
+        String diameter
+    ) {
+        double av = 0;
+        for (QualityMeasurement qm : list) {
+            av += qm.getDiameter(diameter);
+        }
+        return av/list.size();
+    }
+
+    protected QualityMeasurements filterCapMeasurements(
+        QualityMeasurements qms
+    ) {
+        List<QualityMeasurement> result = new LinkedList<QualityMeasurement>();
+        for (QualityMeasurement qm : qms.getMeasurements()) {
+            if (qm.getDepth1() == 0d && qm.getDepth2() <= 0.3) {
+                result.add(qm);
+            }
+        }
+        return new QualityMeasurements(result);
+    }
+
+    protected QualityMeasurements filterSubMeasurements(
+        QualityMeasurements qms
+    ) {
+        List<QualityMeasurement> result = new LinkedList<QualityMeasurement>();
+        for (QualityMeasurement qm : qms.getMeasurements()) {
+            if (qm.getDepth1() > 0d && qm.getDepth2() <= 0.5) {
+                result.add(qm);
+            }
+        }
+        return new QualityMeasurements(result);
+    }
+
+    public double calculateDeviation(QualityMeasurement qm) {
+        Map<String, Double> dm = qm.getAllDiameter();
+        double phiM = 0;
+        double[] phis = new double[dm.size()];
+        double[] ps = new double[dm.size()];
+        int i = 0;
+        for (String key : dm.keySet()) {
+            double d = dm.get(key);
+            double phi = -Math.log(d)/Math.log(2);
+            phis[i] = phi;
+            double p = calculateWeight(qm, key);
+            ps[i] = p;
+            phiM += phi * p;
+            i++;
+        }
+
+        double sig = 0d;
+        for (i = 0; i < dm.size(); i++) {
+            sig += ps[i] * Math.exp(phis[i] - phiM);
+        }
+        double deviation = Math.sqrt(sig);
+        return deviation;
+    }
+
+    protected double calculateP(QualityMeasurement qm) {
+        return calculateWeight(qm, "dmin");
+    }
+
+    public double calculateWeight(QualityMeasurement qm, String diameter) {
+        Map<String, Double> dm = qm.getAllDiameter();
+        double value = qm.getDiameter(diameter);
+
+        double sum = 0d;
+        for (Double d : dm.values()) {
+            sum =+ d.doubleValue();
+        }
+        double weight = sum/100*value;
+        return weight;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityDiameterResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,61 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.io.Serializable;
+
+public class BedQualityDiameterResult implements Serializable {
+
+    public static enum DIAMETER_TYPE {
+        D90,
+        D84,
+        D80,
+        D75,
+        D70,
+        D60,
+        D50,
+        D40,
+        D30,
+        D25,
+        D20,
+        D16,
+        D10,
+        DMIN,
+        DMAX
+    }
+
+    protected DIAMETER_TYPE type;
+    protected TDoubleArrayList kms;
+    protected boolean empty;
+
+    public BedQualityDiameterResult () {
+        empty = true;
+    }
+
+    public BedQualityDiameterResult (
+        String type,
+        TDoubleArrayList km
+    ) {
+        if (km.size() > 0) {
+            empty = false;
+        }
+        this.type = DIAMETER_TYPE.valueOf(type.toUpperCase());
+        this.kms = km;
+    }
+
+    public DIAMETER_TYPE getType() {
+        return this.type;
+    }
+
+    public TDoubleArrayList getKms() {
+        return this.kms;
+    }
+
+    public void setType(DIAMETER_TYPE type) {
+        this.type = type;
+    }
+
+    public boolean isEmpty() {
+        return empty;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,69 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import de.intevation.flys.artifacts.model.DateRange;
+
+public class BedQualityResult
+implements Serializable
+{
+
+    protected List<BedDiameterResult> bedResults;
+    protected List<BedloadDiameterResult> bedloadResults;
+    protected List<BedParametersResult> bedParameters;
+    protected DateRange dateRange;
+
+    public BedQualityResult () {
+        bedResults = new LinkedList<BedDiameterResult>();
+        bedloadResults = new LinkedList<BedloadDiameterResult>();
+        bedParameters = new LinkedList<BedParametersResult>();
+    };
+
+    public BedQualityResult (
+        List<BedDiameterResult> bedResults,
+        List<BedloadDiameterResult> bedloadResults,
+        List<BedParametersResult> bedParameters,
+        DateRange range
+    ) {
+        this.dateRange = range;
+        this.bedResults = bedResults;
+        this.bedloadResults = bedloadResults;
+        this.bedParameters = bedParameters;
+    }
+
+    public BedParametersResult[] getParameters() {
+        return bedParameters.toArray(
+            new BedParametersResult[bedParameters.size()]);
+    }
+
+    public BedDiameterResult[] getBedResults() {
+        return bedResults.toArray(new BedDiameterResult[bedResults.size()]);
+    }
+
+    public BedloadDiameterResult[] getBedloadResults() {
+        return bedloadResults.toArray(
+            new BedloadDiameterResult[bedloadResults.size()]);
+    }
+
+    public void add(BedloadDiameterResult result) {
+        bedloadResults.add(result);
+    }
+
+    public void add(BedDiameterResult result) {
+        bedResults.add(result);
+    }
+
+    public void add(BedParametersResult result) {
+        bedParameters.add(result);
+    }
+
+    public DateRange getDateRange() {
+        return dateRange;
+    }
+
+    public void setDateRange(DateRange range) {
+        this.dateRange = range;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadDiameterFacet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,61 @@
+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;
+
+
+/**
+ * Facet for serving bedload diameter data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedloadDiameterFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger logger = Logger.getLogger(BedloadDiameterFacet.class);
+
+    public BedloadDiameterFacet() {
+        // required for clone operation deepCopy()
+    }
+
+    public BedloadDiameterFacet(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 bedload diameter at index: " + index);
+
+        FLYSArtifact flys = (FLYSArtifact) artifact;
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+        Object[] data =
+            ((BedQualityResult[]) res.getData())[ndx].getBedloadResults(); // TODO CAST TO SPECIFIC CLASS
+
+        int ndy = index & 255;
+        return data != null && data.length > ndy ? data[ndy] : null;
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedloadDiameterFacet copy = new BedloadDiameterFacet();
+        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/BedloadDiameterResult.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,42 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import de.intevation.flys.artifacts.model.DateRange;
+import gnu.trove.TDoubleArrayList;
+
+
+public class BedloadDiameterResult
+extends BedQualityDiameterResult
+{
+    protected TDoubleArrayList diameter;
+
+    public BedloadDiameterResult(
+        String type,
+        TDoubleArrayList diameter,
+        TDoubleArrayList km,
+        DateRange range
+    ) {
+        super (type, km);
+        this.diameter = diameter;
+    }
+
+    public double getDiameter(int ndx) {
+        if (diameter != null) {
+            return this.diameter.get(ndx);
+        }
+        return Double.NaN;
+    }
+
+    public double getDiameter(double km) {
+        if (kms.indexOf(km) >= 0) {
+            return diameter.get(kms.indexOf(km));
+        }
+        return Double.NaN;
+    }
+
+    public double[][] getDiameterData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameter.toNativeArray()
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverview.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,199 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.io.Serializable;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.type.StandardBasicTypes;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import de.intevation.flys.utils.KMIndex;
+
+public class BedloadOverview implements Serializable {
+
+    private static Logger log = Logger.getLogger(BedloadOverview.class);
+
+    /**
+     * Serial version UId.
+     */
+    private static final long serialVersionUID = -7607668985959407096L;
+
+    public interface Filter {
+        boolean accept(KMIndex<List<Date>> entry);
+
+    } // interface Filter
+
+
+    public static final Filter ACCEPT = new Filter() {
+        public boolean accept(KMIndex<List<Date>> entry) {
+            return true;
+        }
+    };
+
+    public static class KmFilter implements Filter {
+
+        protected double km;
+
+        public KmFilter (double km) {
+            this.km = km;
+        }
+        public boolean accept(KMIndex<List<Date>> list) {
+            for (KMIndex.Entry<List<Date>> e: list){
+                if (e.getKm() == km) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    };
+
+    public static class DateFilter implements Filter {
+
+        protected Date date;
+
+        public DateFilter (Date date) {
+            this.date = date;
+        }
+
+        public boolean accept(KMIndex<List<Date>> list) {
+            for (KMIndex.Entry<List<Date>> e: list){
+                if (e.getValue().equals(this.date)) {
+                    return true;
+                }
+            }
+            return false;
+        }
+    };
+
+    public static final double EPSILON = 1e-4;
+
+    public static final String DATE_FORMAT = "dd.MM.yyyy";
+
+    public static final String SQL_SQ =
+        "SELECT" +
+        "    m.km    AS km," +
+        "    m.datum AS datum " +
+        "FROM messung m " +
+        "    JOIN station s" +
+        "       ON m.stationid = s.stationid " +
+        "    JOIN gewaesser g " +
+        "       ON s.gewaesserid = g.gewaesserid " +
+        "WHERE" +
+        "    g.name = :name AND " +
+        "    m.km IS NOT NULL " +
+        "ORDER by" +
+        "    m.km, m.datum";
+
+    protected String       riverName;
+
+    protected KMIndex<List<Date>> entries;
+
+    public BedloadOverview() {
+        entries = new KMIndex<List<Date>>();
+    }
+
+    public BedloadOverview(String riverName) {
+        this();
+        this.riverName = riverName;
+    }
+
+    private static final boolean epsilonEquals(double a, double b) {
+        return Math.abs(a - b) < EPSILON;
+    }
+
+    protected void loadData(Session session) {
+        SQLQuery query = session.createSQLQuery(SQL_SQ)
+            .addScalar("km",    StandardBasicTypes.DOUBLE)
+            .addScalar("datum", StandardBasicTypes.DATE);
+
+        query.setString("name", riverName);
+
+        List<Object []> list = query.list();
+
+        if (list.isEmpty()) {
+            log.warn("No river '" + riverName + "' found.");
+        }
+
+        Double prevKm = -Double.MAX_VALUE;
+        List<Date> dates = new ArrayList<Date>();
+
+        for (Object [] row: list) {
+            Double km = (Double)row[0];
+            if (!epsilonEquals(km, prevKm) && !dates.isEmpty()) {
+                entries.add(prevKm, dates);
+                dates = new ArrayList<Date>();
+            }
+            dates.add((Date)row[1]);
+            prevKm = km;
+        }
+
+        if (!dates.isEmpty()) {
+            entries.add(prevKm, dates);
+        }
+    }
+
+    public boolean load(Session session) {
+
+        loadData(session);
+
+        return true;
+    }
+
+
+    public void generateOverview(Document document) {
+        generateOverview(document, ACCEPT);
+    }
+
+    public KMIndex<List<Date>> filter(Filter f) {
+        // TODO: Apply filter
+        return entries;
+    }
+
+    public void generateOverview(
+        Document document,
+        Filter   filter
+    ) {
+        KMIndex<List<Date>> filtered = filter(ACCEPT);
+
+        Element sqElement = document.createElement("bedload");
+
+        Element riverElement = document.createElement("river");
+
+        riverElement.setAttribute("name", riverName);
+
+        sqElement.appendChild(riverElement);
+
+        SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT);
+
+        Element kmE = document.createElement("km");
+
+        for (KMIndex.Entry<List<Date>> e: filtered) {
+
+            List<Date> dates = e.getValue();
+
+            if (!dates.isEmpty()) {
+                Element dEs = document.createElement("dates");
+
+                for (Date d: dates) {
+                    Element dE = document.createElement("date");
+
+                    dE.setAttribute("value", df.format(d));
+
+                    dEs.appendChild(dE);
+                }
+
+                kmE.appendChild(dEs);
+            }
+        }
+
+        sqElement.appendChild(kmE);
+
+        document.appendChild(sqElement);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedloadOverviewFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,70 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.hibernate.Session;
+
+import de.intevation.flys.artifacts.cache.CacheFactory;
+import de.intevation.flys.backend.SedDBSessionHolder;
+
+public class BedloadOverviewFactory {
+
+    private static Logger log = Logger.getLogger(BedloadOverviewFactory.class);
+
+    public static final String CACHE_NAME = "sq-overviews";
+
+    private BedloadOverviewFactory() {
+    }
+
+
+    public static BedloadOverview getOverview(String river) {
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug(
+                "Looking for bedload overview for river '" + river + "'");
+        }
+
+        Cache cache = CacheFactory.getCache(CACHE_NAME);
+
+        if (cache == null) {
+            if (debug) {
+                log.debug("Cache not configured.");
+            }
+            return getUncached(river);
+        }
+
+        String key = "bedload-over-" + river;
+
+        Element element = cache.get(key);
+
+        if (element != null) {
+            if (debug) {
+                log.debug("Overview found in cache");
+            }
+            return (BedloadOverview)element.getValue();
+        }
+
+        BedloadOverview overview = getUncached(river);
+
+        if (overview != null) {
+            if (debug) {
+                log.debug("Store overview in cache.");
+            }
+            cache.put(new Element(key, overview));
+        }
+
+        return overview;
+    }
+
+    public static BedloadOverview getUncached(String river) {
+        BedloadOverview overview = new BedloadOverview(river);
+
+        Session session = SedDBSessionHolder.HOLDER.get();
+
+        return overview.load(session) ? overview : null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurement.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,80 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.Date;
+import java.util.Map;
+
+
+public class QualityMeasurement {
+
+    private double              km;
+    private Date                date;
+    private double              depth1;
+    private double              depth2;
+    private Map<String, Double> charDiameter;
+
+    public QualityMeasurement() {
+
+    }
+
+    public QualityMeasurement(
+        double km,
+        Date date,
+        double depth1,
+        double depth2,
+        Map<String, Double> diameter) {
+        this.setKm(km);
+        this.setDate(date);
+        this.depth1 = depth1;
+        this.depth2 = depth2;
+        this.setDiameter(diameter);
+    }
+
+    public double getKm() {
+        return km;
+    }
+
+    public void setKm(double km) {
+        this.km = km;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Map<String, Double> getAllDiameter() {
+        return charDiameter;
+    }
+
+    public void setDiameter(Map<String, Double> charDiameter) {
+        this.charDiameter = charDiameter;
+    }
+
+    public double getDiameter(String key) {
+        return charDiameter.get(key);
+    }
+
+    public void setDiameter(String key, double value) {
+        charDiameter.put(key, value);
+    }
+
+    public double getDepth1() {
+        return depth1;
+    }
+
+    public void setDepth1(double depth1) {
+        this.depth1 = depth1;
+    }
+
+    public double getDepth2() {
+        return depth2;
+    }
+
+    public void setDepth2(double depth2) {
+        this.depth2 = depth2;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,203 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.hibernate.SQLQuery;
+import org.hibernate.Session;
+import org.hibernate.transform.BasicTransformerAdapter;
+import org.hibernate.type.StandardBasicTypes;
+
+import de.intevation.flys.backend.SedDBSessionHolder;
+
+
+public class QualityMeasurementFactory {
+
+    private static Logger logger = Logger.getLogger(QualityMeasurementFactory.class);
+
+    private static final String SQL_BED_MEASUREMENT =
+        "SELECT st.km       as km," +
+        "       st.datum    as datum," +
+        "       sp.tiefevon as depth1," +
+        "       sp.tiefebis as depth2," +
+        "       sa.d10      as d10," +
+        "       sa.d16      as d16," +
+        "       sa.d20      as d20," +
+        "       sa.d25      as d25," +
+        "       sa.d30      as d30," +
+        "       sa.d40      as d40," +
+        "       sa.d50      as d50," +
+        "       sa.d60      as d60," +
+        "       sa.d70      as d70," +
+        "       sa.d75      as d75," +
+        "       sa.d80      as d80," +
+        "       sa.d84      as d84," +
+        "       sa.d90      as d90," +
+        "       sa.dmin     as dmin," +
+        "       sa.dmax     as dmax " +
+        "FROM sohltest st " +
+        "    JOIN station sn ON sn.stationid = st.stationid " +
+        "    JOIN gewaesser gw ON gw.gewaesserid = sn.gewaesserid " +
+        "    JOIN sohlprobe sp ON sp.sohltestid = st.sohltestid " +
+        "    JOIN siebanalyse sa ON sa.sohlprobeid = sp.sohlprobeid " +
+        "WHERE gw.name = :name AND " +
+        "      st.km IS NOT NULL AND " +
+        "      sp.tiefevon IS NOT NULL AND " +
+        "      sp.tiefebis IS NOT NULL AND " + // TODO: Test if char diameter ist null.
+        "      st.km BETWEEN :from - 0.001 AND :to + 0.001 AND " +
+        "      st.datum BETWEEN :start AND :end";
+
+    private static final String SQL_BEDLOAD_MEASUREMENT =
+        "SELECT m.km    as km," +
+        "       m.datum as datum," +
+        "       m.d10   as d10," +
+        "       m.d16   as d16," +
+        "       m.d20   as d20," +
+        "       m.d25   as d25," +
+        "       m.d30   as d30," +
+        "       m.d40   as d40," +
+        "       m.d50   as d50," +
+        "       m.d60   as d60," +
+        "       m.d70   as d70," +
+        "       m.d75   as d75," +
+        "       m.d80   as d80," +
+        "       m.d84   as d84," +
+        "       m.d90   as d90," +
+        "       m.dmin  as dmin," +
+        "       m.dmax  as dmax " +
+        "FROM messung m" +
+        "    JOIN station sn ON sn.stationid = m.stationid" +
+        "    JOIN gewaesser gw ON gw.gewaesserid = sn.gewaesserid " +
+        "WHERE gw.name = :name AND " +
+        "      m.km IS NOT NULL AND " +
+        "      m.d10 IS NOT NULL AND" + //TODO: Add all other char. diameter.
+        "      m.km BETWEEN :from - 0.001 AND :to + 0.001 AND" +
+        "      m.datum BETWEEN :start AND :end";
+
+    public static final class QualityMeasurementResultTransformer
+    extends BasicTransformerAdapter {
+
+        public static QualityMeasurementResultTransformer INSTANCE = new QualityMeasurementResultTransformer();
+
+        public QualityMeasurementResultTransformer() {
+        }
+
+        @Override
+        public Object transformTuple(Object[] tuple, String[] aliases) {
+            Map<String, Double> map = new HashMap<String, Double>();
+            double km = 0;
+            Date d = null;
+            double depth1 = Double.NaN;
+            double depth2 = Double.NaN;
+            for (int i = 0; i < tuple.length; ++i) {
+                if (tuple[i] != null) {
+                    if (aliases[i].equals("km")) {
+                        km = ((Number) tuple[i]).doubleValue();
+                    }
+                    else if (aliases[i].equals("datum")) {
+                        d = (Date) tuple[i];
+                    }
+                    else if (aliases[i].equals("depth1")) {
+                        depth1 = ((Number) tuple[i]).doubleValue();
+                    }
+                    else if (aliases[i].equals("depth2")) {
+                        depth2 = ((Number) tuple[i]).doubleValue();
+                    }
+                    else {
+                        map.put(aliases[i], ((Double) tuple[i])/1000);
+                    }
+                }
+            }
+            return new QualityMeasurement(km, d, depth1, depth2, map);
+        }
+    } // class BasicTransformerAdapter
+
+    private QualityMeasurementFactory() {
+    }
+
+    protected static QualityMeasurements load(
+        Session session,
+        String river,
+        double from,
+        double to,
+        Date start,
+        Date end,
+        String statement
+    ) {
+        SQLQuery query = session.createSQLQuery(statement)
+            .addScalar("km", StandardBasicTypes.DOUBLE)
+            .addScalar("datum", StandardBasicTypes.DATE)
+            .addScalar("d10", StandardBasicTypes.DOUBLE)
+            .addScalar("d16", StandardBasicTypes.DOUBLE)
+            .addScalar("d20", StandardBasicTypes.DOUBLE)
+            .addScalar("d25", StandardBasicTypes.DOUBLE)
+            .addScalar("d30", StandardBasicTypes.DOUBLE)
+            .addScalar("d40", StandardBasicTypes.DOUBLE)
+            .addScalar("d50", StandardBasicTypes.DOUBLE)
+            .addScalar("d60", StandardBasicTypes.DOUBLE)
+            .addScalar("d70", StandardBasicTypes.DOUBLE)
+            .addScalar("d75", StandardBasicTypes.DOUBLE)
+            .addScalar("d80", StandardBasicTypes.DOUBLE)
+            .addScalar("d84", StandardBasicTypes.DOUBLE)
+            .addScalar("d90", StandardBasicTypes.DOUBLE)
+            .addScalar("dmin", StandardBasicTypes.DOUBLE)
+            .addScalar("dmax", StandardBasicTypes.DOUBLE);
+
+        if (statement.equals(SQL_BED_MEASUREMENT)) {
+            query.addScalar("depth1", StandardBasicTypes.DOUBLE);
+            query.addScalar("depth2", StandardBasicTypes.DOUBLE);
+        }
+
+        query.setString("name", river);
+        query.setDouble("from", from);
+        query.setDouble("to", to);
+        query.setDate("start", start);
+        query.setDate("end", end);
+
+        query.setResultTransformer(
+            QualityMeasurementResultTransformer.INSTANCE);
+
+        return new QualityMeasurements(query.list());
+    }
+
+    public static QualityMeasurements getBedMeasurements(
+        String river,
+        double from,
+        double to,
+        Date start,
+        Date end) {
+        Session session = SedDBSessionHolder.HOLDER.get();
+        try {
+            return load(session, river, from, to, start, end,
+            SQL_BED_MEASUREMENT);
+        }
+        finally {
+            //session.close();
+        }
+    }
+
+    public static QualityMeasurements getBedloadMeasurements(
+        String river,
+        double from,
+        double to,
+        Date start,
+        Date end
+    ) {
+        Session session = SedDBSessionHolder.HOLDER.get();
+        try {
+            return load(
+                session,
+                river,
+                from,
+                to,
+                start,
+                end,
+                SQL_BEDLOAD_MEASUREMENT);
+        }
+        finally {
+            //session.close();
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurements.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,50 @@
+package de.intevation.flys.artifacts.model.minfo;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+public class QualityMeasurements {
+    private static Logger logger = Logger.getLogger(QualityMeasurements.class);
+    private List<QualityMeasurement> measurements;
+
+    public QualityMeasurements() {
+    }
+
+    public QualityMeasurements(List<QualityMeasurement> list) {
+        measurements = list;
+    }
+
+    public List<QualityMeasurement> getMeasurements() {
+        return measurements;
+    }
+
+    public List<QualityMeasurement> getMeasurements(double km) {
+        List<QualityMeasurement> res = new LinkedList<QualityMeasurement>();
+        for (QualityMeasurement qm: measurements) {
+            if (qm.getKm() == km) {
+                res.add(qm);
+            }
+        }
+        return res;
+    }
+
+    public List<Double> getKms() {
+        List<Double> result = new LinkedList<Double>();
+        for (QualityMeasurement qm : measurements) {
+            if (result.indexOf(qm.getKm()) < 0) {
+                result.add(qm.getKm());
+            }
+        }
+        return result;
+    }
+
+    public void setMeasurements(List<QualityMeasurement> list) {
+        this.measurements = list;
+    }
+
+    public void addMeasurement(QualityMeasurement qm) {
+        this.measurements.add(qm);
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurement.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/MeasurementFactory.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/sq/Measurements.java	Fri Sep 28 12:15:44 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/resources/Resources.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/resources/Resources.java	Fri Sep 28 12:15:44 2012 +0200
@@ -85,7 +85,6 @@
      * @return the translated message.
      */
     public static String getMsg(CallMeta meta, String key, String def) {
-
         ensureInstance();
 
         Locale[] locales = INSTANCE.getLocales();
@@ -95,10 +94,10 @@
     }
 
     public static String getMsg(
-        CallMeta meta,
-        String   key,
-        Object[] args
-    ) {
+            CallMeta meta,
+            String   key,
+            Object[] args
+            ) {
         return getMsg(meta, key, key, args);
     }
 
@@ -114,10 +113,10 @@
      * @return a translated string.
      */
     public static String getMsg(
-        CallMeta meta,
-        String   key,
-        String   def,
-        Object[] args)
+            CallMeta meta,
+            String   key,
+            String   def,
+            Object[] args)
     {
         String template = getMsg(meta, key, (String)null);
 
@@ -125,22 +124,33 @@
             return def;
         }
 
-        return MessageFormat.format(template, args);
+        return format(meta, template, args);
     }
 
     public static String format(
-        CallMeta   meta,
-        String     key,
-        String     def,
-        Object ... args
-    ) {
+            CallMeta   meta,
+            String     key,
+            String     def,
+            Object ... args
+            ) {
         String template = getMsg(meta, key, (String)null);
 
         if (template == null) {
             template = def;
         }
 
-        return MessageFormat.format(template, args);
+        return format(meta, template, args);
+    }
+
+    /**
+     * Formats the given template using the arguments with respect of the
+     * appropriate locale given by the CallMeta instance.
+     */
+    public static String format(CallMeta meta, String templ, Object ... args) {
+        Locale locale = getLocale(meta);
+        MessageFormat mf = new MessageFormat(templ, locale);
+
+        return mf.format(args, new StringBuffer(), null).toString();
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/BedKMChartService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,305 @@
+package de.intevation.flys.artifacts.services;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.DateAxis;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifactdatabase.DefaultService;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.artifacts.Service;
+import de.intevation.flys.artifacts.model.minfo.BedOverview;
+import de.intevation.flys.artifacts.model.minfo.BedOverviewFactory;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.backend.SedDBSessionHolder;
+import de.intevation.flys.utils.KMIndex;
+
+public class BedKMChartService extends DefaultService {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = -4946194087923870485L;
+
+    private static final Logger log =
+        Logger.getLogger(BedKMChartService.class);
+
+    public static final int DEFAULT_WIDTH  = 240;
+    public static final int DEFAULT_HEIGHT = 180;
+
+    public static final String I18N_CHART_LABEL =
+        "bed.km.chart.label";
+
+    public static final String DEFAULT_CHART_LABEL =
+        "Measuring Points";
+
+    public static final String I18N_CHART_TITLE =
+        "bed.km.chart.title";
+
+    public static final String DEFAULT_CHART_TITLE =
+        "Measuring points";
+
+    public static final String I18N_KM_AXIS =
+        "bed.km.chart.km.axis";
+
+    public static final String DEFAULT_KM_AXIS =
+        "km";
+
+    public static final String I18N_DATE_AXIS =
+        "bed.km.chart.date.axis";
+
+    public static final String DEFAULT_DATE_AXIS =
+        "Date";
+
+    public static final String DEFAULT_FORMAT = "png";
+
+    // TODO: Load fancy image from resources.
+    public static final byte [] EMPTY = {
+        (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47,
+        (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d,
+        (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+        (byte)0x08, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x3a, (byte)0x7e, (byte)0x9b,
+        (byte)0x55, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47,
+        (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce,
+        (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x09, (byte)0x70, (byte)0x48,
+        (byte)0x59, (byte)0x73, (byte)0x00, (byte)0x00,
+        (byte)0x0b, (byte)0x13, (byte)0x00, (byte)0x00,
+        (byte)0x0b, (byte)0x13, (byte)0x01, (byte)0x00,
+        (byte)0x9a, (byte)0x9c, (byte)0x18, (byte)0x00,
+        (byte)0x00, (byte)0x00, (byte)0x07, (byte)0x74,
+        (byte)0x49, (byte)0x4d, (byte)0x45, (byte)0x07,
+        (byte)0xdc, (byte)0x04, (byte)0x04, (byte)0x10,
+        (byte)0x30, (byte)0x15, (byte)0x7d, (byte)0x77,
+        (byte)0x36, (byte)0x0b, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x08, (byte)0x74, (byte)0x45,
+        (byte)0x58, (byte)0x74, (byte)0x43, (byte)0x6f,
+        (byte)0x6d, (byte)0x6d, (byte)0x65, (byte)0x6e,
+        (byte)0x74, (byte)0x00, (byte)0xf6, (byte)0xcc,
+        (byte)0x96, (byte)0xbf, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x0a, (byte)0x49, (byte)0x44,
+        (byte)0x41, (byte)0x54, (byte)0x08, (byte)0xd7,
+        (byte)0x63, (byte)0xf8, (byte)0x0f, (byte)0x00,
+        (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x00,
+        (byte)0x1b, (byte)0xb6, (byte)0xee, (byte)0x56,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x49, (byte)0x45, (byte)0x4e, (byte)0x44,
+        (byte)0xae, (byte)0x42, (byte)0x60, (byte)0x82
+    };
+
+    private static final Output empty() {
+        return new Output(EMPTY, "image/png");
+    }
+
+    @Override
+    public Service.Output process(
+        Document      data,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        log.debug("SQKMChartService.process");
+
+        SedDBSessionHolder.acquire();
+        try {
+            return doProcess(data, globalContext, callMeta);
+        }
+        finally {
+            SedDBSessionHolder.HOLDER.get().close();
+            SedDBSessionHolder.release();
+        }
+    }
+
+    protected Service.Output doProcess(
+        Document      input,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        String    river  = getRiverName(input);
+        Dimension extent = getExtent(input);
+        String    format = getFormat(input);
+
+        if (river == null) {
+            log.warn("River invalid.");
+            return empty();
+        }
+
+        BedOverview overview = BedOverviewFactory.getOverview(river);
+
+        if (overview == null) {
+            log.warn("No overview found for river '" + river + "'");
+            return empty();
+        }
+
+        KMIndex<List<Date>> entries = overview.filter(BedOverview.ACCEPT);
+
+        JFreeChart chart = createChart(entries, river, callMeta);
+
+        return encode(chart, extent, format);
+    }
+
+    protected static Output encode(
+        JFreeChart chart,
+        Dimension  extent,
+        String     format
+    ) {
+        BufferedImage image = chart.createBufferedImage(
+            extent.width, extent.height,
+            Transparency.BITMASK,
+            null);
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+        try {
+            ImageIO.write(image, format, out);
+        }
+        catch (IOException ioe) {
+            log.warn("writing image failed", ioe);
+            return empty();
+        }
+
+        return new Output(out.toByteArray(), "image/" + format);
+    }
+
+    protected static JFreeChart createChart(
+        KMIndex<List<Date>> entries,
+        String      river,
+        CallMeta    callMeta
+    ) {
+
+        XYSeriesCollection dataset = new XYSeriesCollection();
+        String key = Resources.format(
+            callMeta, I18N_CHART_LABEL, DEFAULT_CHART_LABEL, river);
+
+        XYSeries series = new XYSeries(key);
+        for (KMIndex.Entry<List<Date>> e: entries) {
+            double km = e.getKm();
+            List<Date> ds = e.getValue();
+            for (Date d: ds) {
+                series.add(km, d.getTime());
+            }
+        }
+
+        dataset.addSeries(series);
+        String title = Resources.format(
+            callMeta, I18N_CHART_TITLE, DEFAULT_CHART_TITLE, river);
+
+        String kmAxis = Resources.getMsg(
+            callMeta, I18N_KM_AXIS, DEFAULT_KM_AXIS);
+
+        String dateAxis = Resources.getMsg(
+            callMeta, I18N_DATE_AXIS, DEFAULT_DATE_AXIS);
+
+        JFreeChart chart = ChartFactory.createXYLineChart(
+            title,
+            kmAxis,
+            dateAxis,
+            null,
+            PlotOrientation.VERTICAL,
+            true,
+            true,
+            false);
+
+        XYPlot plot = (XYPlot)chart.getPlot();
+
+        DateAxis dA = new DateAxis();
+        plot.setRangeAxis(dA);
+        plot.setDataset(0, dataset);
+
+        chart.setBackgroundPaint(Color.white);
+        plot.setBackgroundPaint(Color.white);
+        plot.setDomainGridlinePaint(Color.gray);
+        plot.setRangeGridlinePaint(Color.gray);
+        plot.setDomainGridlinesVisible(true);
+        plot.setRangeGridlinesVisible(true);
+        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
+
+        renderer.setSeriesPaint(0, Color.gray);
+        renderer.setSeriesLinesVisible(0, false);
+        renderer.setSeriesShapesVisible(0, true);
+        renderer.setDrawOutlines(true);
+        return chart;
+    }
+
+
+    protected static String getRiverName(Document input) {
+        NodeList rivers = input.getElementsByTagName("river");
+
+        if (rivers.getLength() == 0) {
+            return null;
+        }
+
+        String river = ((Element)rivers.item(0)).getAttribute("name");
+
+        return river.length() > 0 ? river : null;
+    }
+
+    protected static Dimension getExtent(Document input) {
+
+        int width  = DEFAULT_WIDTH;
+        int height = DEFAULT_HEIGHT;
+
+        NodeList extents = input.getElementsByTagName("extent");
+
+        if (extents.getLength() > 0) {
+            Element element = (Element)extents.item(0);
+            String w = element.getAttribute("width");
+            String h = element.getAttribute("height");
+
+            try {
+                width = Math.max(1, Integer.parseInt(w));
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("width '" + w + "' is not a valid.");
+            }
+
+            try {
+                height = Math.max(1, Integer.parseInt(h));
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("height '" + h + "' is not a valid");
+            }
+        }
+
+        return new Dimension(width, height);
+    }
+
+    protected static String getFormat(Document input) {
+        String format = DEFAULT_FORMAT;
+
+        NodeList formats = input.getElementsByTagName("format");
+
+        if (formats.getLength() > 0) {
+            String type = ((Element)formats.item(0)).getAttribute("type");
+            if (type.length() > 0) {
+                format = type;
+            }
+        }
+
+        return format;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/BedloadKMChartService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,305 @@
+package de.intevation.flys.artifacts.services;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Transparency;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+
+import javax.imageio.ImageIO;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.DateAxis;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifactdatabase.DefaultService;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.artifacts.Service;
+import de.intevation.flys.artifacts.model.minfo.BedloadOverview;
+import de.intevation.flys.artifacts.model.minfo.BedloadOverviewFactory;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.backend.SedDBSessionHolder;
+import de.intevation.flys.utils.KMIndex;
+
+public class BedloadKMChartService extends DefaultService {
+
+    /**
+     *
+     */
+    private static final long serialVersionUID = 4156704841305086495L;
+
+    private static final Logger log =
+        Logger.getLogger(BedloadKMChartService.class);
+
+    public static final int DEFAULT_WIDTH  = 240;
+    public static final int DEFAULT_HEIGHT = 180;
+
+    public static final String I18N_CHART_LABEL =
+        "bedload.km.chart.label";
+
+    public static final String DEFAULT_CHART_LABEL =
+        "Measuring Points";
+
+    public static final String I18N_CHART_TITLE =
+        "bedload.km.chart.title";
+
+    public static final String DEFAULT_CHART_TITLE =
+        "Measuring points";
+
+    public static final String I18N_KM_AXIS =
+        "bedload.km.chart.km.axis";
+
+    public static final String DEFAULT_KM_AXIS =
+        "km";
+
+    public static final String I18N_DATE_AXIS =
+        "bedload.km.chart.date.axis";
+
+    public static final String DEFAULT_DATE_AXIS =
+        "Date";
+
+    public static final String DEFAULT_FORMAT = "png";
+
+    // TODO: Load fancy image from resources.
+    public static final byte [] EMPTY = {
+        (byte)0x89, (byte)0x50, (byte)0x4e, (byte)0x47,
+        (byte)0x0d, (byte)0x0a, (byte)0x1a, (byte)0x0a,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x0d,
+        (byte)0x49, (byte)0x48, (byte)0x44, (byte)0x52,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01,
+        (byte)0x08, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x3a, (byte)0x7e, (byte)0x9b,
+        (byte)0x55, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x01, (byte)0x73, (byte)0x52, (byte)0x47,
+        (byte)0x42, (byte)0x00, (byte)0xae, (byte)0xce,
+        (byte)0x1c, (byte)0xe9, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x09, (byte)0x70, (byte)0x48,
+        (byte)0x59, (byte)0x73, (byte)0x00, (byte)0x00,
+        (byte)0x0b, (byte)0x13, (byte)0x00, (byte)0x00,
+        (byte)0x0b, (byte)0x13, (byte)0x01, (byte)0x00,
+        (byte)0x9a, (byte)0x9c, (byte)0x18, (byte)0x00,
+        (byte)0x00, (byte)0x00, (byte)0x07, (byte)0x74,
+        (byte)0x49, (byte)0x4d, (byte)0x45, (byte)0x07,
+        (byte)0xdc, (byte)0x04, (byte)0x04, (byte)0x10,
+        (byte)0x30, (byte)0x15, (byte)0x7d, (byte)0x77,
+        (byte)0x36, (byte)0x0b, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x08, (byte)0x74, (byte)0x45,
+        (byte)0x58, (byte)0x74, (byte)0x43, (byte)0x6f,
+        (byte)0x6d, (byte)0x6d, (byte)0x65, (byte)0x6e,
+        (byte)0x74, (byte)0x00, (byte)0xf6, (byte)0xcc,
+        (byte)0x96, (byte)0xbf, (byte)0x00, (byte)0x00,
+        (byte)0x00, (byte)0x0a, (byte)0x49, (byte)0x44,
+        (byte)0x41, (byte)0x54, (byte)0x08, (byte)0xd7,
+        (byte)0x63, (byte)0xf8, (byte)0x0f, (byte)0x00,
+        (byte)0x01, (byte)0x01, (byte)0x01, (byte)0x00,
+        (byte)0x1b, (byte)0xb6, (byte)0xee, (byte)0x56,
+        (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+        (byte)0x49, (byte)0x45, (byte)0x4e, (byte)0x44,
+        (byte)0xae, (byte)0x42, (byte)0x60, (byte)0x82
+    };
+
+    private static final Output empty() {
+        return new Output(EMPTY, "image/png");
+    }
+
+    @Override
+    public Service.Output process(
+        Document      data,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        log.debug("SQKMChartService.process");
+
+        SedDBSessionHolder.acquire();
+        try {
+            return doProcess(data, globalContext, callMeta);
+        }
+        finally {
+            SedDBSessionHolder.HOLDER.get().close();
+            SedDBSessionHolder.release();
+        }
+    }
+
+    protected Service.Output doProcess(
+        Document      input,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        String    river  = getRiverName(input);
+        Dimension extent = getExtent(input);
+        String    format = getFormat(input);
+
+        if (river == null) {
+            log.warn("River invalid.");
+            return empty();
+        }
+
+        BedloadOverview overview = BedloadOverviewFactory.getOverview(river);
+
+        if (overview == null) {
+            log.warn("No overview found for river '" + river + "'");
+            return empty();
+        }
+
+        KMIndex<List<Date>> entries = overview.filter(BedloadOverview.ACCEPT);
+
+        JFreeChart chart = createChart(entries, river, callMeta);
+
+        return encode(chart, extent, format);
+    }
+
+    protected static Output encode(
+        JFreeChart chart,
+        Dimension  extent,
+        String     format
+    ) {
+        BufferedImage image = chart.createBufferedImage(
+            extent.width, extent.height,
+            Transparency.BITMASK,
+            null);
+
+        ByteArrayOutputStream out = new ByteArrayOutputStream();
+
+        try {
+            ImageIO.write(image, format, out);
+        }
+        catch (IOException ioe) {
+            log.warn("writing image failed", ioe);
+            return empty();
+        }
+
+        return new Output(out.toByteArray(), "image/" + format);
+    }
+
+    protected static JFreeChart createChart(
+        KMIndex<List<Date>> entries,
+        String      river,
+        CallMeta    callMeta
+    ) {
+
+        XYSeriesCollection dataset = new XYSeriesCollection();
+        String key = Resources.format(
+            callMeta, I18N_CHART_LABEL, DEFAULT_CHART_LABEL, river);
+
+        XYSeries series = new XYSeries(key);
+        for (KMIndex.Entry<List<Date>> e: entries) {
+            double km = e.getKm();
+            List<Date> ds = e.getValue();
+            for (Date d: ds) {
+                series.add(km, d.getTime());
+            }
+        }
+
+        dataset.addSeries(series);
+        String title = Resources.format(
+            callMeta, I18N_CHART_TITLE, DEFAULT_CHART_TITLE, river);
+
+        String kmAxis = Resources.getMsg(
+            callMeta, I18N_KM_AXIS, DEFAULT_KM_AXIS);
+
+        String dateAxis = Resources.getMsg(
+            callMeta, I18N_DATE_AXIS, DEFAULT_DATE_AXIS);
+
+        JFreeChart chart = ChartFactory.createXYLineChart(
+            title,
+            kmAxis,
+            dateAxis,
+            null,
+            PlotOrientation.VERTICAL,
+            true,
+            true,
+            false);
+
+        XYPlot plot = (XYPlot)chart.getPlot();
+
+        DateAxis dA = new DateAxis();
+        plot.setRangeAxis(dA);
+        plot.setDataset(0, dataset);
+
+        chart.setBackgroundPaint(Color.white);
+        plot.setBackgroundPaint(Color.white);
+        plot.setDomainGridlinePaint(Color.gray);
+        plot.setRangeGridlinePaint(Color.gray);
+        plot.setDomainGridlinesVisible(true);
+        plot.setRangeGridlinesVisible(true);
+        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
+
+        renderer.setSeriesPaint(0, Color.gray);
+        renderer.setSeriesLinesVisible(0, false);
+        renderer.setSeriesShapesVisible(0, true);
+        renderer.setDrawOutlines(true);
+        return chart;
+    }
+
+
+    protected static String getRiverName(Document input) {
+        NodeList rivers = input.getElementsByTagName("river");
+
+        if (rivers.getLength() == 0) {
+            return null;
+        }
+
+        String river = ((Element)rivers.item(0)).getAttribute("name");
+
+        return river.length() > 0 ? river : null;
+    }
+
+    protected static Dimension getExtent(Document input) {
+
+        int width  = DEFAULT_WIDTH;
+        int height = DEFAULT_HEIGHT;
+
+        NodeList extents = input.getElementsByTagName("extent");
+
+        if (extents.getLength() > 0) {
+            Element element = (Element)extents.item(0);
+            String w = element.getAttribute("width");
+            String h = element.getAttribute("height");
+
+            try {
+                width = Math.max(1, Integer.parseInt(w));
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("width '" + w + "' is not a valid.");
+            }
+
+            try {
+                height = Math.max(1, Integer.parseInt(h));
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("height '" + h + "' is not a valid");
+            }
+        }
+
+        return new Dimension(width, height);
+    }
+
+    protected static String getFormat(Document input) {
+        String format = DEFAULT_FORMAT;
+
+        NodeList formats = input.getElementsByTagName("format");
+
+        if (formats.getLength() > 0) {
+            String type = ((Element)formats.item(0)).getAttribute("type");
+            if (type.length() > 0) {
+                format = type;
+            }
+        }
+
+        return format;
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -18,7 +18,7 @@
 import de.intevation.flys.artifacts.model.GaugeFinderFactory;
 import de.intevation.flys.artifacts.model.GaugeRange;
 
-import de.intevation.flys.artifacts.model.fixings.QW;
+import de.intevation.flys.artifacts.model.fixings.QWI;
 
 import de.intevation.flys.artifacts.resources.Resources;
 
@@ -276,7 +276,7 @@
             boolean interpolated = !col.getB().getW(km, w);
             double q = col.getB().getQ(km);
             if (!Double.isNaN(w[0]) && !Double.isNaN(q)) {
-                QW qw = new QW(
+                QWI qw = new QWI(
                     q, w[0],
                     col.getA().getDescription(),
                     col.getA().getStartTime(),
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeInfoService.java	Fri Sep 28 12:15:44 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);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,160 @@
+package de.intevation.flys.artifacts.services;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.artifacts.common.ArtifactNamespaceContext;
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.flys.artifacts.model.RiverFactory;
+import de.intevation.flys.model.Gauge;
+import de.intevation.flys.model.MinMaxWQ;
+import de.intevation.flys.model.Range;
+import de.intevation.flys.model.River;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class GaugeOverviewInfoService extends FLYSService {
+
+    private static final Logger logger = Logger.getLogger(
+            GaugeOverviewInfoService.class);
+
+    public static final String RIVER_XPATH = "/art:river/text()";
+
+    @Override
+    public Document doProcess(
+        Document      data,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        logger.debug("GaugeOverviewInfoService.process");
+
+        String riverstr = XMLUtils.xpathString(
+            data, RIVER_XPATH, ArtifactNamespaceContext.INSTANCE);
+
+        River river = RiverFactory.getRiver(riverstr);
+
+        Document result = XMLUtils.newDocument();
+
+        if (river == null) {
+            logger.warn("No river with name " + riverstr + " found.");
+            return result;
+        }
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            result,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element go = ec.create("gauge-info");
+
+        double[] minmax  = river.determineMinMaxDistance();
+        double[] minmaxq = river.determineMinMaxQ();
+
+        Element r = ec.create("river");
+        ec.addAttr(r, "name", river.getName(), true);
+        ec.addAttr(r, "start", Double.toString(minmax[0]), true);
+        ec.addAttr(r, "end", Double.toString(minmax[1]), true);
+        ec.addAttr(r, "wstunit", river.getWstUnit().getName(), true);
+        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");
+
+        List<Gauge> gauges = river.getGauges();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("Loaded gauges: " + gauges);
+        }
+
+        for (Gauge gauge: river.getGauges()) {
+            Element eg = ec.create("gauge");
+
+            String name = gauge.getName();
+            if (name != null) {
+                ec.addAttr(eg, "name", gauge.getName(), true);
+            }
+
+            String aeo = getGaugeValue(gauge.getAeo());
+            if (aeo != null) {
+                ec.addAttr(eg, "aeo", aeo, true);
+            }
+
+            String datum = getGaugeValue(gauge.getDatum());
+            if (datum != null) {
+                ec.addAttr(eg, "datum", datum, true);
+            }
+
+            Range range = gauge.getRange();
+            if (range != null) {
+                BigDecimal a = range.getA();
+                if (a != null) {
+                    double min = a.doubleValue();
+                    ec.addAttr(eg, "start", Double.toString(min), true);
+                }
+
+                BigDecimal b = range.getB();
+                if (b != null) {
+                    double max = range.getB().doubleValue();
+                    ec.addAttr(eg, "end", Double.toString(max), true);
+                }
+            }
+            MinMaxWQ minmaxwq = gauge.fetchMaxMinWQ();
+            String minw = getGaugeValue(minmaxwq.getMinW());
+            String maxw = getGaugeValue(minmaxwq.getMaxW());
+            String minq = getGaugeValue(minmaxwq.getMinQ());
+            String maxq = getGaugeValue(minmaxwq.getMaxQ());
+
+            if (minw != null) {
+                ec.addAttr(eg, "minw", minw, true);
+            }
+            if (maxw != null) {
+                ec.addAttr(eg, "maxw", maxw, true);
+            }
+            if (minq != null) {
+                ec.addAttr(eg, "minq", minq, true);
+            }
+            if (maxq != null) {
+                ec.addAttr(eg, "maxq", maxq, true);
+            }
+
+            String station = getGaugeValue(gauge.getStation());
+            if (station != null) {
+                ec.addAttr(eg, "station", station, true);
+            }
+
+            Long official = gauge.getOfficialNumber();
+            if (official != null) {
+                ec.addAttr(eg, "official", official.toString(), true);
+            }
+
+            egs.appendChild(eg);
+        }
+
+        go.appendChild(r);
+        go.appendChild(egs);
+        result.appendChild(go);
+
+        return result;
+    }
+
+    /**
+     * Returns a Double from a BigDecimal value or null if value is null
+     */
+    private static String getGaugeValue(BigDecimal value) {
+        return value != null
+            ? Double.toString(value.doubleValue())
+            : "";
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MainValuesService.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MainValuesService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -21,7 +21,6 @@
 import de.intevation.flys.model.Range;
 import de.intevation.flys.model.River;
 
-import de.intevation.flys.artifacts.model.MainValuesFactory;
 import de.intevation.flys.artifacts.model.RiverFactory;
 
 
@@ -52,6 +51,11 @@
     public MainValuesService() {
     }
 
+    private static final Document error(String msg) {
+        logger.debug(msg);
+        return XMLUtils.newDocument();
+    }
+
 
     @Override
     public Document doProcess(
@@ -61,23 +65,21 @@
     ) {
         logger.debug("MainValuesService.process");
 
-        try {
-            River river     = getRequestedRiver(data);
-            double[] minmax = getRequestedStartEnd(data, river);
-            Gauge gauge     = river.determineGauge(minmax[0], minmax[1]);
-
-            logger.debug("Found gauge: " + gauge.getName());
+        River river = getRequestedRiver(data);
+        if (river == null) {
+            return error("no river found.");
+        }
 
-            List<MainValue> mainValues = getMainValues(river, gauge);
+        double[] minmax = getRequestedStartEnd(data, river);
+        Gauge gauge = river.determineGauge(minmax[0], minmax[1]);
 
-            return buildDocument(river, gauge, mainValues, context);
+        if (gauge == null) {
+            return error("no gauge found.");
         }
-        catch (NullPointerException npe) {
-            logger.error("Could not process the request.");
-            logger.error(npe, npe);
 
-            return XMLUtils.newDocument();
-        }
+        List<MainValue> mainValues = getMainValues(river, gauge);
+
+        return buildDocument(river, gauge, mainValues, context);
     }
 
 
@@ -98,17 +100,9 @@
         String riverStr = XMLUtils.xpathString(
             data, XPATH_RIVER, ArtifactNamespaceContext.INSTANCE);
 
-        if (riverStr == null || riverStr.trim().length() == 0) {
-            throw new NullPointerException("No river found in the request.");
-        }
-
-        River river = RiverFactory.getRiver(riverStr);
-
-        if (river == null) {
-            throw new NullPointerException("No such river found: " + riverStr);
-        }
-
-        return river;
+         return riverStr != null && (riverStr = riverStr.trim()).length() > 0
+            ? RiverFactory.getRiver(riverStr)
+            : null;
     }
 
 
@@ -132,18 +126,23 @@
         String endStr = XMLUtils.xpathString(
             data, XPATH_END, ArtifactNamespaceContext.INSTANCE);
 
+        if (startStr == null || endStr == null) {
+            return river.determineMinMaxDistance();
+        }
+
         try {
             double start = Double.parseDouble(startStr);
             double end   = Double.parseDouble(endStr);
 
-            logger.debug("Found start: " + start);
-            logger.debug("Found end: " + end);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Found start: " + start);
+                logger.debug("Found end: " + end);
+            }
 
             return new double[] { start, end };
         }
         catch (NumberFormatException nfe) {
             logger.warn(nfe, nfe);
-
             return river.determineMinMaxDistance();
         }
     }
@@ -159,23 +158,20 @@
      * @return a document that includes the main values of the specified river
      * at the specified gauge.
      */
-    protected List<MainValue> getMainValues(River river, Gauge gauge)
-    throws    NullPointerException
-    {
+    protected List<MainValue> getMainValues(River river, Gauge gauge) {
+
         if (logger.isDebugEnabled()) {
             logger.debug("MainValuesService.buildMainValues");
             logger.debug("River: " + river.getName());
             logger.debug("Gauge: " + gauge.getName());
         }
 
-        List<MainValue> mainValues = MainValuesFactory.getMainValues(gauge);
+        List<MainValue> mainValues = gauge.getMainValues();
 
-        if (mainValues == null || mainValues.isEmpty()) {
-            throw new NullPointerException("No main values found.");
+        if (logger.isDebugEnabled()) {
+            logger.debug(mainValues.size() + " main values found.");
         }
 
-        logger.debug(mainValues.size() + " main values found.");
-
         return mainValues;
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,6 +1,6 @@
 package de.intevation.flys.artifacts.services;
 
-import de.intevation.flys.artifacts.model.fixings.QW;
+import de.intevation.flys.artifacts.model.fixings.QWI;
 
 import de.intevation.flys.java2d.ShapeUtils;
 
@@ -38,7 +38,7 @@
 implements   XYItemLabelGenerator
 {
     public interface LabelGenerator {
-        String createLabel(QW qw);
+        String createLabel(QWI qw);
     } // interface LabelGenerator
 
     public static class DateFormatLabelGenerator
@@ -59,7 +59,7 @@
         }
 
         @Override
-        public String createLabel(QW qw) {
+        public String createLabel(QWI qw) {
             Date date = qw.getDate();
             return date != null ? format.format(date) : "";
         }
@@ -71,7 +71,7 @@
     protected Date minDate;
     protected Date maxDate;
 
-    protected List<List<QW>> labels;
+    protected List<List<QWI>> labels;
 
     protected Rectangle2D area;
 
@@ -81,7 +81,7 @@
         new HashMap<ShapeRenderer.Entry, Integer>();
 
     public QWSeriesCollection() {
-        labels = new ArrayList<List<QW>>();
+        labels = new ArrayList<List<QWI>>();
         labelGenerator = SIMPLE_GENERATOR;
     }
 
@@ -90,7 +90,7 @@
         this.labelGenerator = labelGenerator;
     }
 
-    protected static ShapeRenderer.Entry classify(QW qw) {
+    protected static ShapeRenderer.Entry classify(QWI qw) {
         boolean interpolated = qw.getInterpolated();
 
         Shape shape = interpolated
@@ -103,7 +103,7 @@
         return new ShapeRenderer.Entry(shape, color, filled);
     }
 
-    public void add(QW qw) {
+    public void add(QWI qw) {
 
         ShapeRenderer.Entry key = classify(qw);
 
@@ -116,7 +116,7 @@
             knownShapes.put(key, seriesNo);
             series = new XYSeries(seriesNo, false);
             addSeries(series);
-            labels.add(new ArrayList<QW>());
+            labels.add(new ArrayList<QWI>());
         }
         else {
             series = getSeries(seriesNo);
@@ -130,7 +130,7 @@
         extendArea(qw);
     }
 
-    protected void extendDateRange(QW qw) {
+    protected void extendDateRange(QWI qw) {
         Date date = qw.getDate();
         if (date != null) {
             if (minDate == null) {
@@ -147,7 +147,7 @@
         }
     }
 
-    protected void extendArea(QW qw) {
+    protected void extendArea(QWI qw) {
         if (area == null) {
             area = new Rectangle2D.Double(
                 qw.getQ(), qw.getW(), 0d, 0d);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DefaultState.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,6 @@
 package de.intevation.flys.artifacts.states;
 
 import java.text.NumberFormat;
-import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.List;
@@ -87,11 +86,9 @@
             return ui;
         }
 
-        Iterator<String> iter = theData.keySet().iterator();
-        FLYSArtifact     flys = (FLYSArtifact) artifact;
+        FLYSArtifact flys = (FLYSArtifact)artifact;
 
-        while (iter.hasNext()) {
-            String name = iter.next();
+        for (String name: theData.keySet()) {
             appendStaticData(flys, context, creator, ui, name);
         }
 
@@ -115,9 +112,11 @@
 
         String type = data.getType();
 
-        logger.debug(
-            "Append element " + type + "'" +
-            name + "' (" + value + ")");
+        if (logger.isDebugEnabled()) {
+            logger.debug(
+                "Append element " + type + "'" +
+                name + "' (" + value + ")");
+        }
 
         Element e = createStaticData(flys, cr, context, name, value, type);
 
@@ -183,7 +182,7 @@
         try {
             // XXX A better way to format the output would be to use the
             // 'type' value of the data objects.
-            double doubleVal = Double.valueOf(value);
+            double doubleVal = Double.parseDouble(value);
             Locale         l = Resources.getLocale(meta);
             NumberFormat  nf = NumberFormat.getInstance(l);
 
@@ -259,14 +258,14 @@
             return ui;
         }
 
-        Iterator<String> iter = theData.keySet().iterator();
-        FLYSArtifact     flys = (FLYSArtifact) artifact;
+        FLYSArtifact flys = (FLYSArtifact)artifact;
 
-        while (iter.hasNext()) {
-            String    name = iter.next();
+        for (String name: theData.keySet()) {
             StateData data = getData(flys, name);
 
-            data = data != null ? data : getData(name);
+            if (data == null) {
+                data = getData(name);
+            }
 
             Element select = createData(creator, artifact, data, context);
 
@@ -407,7 +406,9 @@
         String       name,
         String       val
     ) {
-        logger.debug("Transform data ('" + name + "','" + val + "')");
+        if (logger.isDebugEnabled()) {
+            logger.debug("Transform data ('" + name + "','" + val + "')");
+        }
 
         stateData.setValue(val);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeState.java	Fri Sep 28 12:15:44 2012 +0200
@@ -18,13 +18,14 @@
 
 public class DischargeState extends MultiIntArrayState {
 
-    public static final String MAIN_CHANNEL  = "main.channel";
-    public static final String TOTAL_CHANNEL = "total.channel";
+    public static final String MAIN_CHANNEL  = "main_channel";
+    public static final String TOTAL_CHANNEL = "total_channel";
 
 
     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/GaugeTimerangeState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/GaugeTimerangeState.java	Fri Sep 28 12:15:44 2012 +0200
@@ -4,15 +4,13 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
-
+import org.hibernate.SQLQuery;
 import org.hibernate.Session;
-import org.hibernate.SQLQuery;
 import org.hibernate.type.StandardBasicTypes;
 
-import de.intevation.flys.model.Gauge;
+import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.backend.SessionHolder;
-
-import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.model.Gauge;
 import de.intevation.flys.utils.FLYSUtils;
 
 
@@ -22,7 +20,7 @@
 public class GaugeTimerangeState extends IntRangeState {
 
     private static final Logger logger =
-        Logger.getLogger(GaugeTimerangeState.class);
+            Logger.getLogger(GaugeTimerangeState.class);
 
 
     protected int[] getLowerUpper(FLYSArtifact flys) {
@@ -36,17 +34,17 @@
         Session session = SessionHolder.HOLDER.get();
 
         SQLQuery query = session.createSQLQuery(
-            "SELECT min(start_time) as min, max(stop_time) as max " +
-            "FROM time_intervals WHERE id in " +
-            "(SELECT time_interval_id FROM discharge_tables " +
-            "WHERE gauge_id =:gid)");
+                "SELECT min(start_time) as min, max(stop_time) as max " +
+                        "FROM time_intervals WHERE id in " +
+                        "(SELECT time_interval_id FROM discharge_tables " +
+                "WHERE gauge_id =:gid)");
 
         query.addScalar("min", StandardBasicTypes.CALENDAR);
         query.addScalar("max", StandardBasicTypes.CALENDAR);
 
         query.setInteger("gid", gauge.getId());
 
-        List results = query.list();
+        List<?> results = query.list();
 
         if (results != null) {
             Object[] res = (Object[]) results.get(0);
@@ -54,7 +52,9 @@
             Calendar lo = (Calendar) res[0];
             Calendar up = (Calendar) res[1];
 
-            return new int[] { lo.get(Calendar.YEAR), up.get(Calendar.YEAR) };
+            if (lo != null && up != null) {
+                return new int[] { lo.get(Calendar.YEAR), up.get(Calendar.YEAR) };
+            }
         }
 
         logger.warn("Could not determine time range for gauge: " + gauge);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ManualPointsSingleState.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/SoundingsSelect.java	Fri Sep 28 12:15:44 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);
 
 
@@ -77,7 +77,11 @@
             BedHeightSingle.getBedHeightSingles(river, kmLo, kmHi);
 
         if (singles != null) {
-            for (int i = 0, S = singles.size(); i < S; i++) {
+            int size = singles.size();
+
+            logger.debug("Found " + size + " singles.");
+
+            for (int i = 0; i < size; i++) {
                 BedHeightSingle s = singles.get(i);
 
                 String id    = PREFIX_SINGLE + s.getId();
@@ -99,7 +103,11 @@
             BedHeightEpoch.getBedHeightEpochs(river, kmLo, kmHi);
 
         if (epochs != null) {
-            for (int i = 0, E = epochs.size(); i < E; i++) {
+            int size = epochs.size();
+
+            logger.debug("Found " + size + " epochs.");
+
+            for (int i = 0; i < size; i++) {
                 BedHeightEpoch e = epochs.get(i);
 
                 String id    = PREFIX_EPOCH + e.getId();
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/StaticState.java	Fri Sep 28 12:15:44 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/WQAdapted.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQAdapted.java	Fri Sep 28 12:15:44 2012 +0200
@@ -142,8 +142,6 @@
         double rangeFrom = dist[0];
         double rangeTo   = dist[1];
 
-        int idx = 0;
-
         if (rangeFrom < rangeTo) {
             Collections.sort(gauges, GAUGE_UP);
             for (Gauge gauge: gauges) {
@@ -329,7 +327,7 @@
             double upper = range.getB().doubleValue();
 
             for (RangeWithValues rwv: rwvs) {
-                if (lower <= rwv.getLower() && upper >= rwv.getUpper()) {
+                if (lower <= rwv.getStart() && upper >= rwv.getEnd()) {
                     compareWsWithGauge(gauge, rwv.getValues());
                 }
             }
@@ -361,7 +359,7 @@
             double upper = range.getB().doubleValue();
 
             for (RangeWithValues rwv: rwvs) {
-                if (lower <= rwv.getLower() && upper >= rwv.getUpper()) {
+                if (lower <= rwv.getStart() && upper >= rwv.getEnd()) {
                     compareQsWithGauge(wst, gauge, rwv.getValues());
                 }
             }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Sep 28 12:15:44 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;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,65 @@
+package de.intevation.flys.artifacts.states.extreme;
+
+import de.intevation.artifactdatabase.state.Facet;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+import de.intevation.flys.artifacts.access.ExtremeAccess;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.ReportFacet;
+
+import de.intevation.flys.artifacts.model.extreme.ExtremeCalculation;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+public class ExtremeCompute
+extends      DefaultState
+{
+    private static Logger log = Logger.getLogger(ExtremeCompute.class);
+
+    public ExtremeCompute() {
+    }
+
+    @Override
+    public Object computeAdvance(
+        FLYSArtifact artifact,
+        String       hash,
+        CallContext  context,
+        List<Facet>  facets,
+        Object       old
+    ) {
+        log.debug("ExtremeCompute.computeAdvance");
+
+        CalculationResult res;
+
+        ExtremeAccess access = new ExtremeAccess(artifact);
+
+        if (old instanceof CalculationResult) {
+            res = (CalculationResult)old;
+        }
+        else {
+            ExtremeCalculation calc = new ExtremeCalculation(access);
+            res = calc.calculate();
+        }
+
+        if (facets == null) {
+            return res;
+        }
+
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet());
+        }
+
+        // TODO: Add more facets.
+
+        return res;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Fri Sep 28 12:15:44 2012 +0200
@@ -2,13 +2,13 @@
 
 import java.text.DateFormat;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
-import java.util.TreeSet;
 
 import org.apache.log4j.Logger;
 
 import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifactdatabase.state.FacetActivity;
+import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.access.FixAnalysisAccess;
@@ -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)",
@@ -66,6 +68,36 @@
         "[HQ5 - \u221e)"
     };
 
+    static {
+        // Active/deactivate facets.
+        FacetActivity.Registry.getInstance().register(
+            "fixanalysis",
+            new FacetActivity() {
+                @Override
+                public Boolean isInitialActive(
+                    Artifact artifact,
+                    Facet    facet,
+                    String   output
+                ) {
+                    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;
+                        }
+                    }
+
+                    return Boolean.TRUE;
+                }
+            });
+    }
+
     /**
      * The default constructor that initializes an empty State object.
      */
@@ -203,17 +235,14 @@
         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);
 
-        TreeSet<Date> dates = fr.getReferenceEventsDates();
-        Iterator<Date> iter = dates.iterator();
         int i = 0;
-        while (iter.hasNext()) {
-            Date d = iter.next();
+        for (Date d: fr.getReferenceEventsDates()) {
             int refNdx = idg.next() << 8;
             refNdx |=  i;
             facets.add(new FixReferenceEventsFacet(refNdx,
@@ -250,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"));
 
@@ -265,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/fixation/FixRealizingCompute.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixRealizingCompute.java	Fri Sep 28 12:15:44 2012 +0200
@@ -40,7 +40,6 @@
     public static final String I18N_WQ_EVENTS = "fix.vollmer.wq.events";
 
 
-
     /**
      * The default constructor that initializes an empty State object.
      */
@@ -57,9 +56,6 @@
     ) {
         logger.debug("FixRealizingCompute.computeAdvance");
 
-        String   id   = getID();
-        CallMeta meta = context.getMeta();
-
         CalculationResult res;
 
         FixRealizingAccess access =
@@ -81,6 +77,9 @@
             facets.add(new ReportFacet());
         }
 
+        String   id   = getID();
+        CallMeta meta = context.getMeta();
+
         FixRealizingResult fixRes = (FixRealizingResult) res.getData();
         WQKms [] wqkms = fixRes != null ? fixRes.getWQKms() : new WQKms[0];
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FunctionSelect.java	Fri Sep 28 12:15:44 2012 +0200
@@ -4,17 +4,14 @@
 import java.util.Iterator;
 
 import org.apache.log4j.Logger;
-
 import org.w3c.dom.Element;
 
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
-
 import de.intevation.artifacts.common.utils.XMLUtils;
-
-import de.intevation.flys.artifacts.states.DefaultState;
 import de.intevation.flys.artifacts.math.fitting.Function;
 import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
+import de.intevation.flys.artifacts.states.DefaultState;
 
 /**
  * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
@@ -31,6 +28,7 @@
     public FunctionSelect() {
     }
 
+    @Override
     public String getUIProvider() {
         return "fix.functionselect";
     }
@@ -43,13 +41,13 @@
         CallContext             context)
     {
         FunctionFactory ff = FunctionFactory.getInstance();
-        Collection fc = ff.getFunctions();
+        Collection<Function> fc = ff.getFunctions();
         Element[] functions = new Element[fc.size()];
-        Iterator i = fc.iterator();
+        Iterator<Function> i = fc.iterator();
 
         int j = 0;
         while(i.hasNext()) {
-            Function f = (Function)i.next();
+            Function f = i.next();
             String n = f.getName();
             String d = f.getDescription();
             functions[j] = createItem(ec, new String[] {d, n});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityPeriodsSelect.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,24 @@
+package de.intevation.flys.artifacts.states.minfo;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.states.DefaultState;
+
+public class BedQualityPeriodsSelect extends DefaultState {
+
+    /** The logger used in this class. */
+    private static Logger logger = Logger.getLogger(BedQualityPeriodsSelect.class);
+
+
+    /**
+     * The default constructor that initializes an empty State object.
+     */
+    public BedQualityPeriodsSelect() {
+    }
+
+    @Override
+    protected String getUIProvider() {
+        return "bedquality_periods_select";
+    }
+
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,227 @@
 package de.intevation.flys.artifacts.states.minfo;
 
+import java.util.ArrayList;
+import java.util.Date;
+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.BedQualityAccess;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.DateRange;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.minfo.BedDensityFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiameterFacet;
+import de.intevation.flys.artifacts.model.minfo.BedDiameterResult;
+import de.intevation.flys.artifacts.model.minfo.BedParametersResult;
+import de.intevation.flys.artifacts.model.minfo.BedPorosityFacet;
+import de.intevation.flys.artifacts.model.minfo.BedQualityCalculation;
+import de.intevation.flys.artifacts.model.minfo.BedQualityDiameterResult;
+import de.intevation.flys.artifacts.model.minfo.BedQualityResult;
+import de.intevation.flys.artifacts.model.minfo.BedloadDiameterFacet;
+import de.intevation.flys.artifacts.model.minfo.BedloadDiameterResult;
+import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.artifacts.states.DefaultState;
 
-public class BedQualityState extends DefaultState {
 
+public class BedQualityState extends DefaultState implements FacetTypes {
+
+    private static final long serialVersionUID = 1L;
+
+    private static final Logger logger = Logger
+        .getLogger(BedQualityState.class);
+
+    public static final String I18N_TOPLAYER = "bedquality.toplayer";
+    public static final String I18N_SUBLAYER = "bedquality.sublayer";
+
+    public static final String I18N_FACET_BED_POROSITY_TOPLAYER = "facet.bedquality.bed.porosity.toplayer";
+    public static final String I18N_FACET_BED_POROSITY_SUBLAYER = "facet.bedquality.bed.porosity.sublayer";
+    public static final String I18N_FACET_BED_DENSITY_TOPLAYER = "facet.bedquality.bed.density.toplayer";
+    public static final String I18N_FACET_BED_DENSITY_SUBLAYER = "facet.bedquality.bed.density.sublayer";
+    public static final String I18N_FACET_BED_DIAMETER_TOPLAYER = "facet.bedquality.bed.diameter.toplayer";
+    public static final String I18N_FACET_BED_DIAMETER_SUBLAYER = "facet.bedquality.bed.diameter.sublayer";
+    public static final String I18N_FACET_BEDLOAD_DIAMETER = "facet.bedquality.bedload.diameter";
+
+    @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>();
+
+        BedQualityAccess access = new BedQualityAccess(artifact);
+
+        CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
+            : new BedQualityCalculation().calculate(access);
+
+        if (facets == null || res == null) {
+            return res;
+        }
+
+        BedQualityResult[] results = (BedQualityResult[]) 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,
+        BedQualityResult[] results, String stateId, String hash) {
+        logger.debug("BedQualityState.generateFacets");
+
+        CallMeta meta = context.getMeta();
+
+        newFacets.add(new DataFacet(CSV, "CSV data", ComputeType.ADVANCE, hash, id));
+        for (int idx = 0; idx < results.length; idx++) {
+            BedQualityResult result = results[idx];
+            DateRange range = result.getDateRange();
+            BedDiameterResult[] bedDiameter = result.getBedResults();
+            for (int j = 0; j < bedDiameter.length; j++) {
+                newFacets.add(new BedDiameterFacet((idx << 8) + j,
+                    BED_QUALITY_BED_DIAMETER_TOPLAYER,
+                    createDiameterTopLayerDescription(
+                        meta,
+                        bedDiameter[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+
+                newFacets.add(new BedDiameterFacet((idx << 8) +j,
+                    BED_QUALITY_BED_DIAMETER_SUBLAYER,
+                    createDiameterSubLayerDescription(
+                        meta,
+                        bedDiameter[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+            }
+            BedloadDiameterResult[] bedloadDiameter = result.getBedloadResults();
+            for (int j = 0;  j < bedloadDiameter.length; j++) {
+                newFacets.add(new BedloadDiameterFacet(
+                    (idx << 8) + j,
+                    BED_QUALITY_BEDLOAD_DIAMETER,
+                    createDiameterDescription(
+                        meta, bedloadDiameter[j]),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+
+            }
+            BedParametersResult[] bedParameters = result.getParameters();
+            for (int j = 0; j < bedParameters.length; j++) {
+                newFacets.add(new BedPorosityFacet((idx << 8) + j,
+                    BED_QUALITY_POROSITY_TOPLAYER,
+                    createPorosityTopLayerDescription(
+                        meta,
+                        bedParameters[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+
+                newFacets.add(new BedPorosityFacet((idx << 8) + j,
+                    BED_QUALITY_POROSITY_SUBLAYER,
+                    createPorositySubLayerDescription(
+                        meta,
+                        bedParameters[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+
+                newFacets.add(new BedDensityFacet((idx << 8) + j,
+                    BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER,
+                    createDensityTopLayerDescription(
+                        meta,
+                        bedParameters[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+
+                newFacets.add(new BedDensityFacet((idx << 8) + j,
+                    BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER,
+                    createDensitySubLayerDescription(
+                        meta,
+                        bedParameters[j],
+                        range),
+                    ComputeType.ADVANCE, stateId, hash));
+            }
+        }
+    }
+
+    protected String createPorosityTopLayerDescription(CallMeta meta,
+        BedParametersResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String toplayer = Resources.getMsg(meta, I18N_TOPLAYER, I18N_TOPLAYER);
+        return Resources.getMsg(meta, I18N_FACET_BED_POROSITY_TOPLAYER,
+            I18N_FACET_BED_POROSITY_TOPLAYER, new Object[] { from, to, toplayer });
+    }
+
+    protected String createPorositySubLayerDescription(CallMeta meta,
+        BedParametersResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String sublayer = Resources.getMsg(meta, I18N_SUBLAYER, I18N_SUBLAYER);
+        return Resources.getMsg(meta, I18N_FACET_BED_POROSITY_SUBLAYER,
+            I18N_FACET_BED_POROSITY_SUBLAYER, new Object[] { from, to, sublayer });
+    }
+
+    protected String createDensityTopLayerDescription(CallMeta meta,
+        BedParametersResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String toplayer = Resources.getMsg(meta, I18N_TOPLAYER, I18N_TOPLAYER);
+        return Resources.getMsg(meta, I18N_FACET_BED_DENSITY_TOPLAYER,
+            I18N_FACET_BED_DENSITY_TOPLAYER, new Object[] { from, to, toplayer });
+    }
+
+    protected String createDensitySubLayerDescription(CallMeta meta,
+        BedParametersResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String sublayer = Resources.getMsg(meta, I18N_SUBLAYER, I18N_SUBLAYER);
+        return Resources.getMsg(meta, I18N_FACET_BED_DENSITY_SUBLAYER,
+            I18N_FACET_BED_DENSITY_SUBLAYER, new Object[] { from, to, sublayer });
+    }
+
+    protected String createDiameterTopLayerDescription(CallMeta meta,
+        BedDiameterResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String toplayer = Resources.getMsg(meta, I18N_TOPLAYER, I18N_TOPLAYER);
+
+        return Resources.getMsg(meta, I18N_FACET_BED_DIAMETER_TOPLAYER,
+            I18N_FACET_BED_DIAMETER_TOPLAYER, new Object[] { result.getType(),
+                from, to, toplayer });
+    }
+
+    protected String createDiameterSubLayerDescription(CallMeta meta,
+        BedDiameterResult result, DateRange range) {
+        Date from = range != null ? range.getFrom() : new Date();
+        Date to = range != null ? range.getTo() : new Date();
+
+        String sublayer = Resources.getMsg(meta, I18N_SUBLAYER, I18N_SUBLAYER);
+        return Resources.getMsg(meta, I18N_FACET_BED_DIAMETER_SUBLAYER,
+            I18N_FACET_BED_DIAMETER_SUBLAYER, new Object[] { result.getType(),
+                from, to, sublayer });
+    }
+
+    protected String createDiameterDescription(CallMeta meta,
+        BedQualityDiameterResult result) {
+        return Resources.getMsg(meta, I18N_FACET_BEDLOAD_DIAMETER,
+            I18N_FACET_BEDLOAD_DIAMETER, new Object[] { result.getType() });
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/CharDiameter.java	Fri Sep 28 12:15:44 2012 +0200
@@ -4,16 +4,12 @@
 import java.util.List;
 
 import org.apache.log4j.Logger;
-import org.apache.poi.hssf.record.formula.functions.Rows;
-import org.w3c.dom.Element;
 
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.artifacts.common.model.KVP;
-import de.intevation.artifacts.common.utils.XMLUtils;
 import de.intevation.flys.artifacts.resources.Resources;
-import de.intevation.flys.artifacts.states.DefaultState;
 import de.intevation.flys.artifacts.states.MultiStringArrayState;
 
 public class CharDiameter extends MultiStringArrayState {
@@ -24,7 +20,6 @@
 
     private static final String CHAR_DIAMETER_MIN  = "calc.bed.dmin";
     private static final String CHAR_DIAMETER_MAX  = "calc.bed.dmax";
-    private static final String CHAR_DIAMETER_MID  = "calc.bed.dmid";
     private static final String CHAR_DIAMETER_90  = "calc.bed.d90";
     private static final String CHAR_DIAMETER_84  = "calc.bed.d84";
     private static final String CHAR_DIAMETER_80  = "calc.bed.d80";
@@ -54,7 +49,6 @@
         CHAR_DIAMETER_84,
         CHAR_DIAMETER_90,
         CHAR_DIAMETER_MAX,
-        CHAR_DIAMETER_MID,
         CHAR_DIAMETER_MIN
     };
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Fri Sep 28 12:15:44 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/collections/CollectionDescriptionHelper.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/CollectionDescriptionHelper.java	Fri Sep 28 12:15:44 2012 +0200
@@ -6,18 +6,16 @@
 
 import javax.xml.xpath.XPathConstants;
 
+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 org.apache.log4j.Logger;
-
 import de.intevation.artifacts.ArtifactDatabase;
 import de.intevation.artifacts.ArtifactDatabaseException;
 import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
-
 import de.intevation.artifacts.common.utils.XMLUtils;
 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator;
 
@@ -63,20 +61,17 @@
         long        ttl,
         CallContext callContext
     ) {
-        this.name     = name;
-        this.uuid     = uuid;
-        this.creation = creation;
-        this.ttl      = ttl;
-        this.context  = callContext;
-        this.database = callContext.getDatabase();
+        this.name      = name;
+        this.uuid      = uuid;
+        this.creation  = creation;
+        this.ttl       = ttl;
+        this.context   = callContext;
+        this.database  = callContext.getDatabase();
+        this.artifacts = new ArrayList<String>();
     }
 
 
     public void addArtifact(String uuid) {
-        if (artifacts == null) {
-            artifacts = new ArrayList<String>();
-        }
-
         if (uuid != null && uuid.length() > 0) {
             artifacts.add(uuid);
         }
@@ -197,10 +192,12 @@
 
 
     protected void appendAttribute(Element root) {
-        Document owner = root.getOwnerDocument();
-        Document attr  = attribute.toXML();
+        if (attribute != null) {
+            Document owner = root.getOwnerDocument();
+            Document attr  = attribute.toXML();
 
-        root.appendChild(owner.importNode(attr.getFirstChild(), true));
+            root.appendChild(owner.importNode(attr.getFirstChild(), true));
+        }
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,5 +1,21 @@
 package de.intevation.flys.collections;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.xpath.XPathConstants;
+
+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.Backend;
 import de.intevation.artifactdatabase.Backend.PersistentArtifact;
 import de.intevation.artifactdatabase.DefaultArtifactCollection;
@@ -19,22 +35,6 @@
 import de.intevation.flys.exports.OutputHelper;
 import de.intevation.flys.utils.FLYSUtils;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.xpath.XPathConstants;
-
-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;
-
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
@@ -126,6 +126,11 @@
         CollectionAttribute cAttribute =
             buildOutAttributes(db, context, oldParser, uuids);
 
+        if (cAttribute == null) {
+            log.warn("mergeAttributes: cAttribute == null");
+            return null;
+        }
+
         cAttribute.setLoadedRecommendations(
             getLoadedRecommendations(oldParser.getAttributeDocument()));
 
@@ -450,8 +455,6 @@
         AttributeParser  aParser,
         String[]         uuids)
     {
-        Document doc = XMLUtils.newDocument();
-
         FLYSContext flysContext = FLYSUtils.getFlysContext(context);
         StateEngine engine = (StateEngine) flysContext.get(
             FLYSContext.STATE_ENGINE_KEY);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/ChartGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -65,6 +65,7 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import de.intevation.flys.utils.Formatter;
 
 /**
  * The base class for chart creation. It should provide some basic things that
@@ -1669,6 +1670,12 @@
 
         area.applyTheme(dRenderer);
 
+        // i18n
+        dRenderer.setAreaLabelNumberFormat(Formatter.getFormatter(context.getMeta(), 2, 4));
+
+        dRenderer.setAreaLabelTemplate(Resources.getMsg(
+            context.getMeta(), "area.label.template", "Area=%sm2"));
+
         LegendItem legendItem = dRenderer.getLegendItem(idx, 0);
         if (legendItem != null) {
             legendItem.setLabelFont(legendFont);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/CrossSectionGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,20 +1,5 @@
 package de.intevation.flys.exports;
 
-import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-import de.intevation.artifacts.DataProvider;
-import de.intevation.flys.artifacts.geom.Lines;
-import de.intevation.flys.artifacts.model.CrossSectionFacet;
-import de.intevation.flys.artifacts.model.FacetTypes;
-import de.intevation.flys.artifacts.model.HYKFactory;
-import de.intevation.flys.jfree.FLYSAnnotation;
-import de.intevation.flys.jfree.StyledXYSeries;
-import de.intevation.flys.model.FastCrossSectionLine;
-import de.intevation.flys.themes.LineStyle;
-import de.intevation.flys.themes.TextStyle;
-import de.intevation.flys.themes.ThemeAccess;
-import de.intevation.flys.utils.Formatter;
-import de.intevation.flys.utils.ThemeUtil;
-
 import java.awt.BasicStroke;
 import java.awt.Color;
 import java.awt.Paint;
@@ -30,6 +15,22 @@
 import org.jfree.data.xy.XYSeries;
 import org.w3c.dom.Document;
 
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.artifacts.DataProvider;
+import de.intevation.flys.artifacts.geom.Lines;
+import de.intevation.flys.artifacts.model.CrossSectionFacet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.HYKFactory;
+import de.intevation.flys.artifacts.resources.Resources;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledXYSeries;
+import de.intevation.flys.model.FastCrossSectionLine;
+import de.intevation.flys.themes.LineStyle;
+import de.intevation.flys.themes.TextStyle;
+import de.intevation.flys.themes.ThemeAccess;
+import de.intevation.flys.utils.Formatter;
+import de.intevation.flys.utils.ThemeUtil;
+
 
 /**
  * An OutGenerator that generates cross section graphs.
@@ -40,19 +41,19 @@
 {
     /** The logger that is used in this generator. */
     private static Logger logger =
-        Logger.getLogger(CrossSectionGenerator.class);
+            Logger.getLogger(CrossSectionGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.cross_section.title";
+            "chart.cross_section.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.cross_section.subtitle";
+            "chart.cross_section.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.cross_section.xaxis.label";
+            "chart.cross_section.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.cross_section.yaxis.label";
+            "chart.cross_section.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT = "Querprofildiagramm";
     public static final String I18N_XAXIS_LABEL_DEFAULT = "Abstand [m]";
@@ -88,7 +89,7 @@
     @Override
     public String getDefaultChartTitle() {
         Object[] i18n_msg_args = new Object[] {
-            getRiverName()
+                getRiverName()
         };
         return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT, i18n_msg_args);
     }
@@ -110,20 +111,22 @@
     @Override
     protected String getDefaultChartSubtitle() {
         List<DataProvider> providers =
-            context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA);
+                context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA);
         double km = 0d;
         if (providers.size() > 0) {
             FastCrossSectionLine csl = (FastCrossSectionLine) providers.get(0).
-                provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA,
-                    null, context);
+                    provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA,
+                            null, context);
             km = csl == null ? -1 : csl.getKm();
         }
 
         Object[] args = new Object[] {
-            getRiverName(),
-            km
+                getRiverName(),
+                km
         };
 
+        logger.debug("Locale: " + Resources.getLocale(context.getMeta()));
+
         return msg(I18N_CHART_SUBTITLE, "", args);
     }
 
@@ -166,8 +169,8 @@
 
         // OPTMIMIZE: Pre-calculate positions
         ChartArea area = new ChartArea(
-            plot.getDomainAxis(0).getRange(),
-            plot.getRangeAxis().getRange());
+                plot.getDomainAxis(0).getRange(),
+                plot.getRangeAxis().getRange());
 
         for(FLYSAnnotation fa : this.annotations) {
 
@@ -203,13 +206,13 @@
                 fillPaint = colorForHYKZone(zone.getName());
 
                 XYBoxAnnotation boxA = new XYBoxAnnotation(zone.getFrom(), area.atGround(),
-                    zone.getTo(), area.ofGround(0.03f), basicStroke, tranPaint, fillPaint);
+                        zone.getTo(), area.ofGround(0.03f), basicStroke, tranPaint, fillPaint);
                 XYBoxAnnotation boxB = new XYBoxAnnotation(zone.getFrom(), area.atGround(),
-                    zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint);
+                        zone.getTo(), area.atTop(), basicStroke, fillPaint, tranPaint);
 
                 XYTextAnnotation tex = new XYTextAnnotation(zone.getName(),
-                    zone.getFrom() + (zone.getTo() - zone.getFrom()) / 1.0d,
-                    area.ofGround(0.015f));
+                        zone.getFrom() + (zone.getTo() - zone.getFrom()) / 1.0d,
+                        area.ofGround(0.015f));
                 if (textStyle != null) {
                     textStyle.apply(tex);
                 }
@@ -238,10 +241,10 @@
      */
     @Override
     public void doOut(
-        ArtifactAndFacet artifactFacet,
-        Document         attr,
-        boolean          visible
-    ) {
+            ArtifactAndFacet artifactFacet,
+            Document         attr,
+            boolean          visible
+            ) {
         String name = artifactFacet.getFacetName();
 
         logger.debug("CrossSectionGenerator.doOut: " + name);
@@ -253,41 +256,41 @@
 
         if (name.equals(CROSS_SECTION)) {
             doCrossSectionOut(
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                attr,
-                visible);
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    attr,
+                    visible);
         }
         else if (name.equals(CROSS_SECTION_WATER_LINE)) {
             doCrossSectionWaterLineOut(
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                attr,
-                visible);
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    attr,
+                    visible);
         }
         else if (FacetTypes.IS.AREA(name)) {
             doArea(artifactFacet.getData(context),
-                artifactFacet,
-                attr,
-                visible);
+                    artifactFacet,
+                    attr,
+                    visible);
         }
         else if (name.equals(HYK)) {
             doHyk(artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                attr,
-                visible);
+                    artifactFacet.getFacetDescription(),
+                    attr,
+                    visible);
         }
         else if (FacetTypes.IS.MANUALLINE(name)) {
             doCrossSectionWaterLineOut(
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                attr,
-                visible);
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    attr,
+                    visible);
         }
         else if (FacetTypes.IS.MANUALPOINTS(name)) {
             doPoints(artifactFacet.getData(context),
-                artifactFacet,
-                attr, visible, YAXIS.W.idx);
+                    artifactFacet,
+                    attr, visible, YAXIS.W.idx);
         }
         else {
             logger.warn("CrossSection.doOut: Unknown facet name: " + name);
@@ -311,11 +314,11 @@
      * @param theme Theme for the data series.
      */
     protected void doCrossSectionWaterLineOut(
-        Object   o,
-        String   seriesName,
-        Document theme,
-        boolean  visible
-    ) {
+            Object   o,
+            String   seriesName,
+            Document theme,
+            boolean  visible
+            ) {
         logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut");
 
         Lines.LineData lines = (Lines.LineData) o;
@@ -329,18 +332,18 @@
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "b=" + nf.format(lines.width) + "m";
             if (series.getLabel().length() == 0) {
-               series.setLabel(labelAdd);
+                series.setLabel(labelAdd);
             }
             else {
                 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";
             if (series.getLabel().length() == 0) {
-               series.setLabel(labelAdd);
+                series.setLabel(labelAdd);
             }
             else {
                 series.setLabel(series.getLabel() + ", " + labelAdd);
@@ -349,9 +352,9 @@
         if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "T=" + nf.format(lines.area / lines.width) + "m";
-                // : " + lines.area + "/" + lines.width);
+            // : " + lines.area + "/" + lines.width);
             if (series.getLabel().length() == 0) {
-               series.setLabel(labelAdd);
+                series.setLabel(labelAdd);
             }
             else {
                 series.setLabel(series.getLabel() + ", " + labelAdd);
@@ -366,11 +369,11 @@
 
     /** Add HYK-Annotations (colorize and label some areas, draw lines. */
     protected void doHyk(
-        Object   o,
-        String   seriesName,
-        Document theme,
-        boolean  visible
-    ) {
+            Object   o,
+            String   seriesName,
+            Document theme,
+            boolean  visible
+            ) {
         logger.debug("CrossSectionGenerator.doHyk");
 
         List<HYKFactory.Zone> zones = (List<HYKFactory.Zone>) o;
@@ -394,11 +397,11 @@
      * @param theme Theme for the data series.
      */
     protected void doCrossSectionOut(
-        Object   o,
-        String   seriesName,
-        Document theme,
-        boolean  visible
-    ) {
+            Object   o,
+            String   seriesName,
+            Document theme,
+            boolean  visible
+            ) {
         logger.debug("CrossSectionGenerator.doCrossSectionOut");
 
         XYSeries series = new StyledXYSeries(seriesName, theme);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DurationCurveExporter.java	Fri Sep 28 12:15:44 2012 +0200
@@ -42,7 +42,7 @@
 public class DurationCurveExporter extends AbstractExporter {
 
     /** The logger used in this exporter. */
-    private static Logger logger = Logger.getLogger(WaterlevelExporter.class);
+    private static Logger logger = Logger.getLogger(DurationCurveExporter.class);
 
 
     public static final String CSV_DURATION_HEADER =
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MapGenerator.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/MiddleBedHeightGenerator.java	Fri Sep 28 12:15:44 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/OutputHelper.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/OutputHelper.java	Fri Sep 28 12:15:44 2012 +0200
@@ -459,9 +459,13 @@
                       "default");
 
         if (t != null) {
+            log.debug("found theme for facet '" + facet + "'");
             t.setFacet(facet);
             t.setIndex(index);
         }
+        else {
+            log.warn("unable to find theme for facet '" + facet + "'");
+        }
 
         return t;
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/TimeseriesChartGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -633,7 +633,7 @@
     /**
      * Adjusts the axes of a plot. This method sets the <i>labelFont</i> of the
      * X axis.
-     * 
+     *
      * (Duplicate in XYChartGenerator).
      *
      * @param plot The XYPlot of the chart.
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/XYChartGenerator.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/DeltaWtExporter.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixATWriter.java	Fri Sep 28 12:15:44 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/FixChartGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixChartGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -19,7 +19,7 @@
     /** Private logger. */
     private static Logger logger = Logger.getLogger(FixChartGenerator.class);
 
-    public static final double INVALID_KM = Double.valueOf(-1d);
+    public static final Double INVALID_KM = Double.valueOf(-1d);
     public static final String CURRENT_KM = "currentKm";
     public static final String XPATH_CHART_CURRENTKM =
         "/art:action/art:attributes/art:currentKm/@art:km";
@@ -28,7 +28,7 @@
     public void init(Document request, OutputStream out, CallContext context) {
         super.init(request, out, context);
 
-        double currentKm = getCurrentKmFromRequest(request);
+        Double currentKm = getCurrentKmFromRequest(request);
 
         if (logger.isDebugEnabled()) {
             logger.debug("currentKm = " + currentKm);
@@ -37,7 +37,7 @@
         context.putContextValue(CURRENT_KM, currentKm);
     }
 
-    public static double getCurrentKmFromRequest(Document request) {
+    public static final Double getCurrentKmFromRequest(Document request) {
 
         String km = XMLUtils.xpathString(
             request,
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,9 +1,24 @@
 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;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.data.time.Day;
+import org.jfree.data.time.RegularTimePeriod;
+import org.jfree.data.time.TimeSeries;
+import org.jfree.data.time.TimeSeriesCollection;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.common.utils.XMLUtils;
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.access.FixAnalysisAccess;
 import de.intevation.flys.artifacts.model.DateRange;
@@ -19,24 +34,6 @@
 import de.intevation.flys.jfree.StyledValueMarker;
 import de.intevation.flys.utils.ThemeUtil;
 
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.xpath.XPathConstants;
-
-import org.apache.log4j.Logger;
-import org.jfree.chart.annotations.XYTextAnnotation;
-import org.jfree.data.time.Day;
-import org.jfree.data.time.RegularTimePeriod;
-import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.TimeSeriesCollection;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
 
 /**
  * Generator for Delta W(t) charts.
@@ -48,25 +45,22 @@
 {
     /** Private logger. */
     private static Logger logger =
-        Logger.getLogger(FixDeltaWtGenerator.class);
-
-    public static final String XPATH_CHART_CURRENTKM =
-        "/art:action/art:attributes/art:currentKm";
+            Logger.getLogger(FixDeltaWtGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fix.deltawt.title";
+            "chart.fix.deltawt.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fix.deltawt.subtitle";
+            "chart.fix.deltawt.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fix.deltawt.xaxis.label";
+            "chart.fix.deltawt.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fix.deltawt.yaxis.label";
+            "chart.fix.deltawt.yaxis.label";
 
     public static final String I18N_YAXIS_SECOND_LABEL =
-        "chart.fix.deltawt.yaxis.second.label";
+            "chart.fix.deltawt.yaxis.second.label";
 
 
     public static enum YAXIS {
@@ -110,7 +104,8 @@
                 context.getMeta(),
                 I18N_CHART_TITLE,
                 "",
-                getCurrentKmFromRequest().doubleValue());
+                FixChartGenerator
+                .getCurrentKmFromRequest(request).doubleValue());
     }
 
 
@@ -152,10 +147,10 @@
 
     @Override
     public void doOut(
-        ArtifactAndFacet artifactFacet,
-        Document         theme,
-        boolean          visible
-    ) {
+            ArtifactAndFacet artifactFacet,
+            Document         theme,
+            boolean          visible
+            ) {
         String name = artifactFacet.getFacetName();
         logger.debug("FixDeltaWtGenerator.doOut: " + name);
         logger.debug("Theme description is: " + artifactFacet.getFacetDescription());
@@ -164,57 +159,92 @@
 
         if (name.contains(FIX_SECTOR_AVERAGE_DWT)) {
             doSectorAverageOut(
-                (FLYSArtifact) artifactFacet.getArtifact(),
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                theme,
-                visible);
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
         }
         else if (name.equals(FIX_REFERENCE_EVENTS_DWT)) {
             doReferenceEventsOut(
-                (FLYSArtifact) artifactFacet.getArtifact(),
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                theme,
-                visible);
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
         }
         else if (name.equals(FIX_ANALYSIS_EVENTS_DWT)) {
             doAnalysisEventsOut(
-                (FLYSArtifact) artifactFacet.getArtifact(),
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                theme,
-                visible);
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
         }
         else if (name.equals(FIX_DEVIATION_DWT)) {
             doDeviationOut(
-                (FLYSArtifact) artifactFacet.getArtifact(),
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                theme,
-                visible);
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
         }
         else if (name.equals(FIX_ANALYSIS_PERIODS_DWT)) {
             doAnalysisPeriodsOut(
-                (FLYSArtifact) artifactFacet.getArtifact(),
-                artifactFacet.getData(context),
-                artifactFacet.getFacetDescription(),
-                theme,
-                visible);
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    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,
+                    theme, visible, YAXIS.dW.idx);
         }
         else {
-           logger.warn("doOut(): unknown facet name: " + name);
-           return;
+            logger.warn("doOut(): unknown facet name: " + name);
+            return;
         }
     }
 
 
+    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,
-        String       desc,
-        Document     theme,
-        boolean      visible)
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible)
     {
         logger.debug("doSectorAverageOut(): description = " + desc);
 
@@ -238,19 +268,29 @@
         tsc.addSeries(series);
 
         addAxisDataset(tsc, 0, visible);
-        Map<Integer, int[]> annoIdxMap = new HashMap<Integer, int[]>();
-        annoIdxMap.put (0, new int[]{0,0});
-        doQWDTextAnnotations(annoIdxMap, tsc, qwd.qwd, theme, visible);
+
+        if (visible && ThemeUtil.parseShowLineLabel(theme)) {
+            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+                    "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000,
+                    tsc.getXValue(0, 0),
+                    qwd.qwd.getDeltaW());
+            textAnnos.add(anno);
+
+            FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme);
+            flysAnno.setTextAnnotations(textAnnos);
+            addAnnotations(flysAnno);
+        }
     }
 
 
     protected void doAnalysisEventsOut(
-        FLYSArtifact artifact,
-        Object       data,
-        String       desc,
-        Document     theme,
-        boolean      visible
-    ) {
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible
+            ) {
         logger.debug("doAnalysisEventsOut: desc = " + desc);
 
         QWD qwd = (QWD) data;
@@ -317,16 +357,20 @@
             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",
-                x,
-                qwd.getDeltaW());
+                    nf.format(qwd.getQ()) + " m\u00B3/s",
+                    x,
+                    qwd.getDeltaW());
             textAnnos.add(anno);
         }
 
@@ -337,12 +381,12 @@
 
 
     protected void doReferenceEventsOut(
-        FLYSArtifact artifact,
-        Object       data,
-        String       desc,
-        Document     theme,
-        boolean      visible
-    ) {
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible
+            ) {
         logger.debug("doReferenceEventsOut: desc = " + desc);
 
         QWD qwd = (QWD) data;
@@ -351,12 +395,12 @@
 
 
     protected void doDeviationOut(
-        FLYSArtifact artifact,
-        Object       data,
-        String       desc,
-        Document     theme,
-        boolean      visible
-    ) {
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible
+            ) {
         logger.debug("doDeviationOut: desc = " + desc);
 
         if (data == null || !visible) {
@@ -373,14 +417,12 @@
 
 
     protected void doAnalysisPeriodsOut(
-        FLYSArtifact artifact,
-        Object       data,
-        String       desc,
-        Document     theme,
-        boolean      visible
-    ) {
-        logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc);
-
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible)
+    {
         DateRange[] ranges = (DateRange[]) data;
         if (ranges == null || !visible) {
             return;
@@ -390,8 +432,8 @@
             RegularTimePeriod start = new Day(ranges[i].getFrom());
             RegularTimePeriod end = new Day(ranges[i].getTo());
             StyledDomainMarker marker =
-                new StyledDomainMarker(start.getMiddleMillisecond(),
-                                   end.getMiddleMillisecond(), theme);
+                    new StyledDomainMarker(start.getMiddleMillisecond(),
+                            end.getMiddleMillisecond(), theme);
             marker.useSecondColor(i % 2 == 0);
             domainMarker.add(marker);
         }
@@ -403,7 +445,7 @@
     public void init(Document request, OutputStream out, CallContext context) {
         super.init(request, out, context);
 
-        Double currentKm = getCurrentKmFromRequest();
+        Double currentKm = FixChartGenerator.getCurrentKmFromRequest(request);
 
         if (logger.isDebugEnabled()) {
             logger.debug("currentKm = " + currentKm);
@@ -414,28 +456,5 @@
         StyledValueMarker marker = new StyledValueMarker(0, request);
         valueMarker.add(marker);
     }
-
-    protected Double getCurrentKmFromRequest() {
-        Element km = (Element)XMLUtils.xpath(
-            request,
-            XPATH_CHART_CURRENTKM,
-            XPathConstants.NODE,
-            ArtifactNamespaceContext.INSTANCE);
-
-        if (km == null) {
-            return Double.valueOf(-1d);
-        }
-
-        String uri = ArtifactNamespaceContext.NAMESPACE_URI;
-        // XXX: When using XPath already why is the 'km'
-        //      attribute not fetched directly?
-        String currentKm = km.getAttributeNS(uri, "km");
-        try {
-            return Double.valueOf(currentKm);
-        }
-        catch (NumberFormatException nfe) {
-            return Double.valueOf(-1d);
-        }
-    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,5 +1,8 @@
 package de.intevation.flys.exports.fixings;
 
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet;
@@ -9,9 +12,6 @@
 import de.intevation.flys.jfree.JFreeUtil;
 import de.intevation.flys.jfree.StyledXYSeries;
 
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 /**
  * Generator for fixation derived function curve.
  *
@@ -21,29 +21,30 @@
 extends FixChartGenerator
 implements FacetTypes
 {
+    /** Private logger. */
     private static Logger logger =
-        Logger.getLogger(FixDerivedCurveGenerator.class);
+            Logger.getLogger(FixDerivedCurveGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.derivedcurve.title";
+            "chart.fixings.derivedcurve.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.derivedcurve.subtitle";
+            "chart.fixings.derivedcurve.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.derivedcurve.xaxis.label";
+            "chart.fixings.derivedcurve.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.derivedcurve.yaxis.label";
+            "chart.fixings.derivedcurve.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT =
-        "Ableitungskurve";
+            "Ableitungskurve";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT =
-        "Q [m\u00B3/s]";
+            "Q [m\u00B3/s]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT =
-        "W [NN + m]";
+            "W [NN + m]";
 
     public static enum YAXIS {
         W(0),
@@ -59,26 +60,33 @@
     public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doOut");
 
-        FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet();
-        FixFunction func = (FixFunction)facet.getData(
-            aaf.getArtifact(), context);
-
-        if (func == null) {
-            logger.warn("doOut: Facet does not contain FixFunction");
-            return;
+        if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) {
+            doPoints(aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.W.idx);
         }
+        else {
+            FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet();
+            FixFunction func = (FixFunction)facet.getData(
+                    aaf.getArtifact(), context);
 
-        double maxQ = func.getMaxQ();
+            if (func == null) {
+                logger.warn("doOut: Facet does not contain FixFunction");
+                return;
+            }
 
-        if (maxQ > 0) {
-            StyledXYSeries series = JFreeUtil.sampleFunction2D(
-                func.getFunction(),
-                doc,
-                aaf.getFacetDescription(),
-                500,   // number of samples
-                0.0 ,  // start
-                maxQ); // end
-            addAxisSeries(series, 0, visible);
+            double maxQ = func.getMaxQ();
+
+            if (maxQ > 0) {
+                StyledXYSeries series = JFreeUtil.sampleFunction2D(
+                        func.getFunction(),
+                        doc,
+                        aaf.getFacetDescription(),
+                        500,   // number of samples
+                        0.0 ,  // start
+                        maxQ); // end
+                addAxisSeries(series, 0, visible);
+            }
         }
     }
 
@@ -120,12 +128,11 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }
         };
     }
 }
-
 // 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,60 +1,52 @@
 package de.intevation.flys.exports.fixings;
 
-import de.intevation.artifactdatabase.state.ArtifactAndFacet;
-
-import de.intevation.flys.artifacts.model.FacetTypes;
-
-import de.intevation.flys.artifacts.model.fixings.AnalysisPeriod;
-import de.intevation.flys.artifacts.model.fixings.QWD;
-
-import de.intevation.flys.exports.ChartGenerator;
-
-import de.intevation.flys.jfree.FLYSAnnotation;
-import de.intevation.flys.jfree.StyledAreaSeriesCollection;
-import de.intevation.flys.jfree.StyledXYSeries;
-
-import de.intevation.flys.utils.KMIndex;
-
 import java.awt.BasicStroke;
 import java.awt.Color;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.plot.Marker;
 import org.jfree.chart.plot.ValueMarker;
-
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
+import org.w3c.dom.Document;
 
-import org.w3c.dom.Document;
+import de.intevation.artifactdatabase.state.ArtifactAndFacet;
+import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.fixings.AnalysisPeriod;
+import de.intevation.flys.artifacts.model.fixings.QWD;
+import de.intevation.flys.exports.ChartGenerator;
+import de.intevation.flys.jfree.FLYSAnnotation;
+import de.intevation.flys.jfree.StyledAreaSeriesCollection;
+import de.intevation.flys.jfree.StyledXYSeries;
+import de.intevation.flys.utils.KMIndex;
 
 public class FixLongitudinalSectionGenerator
 extends FixChartGenerator
 implements FacetTypes
 {
     private static Logger logger =
-        Logger.getLogger(FixLongitudinalSectionGenerator.class);
+            Logger.getLogger(FixLongitudinalSectionGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.longitudinalsection.title";
+            "chart.fixings.longitudinalsection.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.longitudinalsection.subtitle";
+            "chart.fixings.longitudinalsection.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.longitudinalsection.xaxis.label";
+            "chart.fixings.longitudinalsection.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.longitudinalsection.yaxis.label";
+            "chart.fixings.longitudinalsection.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT  =
-        "Fixierungsanalyse";
+            "Fixierungsanalyse";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "[km]";
+            "[km]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
-        "delta W [cm]";
+            "delta W [cm]";
 
     public static enum YAXIS {
         dW(0);
@@ -86,10 +78,15 @@
         }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
             doAnnotations(
-                 (FLYSAnnotation) aaf.getData(context),
-                 aaf,
-                 doc,
-                 visible);
+                    (FLYSAnnotation) aaf.getData(context),
+                    aaf,
+                    doc,
+                    visible);
+        }
+        else if (FacetTypes.IS.MANUALPOINTS(name)) {
+            doPoints (aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.dW.idx);
         }
         else {
             logger.warn("Unknown facet name " + name);
@@ -99,9 +96,9 @@
 
     @SuppressWarnings("unchecked")
     protected void doSectorAverageOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
 
@@ -109,7 +106,7 @@
         int sectorNdx = index & 3;
 
         KMIndex<AnalysisPeriod> kms =
-            (KMIndex<AnalysisPeriod>)aaf.getData(context);
+                (KMIndex<AnalysisPeriod>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -135,9 +132,9 @@
 
     @SuppressWarnings("unchecked")
     protected void doSectorAverageDeviationOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex());
 
@@ -145,7 +142,7 @@
         int sectorNdx = index & 3;
 
         KMIndex<AnalysisPeriod> kms =
-            (KMIndex<AnalysisPeriod>)aaf.getData(context);
+                (KMIndex<AnalysisPeriod>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -153,10 +150,9 @@
 
         StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
         XYSeries upper =
-            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+                new StyledXYSeries(aaf.getFacetDescription(), false, doc);
         XYSeries lower =
-            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
-
+                new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
         for (KMIndex.Entry<AnalysisPeriod> entry: kms) {
             double km = entry.getKm();
@@ -182,14 +178,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doReferenceDeviationOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doReferenceOut");
 
         KMIndex<double[]> kms =
-            (KMIndex<double[]>)aaf.getData(context);
+                (KMIndex<double[]>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -197,9 +193,9 @@
 
         StyledAreaSeriesCollection area = new StyledAreaSeriesCollection(doc);
         XYSeries upper =
-            new StyledXYSeries(aaf.getFacetDescription(), false, doc);
+                new StyledXYSeries(aaf.getFacetDescription(), false, doc);
         XYSeries lower =
-            new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
+                new StyledXYSeries(aaf.getFacetDescription() + " ", false, doc);
 
 
         for (KMIndex.Entry<double[]> entry: kms) {
@@ -226,14 +222,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doAnalysisEventsOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doAnalysisEventsOut");
 
         KMIndex<QWD> kms =
-            (KMIndex<QWD>)aaf.getData(context);
+                (KMIndex<QWD>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -247,7 +243,7 @@
             double km = entry.getKm();
             QWD qwd = entry.getValue();
 
-                series.add(km, qwd.getDeltaW());
+            series.add(km, qwd.getDeltaW());
         }
         col.addSeries(series);
 
@@ -256,14 +252,14 @@
 
     @SuppressWarnings("unchecked")
     protected void doReferenceEventsOut(
-        ArtifactAndFacet aaf,
-        Document doc,
-        boolean visible)
+            ArtifactAndFacet aaf,
+            Document doc,
+            boolean visible)
     {
         logger.debug("doReferenceEventOut");
 
         KMIndex<QWD> kms =
-            (KMIndex<QWD>)aaf.getData(context);
+                (KMIndex<QWD>)aaf.getData(context);
 
         if(kms == null) {
             return;
@@ -309,7 +305,7 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,5 +1,23 @@
 package de.intevation.flys.exports.fixings;
 
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.annotations.XYTextAnnotation;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+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;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.artifactdatabase.state.Facet;
 import de.intevation.flys.artifacts.FLYSArtifact;
@@ -14,8 +32,8 @@
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
-import de.intevation.flys.artifacts.model.fixings.QW;
 import de.intevation.flys.artifacts.model.fixings.QWD;
+import de.intevation.flys.artifacts.model.fixings.QWI;
 import de.intevation.flys.artifacts.resources.Resources;
 import de.intevation.flys.exports.ChartGenerator;
 import de.intevation.flys.exports.StyledSeriesBuilder;
@@ -24,31 +42,10 @@
 import de.intevation.flys.jfree.JFreeUtil;
 import de.intevation.flys.jfree.StickyAxisAnnotation;
 import de.intevation.flys.jfree.StyledXYSeries;
-import de.intevation.flys.utils.ThemeUtil;
-import de.intevation.flys.utils.FLYSUtils;
-
 import de.intevation.flys.model.Gauge;
 import de.intevation.flys.model.River;
-
-import org.jfree.chart.plot.Marker;
-import org.jfree.chart.plot.ValueMarker;
-import org.jfree.ui.RectangleAnchor;
-import org.jfree.ui.TextAnchor;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-
-
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.log4j.Logger;
-import org.jfree.chart.JFreeChart;
-import org.jfree.chart.annotations.XYTextAnnotation;
-import org.jfree.chart.title.TextTitle;
-import org.jfree.data.xy.XYSeries;
-import org.w3c.dom.Document;
+import de.intevation.flys.utils.FLYSUtils;
+import de.intevation.flys.utils.ThemeUtil;
 
 /**
  * Generator for WQ fixing charts.
@@ -59,31 +56,31 @@
 implements   FacetTypes
 {
     private static Logger logger =
-        Logger.getLogger(FixWQCurveGenerator.class);
+            Logger.getLogger(FixWQCurveGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.wq.title";
+            "chart.fixings.wq.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.wq.subtitle";
+            "chart.fixings.wq.subtitle";
 
     public static final String I18N_CHART_SUBTITLE1 =
-        "chart.fixings.wq.subtitle1";
+            "chart.fixings.wq.subtitle1";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.wq.xaxis.label";
+            "chart.fixings.wq.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.wq.yaxis.label";
+            "chart.fixings.wq.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT  =
-        "Fixierungsanalyse";
+            "Fixierungsanalyse";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT  =
-        "Q [m\u00B3/s]";
+            "Q [m\u00B3/s]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT  =
-        "W [NN + m]";
+            "W [NN + m]";
 
     public static enum YAXIS {
         W(0),
@@ -132,16 +129,21 @@
                     doc,
                     visible);
         }
-        if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) {
+        else if (LONGITUDINAL_W.equals(name) || STATIC_WQ.equals(name)) {
             doWQOut(aaf.getData(context), aaf, doc, visible);
         }
         else if (name.equals(DISCHARGE_CURVE)) {
             doDischargeOut(
-                (WINFOArtifact) aaf.getArtifact(),
-                aaf.getData(context),
-                aaf.getFacetDescription(),
-                doc,
-                visible);
+                    (WINFOArtifact) aaf.getArtifact(),
+                    aaf.getData(context),
+                    aaf.getFacetDescription(),
+                    doc,
+                    visible);
+        }
+        else if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) {
+            doPoints(aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.W.idx);
         }
         else {
             logger.warn("Unknown facet name " + name);
@@ -174,15 +176,15 @@
             List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
 
             DateFormat dateFormat = DateFormat.getDateInstance(
-                DateFormat.SHORT);
+                    DateFormat.SHORT);
 
-                series.add(qwd.getQ(), qwd.getW());
+            series.add(qwd.getQ(), qwd.getW());
 
-                XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                     dateFormat.format(qwd.getDate()),
                     qwd.getQ(),
                     qwd.getW());
-                textAnnos.add(anno);
+            textAnnos.add(anno);
 
             addAxisSeries(series, 0, visible);
             if(visible && ThemeUtil.parseShowPointLabel(doc)) {
@@ -198,22 +200,22 @@
 
     /** Add reference event points to chart */
     protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
-       logger.debug("doReferenceEventsOut");
+        logger.debug("doReferenceEventsOut");
 
-       QW qwd = (QW)aaf.getData(context);
-       if(qwd != null) {
+        QWI qwd = (QWI)aaf.getData(context);
+        if(qwd != null) {
             XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), doc);
             List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
 
             DateFormat dateFormat = DateFormat.getDateInstance(
-                DateFormat.SHORT);
+                    DateFormat.SHORT);
 
             series.add(qwd.getQ(), qwd.getW());
 
             XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
-                dateFormat.format(qwd.getDate()),
-                qwd.getQ(),
-                qwd.getW());
+                    dateFormat.format(qwd.getDate()),
+                    qwd.getQ(),
+                    qwd.getW());
             textAnnos.add(anno);
 
             addAxisSeries(series, 0, visible);
@@ -233,7 +235,7 @@
 
         FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet();
         FixFunction func = (FixFunction)facet.getData(
-            aaf.getArtifact(), context);
+                aaf.getArtifact(), context);
 
         if (func == null) {
             logger.warn("doWQCurveOut: Facet does not contain FixFunction");
@@ -244,12 +246,12 @@
 
         if (maxQ > 0) {
             StyledXYSeries series = JFreeUtil.sampleFunction2D(
-                func.getFunction(),
-                doc,
-                aaf.getFacetDescription(),
-                500,   // number of samples
-                0.0 ,  // start
-                maxQ); // end
+                    func.getFunction(),
+                    doc,
+                    aaf.getFacetDescription(),
+                    500,   // number of samples
+                    0.0 ,  // start
+                    maxQ); // end
 
             addAxisSeries(series, 0, visible);
         }
@@ -261,7 +263,7 @@
     protected void doOutlierOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doOutlierOut");
 
-        QW[] qws = (QW[])aaf.getData(context);
+        QWI[] qws = (QWI[])aaf.getData(context);
         addQWSeries(qws, aaf, doc, visible);
     }
 
@@ -273,12 +275,21 @@
             return;
         }
 
-        List<NamedDouble> qsectors = (List<NamedDouble>) aaf.getData(context);
-
-        if (qsectors == null) {
+        Object qsectorsObj = aaf.getData(context);
+        if (qsectorsObj == null || !(qsectorsObj instanceof List)) {
             logger.warn("No QSectors coming from data.");
             return;
         }
+
+        List<?> qsectorsList = (List<?>) qsectorsObj;
+        if (qsectorsList.size() == 0 || !(qsectorsList.get(0) instanceof NamedDouble)) {
+            logger.warn("No QSectors coming from data.");
+            return;
+        }
+
+        @SuppressWarnings("unchecked")
+        List<NamedDouble> qsectors = (List<NamedDouble>) qsectorsList;
+
         for (NamedDouble qsector : qsectors) {
             if (Double.isNaN(qsector.getValue())) {
                 continue;
@@ -294,11 +305,11 @@
             }
             else {
                 stroke = new BasicStroke(size,
-                    BasicStroke.CAP_BUTT,
-                    BasicStroke.JOIN_ROUND,
-                    1.0f,
-                    dashes,
-                    0.0f);
+                        BasicStroke.CAP_BUTT,
+                        BasicStroke.JOIN_ROUND,
+                        1.0f,
+                        dashes,
+                        0.0f);
             }
             m.setStroke(stroke);
 
@@ -313,6 +324,7 @@
             }
             m.setLabelAnchor(RectangleAnchor.TOP_LEFT);
             m.setLabelTextAnchor(TextAnchor.TOP_LEFT);
+            m.setLabelOffset(new RectangleInsets(5, 5, 10, 10));
             addDomainMarker(m);
         }
     }
@@ -324,11 +336,11 @@
      * @param theme theme to use.
      */
     protected void doWAnnotations(
-        Object   wqkms,
-        ArtifactAndFacet aandf,
-        Document theme,
-        boolean  visible
-    ) {
+            Object   wqkms,
+            ArtifactAndFacet aandf,
+            Document theme,
+            boolean  visible
+            ) {
         Facet facet = aandf.getFacet();
 
         List<StickyAxisAnnotation> xy = new ArrayList<StickyAxisAnnotation>();
@@ -337,11 +349,11 @@
             double [][] data = (double [][]) wqkms;
             for (int i = 0; i< data[0].length; i++) {
                 xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-                    (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+                        (float) data[1][i], StickyAxisAnnotation.SimpleAxis.Y_AXIS));
             }
 
             doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
-                aandf, theme, visible);
+                    aandf, theme, visible);
         }
         else {
             // Assume its WKms.
@@ -350,15 +362,14 @@
 
             Double ckm = (Double) context.getContextValue(CURRENT_KM);
             double location = (ckm != null)
-                              ? ckm.doubleValue()
-                              : getRange()[0];
-            double w = ((StaticWKmsArtifact) aandf.getArtifact())
-                .getWAtKmLin(data, location);
-            xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
-              (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
+                    ? ckm.doubleValue()
+                            : getRange()[0];
+                    double w = StaticWKmsArtifact.getWAtKmLin(data, location);
+                    xy.add(new StickyAxisAnnotation(aandf.getFacetDescription(),
+                            (float) w, StickyAxisAnnotation.SimpleAxis.Y_AXIS));
 
-            doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
-                aandf, theme, visible);
+                    doAnnotations(new FLYSAnnotation(facet.getDescription(), xy),
+                            aandf, theme, visible);
         }
     }
 
@@ -367,11 +378,11 @@
      * Add series with discharge curve to diagram.
      */
     protected void doDischargeOut(
-        WINFOArtifact artifact,
-        Object        o,
-        String        description,
-        Document      theme,
-        boolean       visible)
+            WINFOArtifact artifact,
+            Object        o,
+            String        description,
+            Document      theme,
+            boolean       visible)
     {
         WQKms wqkms = (WQKms) o;
 
@@ -392,9 +403,7 @@
         }
 
         XYSeries series = new StyledXYSeries(description, theme);
-
         StyledSeriesBuilder.addPointsQW(series, wqkms);
-
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
@@ -404,18 +413,16 @@
      * @param wqkms data as double[][]
      */
     protected void doWQOut(
-        Object           wqkms,
-        ArtifactAndFacet aaf,
-        Document         theme,
-        boolean          visible
-    ) {
+            Object           wqkms,
+            ArtifactAndFacet aaf,
+            Document         theme,
+            boolean          visible
+            ) {
         logger.debug("FixWQCurveGenerator: doWQOut");
         if (wqkms instanceof WQKms) {
             WQKms data = (WQKms) wqkms;
 
             XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
-            Double ckm = (Double) context.getContextValue(CURRENT_KM);
-
             StyledSeriesBuilder.addPointsQW(series, data);
 
             addAxisSeries(series, YAXIS.W.idx, visible);
@@ -431,30 +438,39 @@
     }
 
 
-    protected void addQWSeries(QW[] qws, ArtifactAndFacet aaf, Document theme, boolean visible) {
-         if(qws != null) {
-            XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
-            List<XYTextAnnotation> textAnnos = new ArrayList<XYTextAnnotation>();
+    protected void addQWSeries(
+            QWI []           qws,
+            ArtifactAndFacet aaf,
+            Document         theme,
+            boolean          visible
+            ) {
+        if (qws == null) {
+            return;
+        }
 
-            DateFormat dateFormat = DateFormat.getDateInstance(
+        XYSeries series = new StyledXYSeries(aaf.getFacetDescription(), theme);
+        List<XYTextAnnotation> textAnnos =
+                new ArrayList<XYTextAnnotation>(qws.length);
+
+        DateFormat dateFormat = DateFormat.getDateInstance(
                 DateFormat.SHORT);
 
-            for(QW qw : qws) {
-                series.add(qw.getQ(), qw.getW());
+        for (QWI qw: qws) {
+            series.add(qw.getQ(), qw.getW());
 
-                XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
+            XYTextAnnotation anno = new CollisionFreeXYTextAnnotation(
                     dateFormat.format(qw.getDate()),
                     qw.getQ(),
                     qw.getW());
-                textAnnos.add(anno);
-            }
+            textAnnos.add(anno);
+        }
 
-            addAxisSeries(series, 0, visible);
-            if(visible && ThemeUtil.parseShowPointLabel(theme)) {
-                FLYSAnnotation flysAnno = new FLYSAnnotation(null, null, null, theme);
-                flysAnno.setTextAnnotations(textAnnos);
-                addAnnotations(flysAnno);
-            }
+        addAxisSeries(series, 0, visible);
+        if (visible && ThemeUtil.parseShowPointLabel(theme)) {
+            FLYSAnnotation flysAnno =
+                    new FLYSAnnotation(null, null, null, theme);
+            flysAnno.setTextAnnotations(textAnnos);
+            addAnnotations(flysAnno);
         }
     }
 
@@ -545,7 +561,7 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java	Fri Sep 28 12:15:44 2012 +0200
@@ -28,7 +28,7 @@
 public class ParametersExporter
 extends      AbstractExporter
 {
-    private static Logger log = Logger.getLogger(DeltaWtExporter.class);
+    private static Logger log = Logger.getLogger(ParametersExporter.class);
 
     protected List<Parameters> parametersList;
 
--- /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:44 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:44 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:44 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:44 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:44 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:44 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);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityExporter.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,216 @@
+package de.intevation.flys.exports.minfo;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.DateFormat;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+import au.com.bytecode.opencsv.CSVWriter;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.minfo.BedDiameterResult;
+import de.intevation.flys.artifacts.model.minfo.BedParametersResult;
+import de.intevation.flys.artifacts.model.minfo.BedQualityResult;
+import de.intevation.flys.artifacts.model.minfo.BedloadDiameterResult;
+import de.intevation.flys.exports.AbstractExporter;
+import de.intevation.flys.utils.Formatter;
+
+
+public class BedQualityExporter
+extends AbstractExporter
+{
+    /** Private logger. */
+    private static Logger logger = Logger.getLogger(BedQualityExporter.class);
+
+    private static final String CSV_HEADER_KM = "export.minfo.bedquality.km";
+    private static final String CSV_HEADER_DENSITY_CAP =
+        "export.minfo.bedquality.density_cap";
+    private static final String CSV_HEADER_DENSITY_SUB =
+        "export.minfo.bedquality.density_sub";
+    private static final String CSV_HEADER_POROSITY_CAP =
+        "export.minfo.bedquality.porosity_cap";
+    private static final String CSV_HEADER_POROSITY_SUB =
+        "export.minfo.bedquality.porosity_sub";
+    private static final String CSV_HEADER_BEDLOAD =
+        "export.minfo.bedquality.bedload";
+    private static final String CSV_HEADER_BED_CAP =
+        "export.minfo.bedquality.bed_cap";
+    private static final String CSV_HEADER_BED_SUB =
+        "export.minfo.bedquality.bed_sub";
+
+    private BedQualityResult[] results;
+
+    @Override
+    public void init(Document request, OutputStream out, CallContext context) {
+        logger.debug("BedQualityExporter.init");
+        super.init(request, out, context);
+        results = new BedQualityResult[0];
+    }
+
+    @Override
+    protected void writeCSVData(CSVWriter writer) throws IOException {
+        // TODO Auto-generated method stub
+        writeCSVHeader(writer);
+
+        NumberFormat kmf = Formatter.getCalculationKm(context.getMeta());
+
+        TDoubleArrayList kms = new TDoubleArrayList();
+        int cols = 1;
+        for (int i = 0; i < results.length; i++) {
+            BedDiameterResult[] beds = results[i].getBedResults();
+            for (int j = 0; j < beds.length; j++) {
+                TDoubleArrayList bkms = beds[j].getKms();
+                for (int k = 0; k < bkms.size(); k++) {
+                    if (!kms.contains(bkms.get(k))) {
+                        kms.add(bkms.get(k));
+                    }
+                }
+            }
+            BedloadDiameterResult[] loads = results[i].getBedloadResults();
+            for (int j = 0; j < loads.length; j++) {
+                TDoubleArrayList lkms = loads[i].getKms();
+                for (int k = 0; k < lkms.size(); k++) {
+                    if (!kms.contains(lkms.get(k))) {
+                        kms.add(lkms.get(k));
+                    }
+                }
+            }
+            cols += beds.length * 2;
+            cols += loads.length;
+            if (beds.length > 0) {
+                cols += 4;
+            }
+        }
+
+        kms.sort();
+        List<double[]> rows = new LinkedList<double[]>();
+        for (int i = 0; i < kms.size(); i++) {
+            double[] row = new double[cols];
+            double km = kms.get(i);
+            row[0] = km;
+            for (int j = 0; j < results.length; j++) {
+                BedloadDiameterResult[] loads = results[j].getBedloadResults();
+
+                for(int k = 0; k < loads.length; k++) {
+                    // k + 1: shift km column.
+                    // j* loads.length: shift periods.
+                    row[(k + 1) + (j * loads.length)] =
+                        loads[k].getDiameter(km);
+                }
+                BedDiameterResult[] beds = results[j].getBedResults();
+                for (int k = 0; k < beds.length; k++) {
+                    // k + 1: shift km column.
+                    // j * beds.length: shift periods.
+                    // loads.length * results.length: shift bed load columns.
+                    int ndx = (k + 1) + (j * beds.length) + (loads.length * results.length);
+                    row[ndx] = beds[k].getDiameterCap(km);
+                    row[ndx + 1] = beds[k].getDiameterSub(km);
+                }
+                BedParametersResult[] params = results[j].getParameters();
+                for(int k = 0; k < params.length; k++) {
+                    // loads.length + (beds.lenght * 2) * (j + 1): shift bed and bedload columns.
+                    int ndx = 1 + (loads.length + (beds.length * 2) * (j + 1));
+                    row[ndx] = params[k].getLoadDensityCap(km);
+                    row[ndx + 1] = params[k].getLoadDensitySub(km);
+                    row[ndx + 2] = params[k].getPorosityCap(km);
+                    row[ndx + 3] = params[k].getPorositySub(km);
+                }
+            }
+            rows.add(row);
+        }
+        for (double[] d : rows) {
+            logger.debug(Arrays.toString(d));
+            List<String> cells = new LinkedList<String>();
+            for (int i = 0; i < d.length; i++) {
+                if (!Double.isNaN(d[i])) {
+                    NumberFormat nf = Formatter.getFormatter(context, 1, 3);
+                    cells.add(nf.format(d[i]));
+                }
+                else {
+                    cells.add("");
+                }
+            }
+            writer.writeNext(cells.toArray(new String[cells.size()]));
+        }
+    }
+
+    @Override
+    protected void writePDF(OutputStream out) {
+        // TODO Auto-generated method stub
+
+    }
+
+    @Override
+    protected void addData(Object data) {
+        // TODO Auto-generated method stub
+        logger.debug("addData()");
+        if (!(data instanceof CalculationResult)) {
+            logger.warn("Invalid data type.");
+            return;
+        }
+        Object[] d = (Object[])((CalculationResult)data).getData();
+
+        if (!(d instanceof BedQualityResult[])) {
+            logger.warn("Invalid result object.");
+            return;
+        }
+        results = (BedQualityResult[])d;
+    }
+
+    protected void writeCSVHeader(CSVWriter writer) {
+        logger.debug("writeCSVHeader()");
+
+        List<String> header = new LinkedList<String>();
+        if (results != null)  {
+            header.add(msg(CSV_HEADER_KM, "km"));
+            for (int i = 0; i < results.length; i++) {
+                DateFormat df = Formatter.getDateFormatter(context.getMeta(), "dd.MM.yyyy");
+                String d1 = df.format(results[i].getDateRange().getFrom());
+                String d2 = df.format(results[i].getDateRange().getTo());
+                BedloadDiameterResult[] loads = results[i].getBedloadResults();
+                BedDiameterResult[] beds = results[i].getBedResults();
+                BedParametersResult[] params = results[i].getParameters();
+                for (int j = 0; j < loads.length; j++) {
+                    header.add(msg(CSV_HEADER_BEDLOAD, CSV_HEADER_BEDLOAD) +
+                        " - " +
+                        msg(loads[j].getType().toString(),
+                            loads[j].getType().toString()) + " - " +
+                        d1 + "-" + d2);
+                }
+                for (int j = 0; j < beds.length; j++) {
+                    header.add(msg(CSV_HEADER_BED_CAP, CSV_HEADER_BED_CAP) + " - " +
+                        msg(beds[j].getType().toString(),
+                            beds[j].getType().toString()) + " - " +
+                        d1 + "-" + d2);
+                    header.add(msg(CSV_HEADER_BED_SUB, CSV_HEADER_BED_SUB) + " - " +
+                        msg(beds[j].getType().toString(),
+                            beds[j].getType().toString()) + " - " +
+                        d1 + "-" + d2);
+                }
+                if (params.length > 0) {
+                    header.add(
+                        msg(CSV_HEADER_DENSITY_CAP, CSV_HEADER_DENSITY_CAP) +
+                        " - " + d1 + "-" + d2);
+                    header.add(
+                        msg(CSV_HEADER_DENSITY_SUB, CSV_HEADER_DENSITY_SUB) +
+                        " - " + d1 + "-" + d2);
+                    header.add(
+                        msg(CSV_HEADER_POROSITY_CAP, CSV_HEADER_POROSITY_CAP) +
+                        " - " + d1 + "-" + d2);
+                    header.add(
+                        msg(CSV_HEADER_POROSITY_SUB, CSV_HEADER_POROSITY_SUB) +
+                        " - " + d1 + "-" + d2);
+                }
+            }
+        }
+        writer.writeNext(header.toArray(new String[header.size()]));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,273 @@
+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.BedDiameterResult;
+import de.intevation.flys.artifacts.model.minfo.BedParametersResult;
+import de.intevation.flys.artifacts.model.minfo.BedloadDiameterResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
+import de.intevation.flys.exports.XYChartGenerator;
+import de.intevation.flys.jfree.StyledXYSeries;
+
+
+/**
+ * An OutGenerator that generates bed quality charts.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedQualityGenerator extends XYChartGenerator implements FacetTypes {
+
+    public enum YAXIS {
+        W(0), P(1), D(2);
+
+        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.bedquality.title";
+    public static final String I18N_XAXIS_LABEL = "chart.bedquality.xaxis.label";
+    public static final String I18N_YAXIS_LABEL = "chart.bedquality.yaxis.label";
+    public static final String I18N_SECOND_YAXIS_LABEL = "chart.bedquality.yaxis.label.porosity";
+    public static final String I18N_THIRD_YAXIS_LABEL = "chart.bedquality.yaxis.label.diameter";
+
+    public static final String I18N_CHART_TITLE_DEFAULT = "Sohlen Längsschnitt";
+    public static final String I18N_XAXIS_LABEL_DEFAULT = "Fluss-Km";
+    public static final String I18N_YAXIS_LABEL_DEFAULT = "Durchmesser [m]";
+    public static final String I18N_SECOND_YAXIS_LABEL_DEFAULT = "Porosität [%]";
+    public static final String I18N_THIRD_YAXIS_LABEL_DEFAULT = "Dichte [t/m^3]";
+
+    @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();
+            }
+        };
+    }
+
+    /**
+     * Returns the default title for this chart.
+     *
+     * @return the default title for this chart.
+     */
+    @Override
+    public String getDefaultChartTitle() {
+        return msg(I18N_CHART_TITLE, I18N_CHART_TITLE_DEFAULT);
+    }
+
+    /**
+     * Get internationalized label for the x axis.
+     */
+    @Override
+    protected String getDefaultXAxisLabel() {
+        return msg(I18N_XAXIS_LABEL, I18N_XAXIS_LABEL_DEFAULT);
+    }
+
+    @Override
+    protected String getDefaultYAxisLabel(int index) {
+        String label = "default";
+
+        if (index == YAXIS.W.idx) {
+            label = getWAxisLabel();
+        }
+        else if (index == YAXIS.P.idx) {
+            label = getPAxisLabel();
+        }
+        else if (index == YAXIS.D.idx) {
+            label = getDAxisLabel();
+        }
+
+        return label;
+    }
+
+    /**
+     * Get internationalized label for the y axis displaying the diameter.
+     */
+    protected String getWAxisLabel() {
+        return msg(I18N_YAXIS_LABEL, I18N_YAXIS_LABEL_DEFAULT);
+    }
+
+    /**
+     * Get internationalized label for the y axis displaying the porosity.
+     */
+    protected String getPAxisLabel() {
+        return msg(I18N_SECOND_YAXIS_LABEL, I18N_SECOND_YAXIS_LABEL_DEFAULT);
+    }
+
+    /**
+     * Get internationalized label for the y axis displaying the density.
+     */
+    protected String getDAxisLabel() {
+        return msg(I18N_THIRD_YAXIS_LABEL, I18N_THIRD_YAXIS_LABEL_DEFAULT);
+    }
+
+    /**
+     * Produce output.
+     *
+     * @param artifactAndFacet
+     *            current facet.
+     * @param attr
+     *            theme for facet
+     */
+    public void doOut(ArtifactAndFacet artifactAndFacet, Document attr,
+        boolean visible) {
+        String name = artifactAndFacet.getFacetName();
+
+        logger.debug("BedQualityGenerator.doOut: " + name);
+
+        if (name == null) {
+            logger.error("No facet name for doOut(). No output generated!");
+            return;
+        }
+
+        Facet facet = artifactAndFacet.getFacet();
+
+        if (facet == null) {
+            return;
+        }
+
+        // TODO BED_QUALITY_BED_DIAMETER_TOPLAYER
+        if (name.equals(BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
+            doBedDiameterTopLayerOut(
+                (BedDiameterResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
+            doBedDiameterSubLayerOut(
+                (BedDiameterResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        // TODO BED_QUALITY_BED_DIAMETER_SUBLAYER
+        else if (name.equals(BED_QUALITY_BEDLOAD_DIAMETER)) {
+            doBedLoadDiameterOut(
+                (BedloadDiameterResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_POROSITY_TOPLAYER)) {
+            doPorosityTopLayerOut(
+                (BedParametersResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_POROSITY_SUBLAYER)) {
+            doPorositySubLayerOut(
+                (BedParametersResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) {
+            doDensityTopLayerOut(
+                (BedParametersResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER)) {
+            doDensitySubLayerOut(
+                (BedParametersResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (FacetTypes.IS.MANUALPOINTS(name)) {
+            doPoints(artifactAndFacet.getData(context), artifactAndFacet, attr,
+                visible, YAXIS.W.idx);
+        }
+        else {
+            logger.warn("Unknown facet name: " + name);
+            return;
+        }
+    }
+
+    protected void doBedDiameterTopLayerOut(BedDiameterResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doBedDiameterTopLayerOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterCapData(), true);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+    protected void doBedDiameterSubLayerOut(BedDiameterResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doBedDiameterSubLayerOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterSubData(), true);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+    protected void doBedLoadDiameterOut(BedloadDiameterResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doBedLoadDiameterOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterData(), true);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+    protected void doPorosityTopLayerOut(BedParametersResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doPorosityTopLayerOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getPorosityCapData(),
+            true);
+
+        addAxisSeries(series, YAXIS.P.idx, visible);
+    }
+
+    protected void doPorositySubLayerOut(BedParametersResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doPorositySubLayerOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getPorositySubData(),
+            true);
+
+        addAxisSeries(series, YAXIS.P.idx, visible);
+    }
+
+    protected void doDensityTopLayerOut(BedParametersResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doDensityOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getDensityCapData(),
+            true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    protected void doDensitySubLayerOut(BedParametersResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doDensityOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getDensitySubData(),
+            true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+}
+// 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/exports/minfo/BedQualityInfoGenerator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,18 @@
+package de.intevation.flys.exports.minfo;
+
+import de.intevation.flys.exports.ChartInfoGenerator;
+
+
+/**
+ * A ChartInfoGenerator that generates meta information for specific computed
+ * bed quality curves.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class BedQualityInfoGenerator extends ChartInfoGenerator {
+
+    public BedQualityInfoGenerator() {
+        super(new BedQualityGenerator());
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/JFreeUtil.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/JFreeUtil.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,19 +1,20 @@
 package de.intevation.flys.jfree;
 
+import java.awt.Shape;
+import java.awt.geom.Rectangle2D;
+import java.util.Iterator;
+import java.util.Random;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.entity.ChartEntity;
+import org.jfree.chart.entity.EntityCollection;
+import org.w3c.dom.Document;
+
 import de.intevation.flys.artifacts.math.Function;
 
-import java.awt.Shape;
-
-import java.awt.geom.Rectangle2D;
-
-import java.util.Iterator;
+public class JFreeUtil {
 
-import org.jfree.chart.entity.ChartEntity;
-import org.jfree.chart.entity.EntityCollection;
-
-import org.w3c.dom.Document;
-
-public class JFreeUtil {
+    private static final Logger logger = Logger.getLogger(JFreeUtil.class);
 
     /** Do not instantiate. */
     private JFreeUtil() {
@@ -52,6 +53,50 @@
     }
 
 
+    /**
+     * This function samples a randomized line that contains of x and y values
+     * between <i>startX</i>, <i>endX</i>, <i>startY</i> and <i>endY</i>. The
+     * number of points in the line is specified by <i>num</i>.
+     *
+     * @param num The number of points in the line.
+     * @param startX The min value of the x values.
+     * @param endX The max value of the x values.
+     * @param startY The min value of the y values.
+     * @param endY The max value of the y values.
+     * @return an array with [allX-values, allY-values].
+     * @throws IllegalArgumentException
+     */
+    public static double[][] randomizeLine(
+        int    num,
+        double startX,
+        double endX,
+        double startY,
+        double endY
+    ) throws IllegalArgumentException
+    {
+        if (num <= 0) {
+            throw new IllegalArgumentException("Parameter 'num' has to be > 0");
+        }
+
+        Random random = new Random();
+
+        double[] x = new double[num];
+        double[] y = new double[num];
+
+        for (int i = 0; i < num; i++) {
+            double xFac = random.nextDouble();
+            double yFac = random.nextDouble();
+
+            x[i] = startX + xFac * (endX - startX);
+            y[i] = startY + yFac * (endY - startY);
+
+            logger.debug("Created new point: " + x[i] + "|" + y[i]);
+        }
+
+        return new double[][] { x, y };
+    }
+
+
     public static StyledXYSeries sampleFunction2D(
         Function func,
         Document theme,
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StableXYDifferenceRenderer.java	Fri Sep 28 12:15:44 2012 +0200
@@ -123,6 +123,8 @@
 
 import de.intevation.flys.artifacts.math.Linear;
 
+import java.text.NumberFormat;
+
 import org.apache.log4j.Logger;
 
 /**
@@ -179,6 +181,12 @@
     /** Font to draw label of calculated area with. */
     protected Font labelFont;
 
+    /** Template to create i18ned label for area. */
+    protected String areaLabelTamplate;
+
+    /** NumberFormat to use for area. */
+    protected NumberFormat areaLabelNumberFormat;
+
     protected int areaCalculationMode;
 
     protected double positiveArea;
@@ -260,6 +268,18 @@
         this.areaCalculationMode = areaCalculationMode;
     }
 
+
+    /** Set template to use to create area label (e.g. 'Area=%dm2'). */
+    public void setAreaLabelTemplate(String areaTemplate) {
+        this.areaLabelTamplate = areaTemplate;
+    }
+
+
+    public void setAreaLabelNumberFormat(NumberFormat nf) {
+        this.areaLabelNumberFormat = nf;
+    }
+
+
     public boolean isLabelArea() {
         return this.labelArea;
     }
@@ -826,7 +846,7 @@
 
         switch (dataset.getSeriesCount()) {
             case 0:
-                return Collections.emptyList();
+                return Collections.<XYDataset>emptyList();
             case 1:
                 return splitByNaNsOneSeries(dataset);
             default: // two or more
@@ -880,8 +900,7 @@
         }
 
         // Find geometric middle, calculate area and paint a string with it here.
-        // TODO also i18n
-        if (pass == 1 && this.labelArea) {
+        if (pass == 1 && this.labelArea && areaLabelNumberFormat != null && areaLabelTamplate != null) {
             double center_x = centroid.getX();
             double center_y = centroid.getY();
             center_x = domainAxis.valueToJava2D(center_x, dataArea,
@@ -904,7 +923,8 @@
                 Color oldColor = g2.getColor();
                 Font oldFont = g2.getFont();
                 g2.setFont(labelFont);
-                String labelText = "Area= " + area + "m2";
+                String labelText = String.format(this.areaLabelTamplate,
+                    areaLabelNumberFormat.format(area));
                 if (labelBGColor != null) {
                     EnhancedLineAndShapeRenderer.drawTextBox(g2, labelText,
                         (float)center_x, (float)center_y, labelBGColor);
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledAreaSeriesCollection.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/StyledDomainMarker.java	Fri Sep 28 12:15:44 2012 +0200
@@ -9,11 +9,12 @@
 
 /**
  * Marker that represents a highlighted interval.
+ *
  * @author <a href="mailto:christian.lins@intevation.de">Christian Lins</a>
  */
 public class StyledDomainMarker extends IntervalMarker {
 
-    private static final long serialVersionUID = -4369410661339512342L;
+    private static final long serialVersionUID = -4369417661339512342L;
 
     private final Color fillColor, backgroundColor;
 
@@ -26,8 +27,9 @@
                 ThemeUtil.getFillColorString(theme));
         useSecondColor(false);
 
-        int alpha = ThemeUtil.parseInteger(ThemeUtil.getTransparencyAlpha(theme), 128);
-        setAlpha(alpha / 255.0f);
+        int alpha = 100 - ThemeUtil.parseInteger(
+                ThemeUtil.getTransparencyString(theme), 50);
+        setAlpha(alpha / 100.0f);
     }
 
     /**
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/DefaultTheme.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/DefaultTheme.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,6 @@
 package de.intevation.flys.themes;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.w3c.dom.Document;
@@ -154,17 +153,14 @@
      * @param theme The document root element.
      */
     protected void appendAttributes(ElementCreator cr, Element theme) {
-        Iterator<String> iter = attr.keySet().iterator();
 
-        while (iter.hasNext()) {
-            String key = iter.next();
-            String val = getAttribute(key);
+        for (Map.Entry<String, String> entry: attr.entrySet()) {
+            String key = entry.getKey();
+            String val = entry.getValue();
 
-            if (key == null || val == null) {
-                continue;
+            if (key != null && val != null) {
+                cr.addAttr(theme, key, val);
             }
-
-            cr.addAttr(theme, key, val);
         }
     }
 
@@ -176,12 +172,10 @@
      * @param theme The document root element.
      */
     protected void appendFields(ElementCreator cr, Element theme) {
-        Iterator<String> iter = fields.keySet().iterator();
 
-        while (iter.hasNext()) {
-            String name = iter.next();
-
-            ThemeField field = getField(name);
+        for (Map.Entry<String, ThemeField> entry: fields.entrySet()) {
+            String     name  = entry.getKey();
+            ThemeField field = entry.getValue();
 
             Document doc = field.toXML();
             Node    root = doc.getFirstChild();
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/DefaultThemeField.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/DefaultThemeField.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,7 +1,6 @@
 package de.intevation.flys.themes;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.w3c.dom.Document;
@@ -68,13 +67,8 @@
 
         Element field = cr.create("field");
 
-        Iterator<String> iter = attr.keySet().iterator();
-
-        while (iter.hasNext()) {
-            String name  = iter.next();
-            String value = (String) getAttribute(name);
-
-            cr.addAttr(field, name, value);
+        for (Map.Entry<String, Object> entry: attr.entrySet()) {
+            cr.addAttr(field, entry.getKey(), (String)entry.getValue());
         }
 
         doc.appendChild(field);
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -102,6 +102,7 @@
         }
 
         if (group == null) {
+            logger.warn("No theme group found: '" + groupName + "'");
             return null;
         }
 
@@ -128,7 +129,10 @@
                 && tm.masterAttrMatches(artifact)
                 && tm.outputMatches(output))
             {
-                return t.get(tm.getTo());
+                String target = tm.getTo();
+
+                logger.debug("Found theme '" + target + "'");
+                return t.get(target);
             }
         }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/themes/ThemeMapping.java	Fri Sep 28 12:15:44 2012 +0200
@@ -88,7 +88,16 @@
             return true;
         }
         Matcher m = pattern.matcher(text);
-        return m.matches();
+
+       if (m.matches()) {
+           logger.debug("Pattern matches: " + text);
+           return true;
+       }
+       else {
+           logger.debug(
+               "Pattern '"+ text + "' does not match: " + this.patternStr);
+           return false;
+       }
     }
 
 
@@ -116,7 +125,14 @@
         }
 
         // Test.
-        return artifact.getDataAsString(parts[0]).equals(parts[1]);
+        if (artifact.getDataAsString(parts[0]).equals(parts[1])) {
+            logger.debug("Matches master Attribute.");
+            return true;
+        }
+        else {
+            logger.debug("Does not match master Attribute.");
+            return false;
+        }
     }
 
 
@@ -129,7 +145,14 @@
             return true;
         }
 
-        return this.output.equals(output);
+        if (this.output.equals(output)) {
+            logger.debug("Output matches this mapping: " + output);
+            return true;
+        }
+        else {
+            logger.debug("Output '"+ output +"' does not match: "+ this.output);
+            return false;
+        }
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/DoubleUtil.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,12 +1,17 @@
 package de.intevation.flys.utils;
 
+import de.intevation.flys.artifacts.math.Linear;
+
+import gnu.trove.TDoubleArrayList;
+
 import java.util.Arrays;
 
-import de.intevation.flys.artifacts.math.Linear;
-
+import org.apache.log4j.Logger;
 
 public class DoubleUtil
 {
+    private static Logger log = Logger.getLogger(DoubleUtil.class);
+
     public static final double DEFAULT_STEP_PRECISION = 1e6;
 
     private DoubleUtil() {
@@ -138,5 +143,50 @@
         Arrays.fill(result, value);
         return result;
     }
+
+    public interface SegmentCallback {
+        void newSegment(double from, double to, double [] values);
+    }
+
+    public static final void parseSegments(
+        String          input,
+        SegmentCallback callback
+    ) {
+        TDoubleArrayList vs = new TDoubleArrayList();
+
+        for (String segmentStr: input.split(":")) {
+            String [] parts = segmentStr.split(";");
+            if (parts.length < 3) {
+                log.warn("invalid segment: '" + segmentStr + "'");
+                continue;
+            }
+            try {
+                double from = Double.parseDouble(parts[0].trim());
+                double to   = Double.parseDouble(parts[1].trim());
+
+                vs.resetQuick();
+
+                for (String valueStr: parts[2].split(",")) {
+                    vs.add(round(Double.parseDouble(valueStr.trim())));
+                }
+
+                callback.newSegment(from, to, vs.toNativeArray());
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("invalid segment: '" + segmentStr + "'");
+            }
+        }
+    }
+
+    public static final boolean isValid(double [][] data) {
+        for (double [] ds: data) {
+            for (double d: ds) {
+                if (Double.isNaN(d)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/Formatter.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,15 +1,13 @@
 package de.intevation.flys.utils;
 
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.CallMeta;
-
-import de.intevation.flys.artifacts.resources.Resources;
-
 import java.text.DateFormat;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
+import java.util.Locale;
 
-import java.util.Locale;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.flys.artifacts.resources.Resources;
 
 
 public final class Formatter {
@@ -81,7 +79,7 @@
     public static final int FIX_DELTA_W_DELTA_Q_MAX_DIGITS  = 2;
 
     /**
-     * Creates a localised NumberFormatter with given range of decimal digits.
+     * Creates a localized NumberFormatter with given range of decimal digits.
      * @param m CallMeta to find the locale.
      * @param min minimum number of decimal ("fraction") digits.
      * @param max maximum number of decimal ("fraction") digits.
@@ -141,16 +139,16 @@
      */
     public static NumberFormat getWaterlevelKM(CallContext context) {
         return getFormatter(
-            context,
-            WATERLEVEL_KM_MIN_DIGITS,
-            WATERLEVEL_KM_MAX_DIGITS);
+                context,
+                WATERLEVEL_KM_MIN_DIGITS,
+                WATERLEVEL_KM_MAX_DIGITS);
     }
 
     public static NumberFormat getWaterlevelW(CallMeta meta) {
         return getFormatter(
-            meta,
-            WATERLEVEL_W_MIN_DIGITS,
-            WATERLEVEL_W_MAX_DIGITS);
+                meta,
+                WATERLEVEL_W_MIN_DIGITS,
+                WATERLEVEL_W_MAX_DIGITS);
     }
 
     /**
@@ -160,9 +158,9 @@
      */
     public static NumberFormat getWaterlevelW(CallContext context) {
         return getFormatter(
-            context,
-            WATERLEVEL_W_MIN_DIGITS,
-            WATERLEVEL_W_MAX_DIGITS);
+                context,
+                WATERLEVEL_W_MIN_DIGITS,
+                WATERLEVEL_W_MAX_DIGITS);
     }
 
 
@@ -173,16 +171,16 @@
      */
     public static NumberFormat getWaterlevelQ(CallContext context) {
         return getFormatter(
-            context,
-            WATERLEVEL_Q_MIN_DIGITS,
-            WATERLEVEL_Q_MAX_DIGITS);
+                context,
+                WATERLEVEL_Q_MIN_DIGITS,
+                WATERLEVEL_Q_MAX_DIGITS);
     }
 
     public static NumberFormat getWaterlevelQ(CallMeta meta) {
         return getFormatter(
-            meta,
-            WATERLEVEL_Q_MIN_DIGITS,
-            WATERLEVEL_Q_MAX_DIGITS);
+                meta,
+                WATERLEVEL_Q_MIN_DIGITS,
+                WATERLEVEL_Q_MAX_DIGITS);
     }
 
     /**
@@ -193,9 +191,9 @@
      */
     public static NumberFormat getComputedDischargeW(CallContext context) {
         return getFormatter(
-            context,
-            COMPUTED_DISCHARGE_W_MIN_DIGITS,
-            COMPUTED_DISCHARGE_W_MAX_DIGITS);
+                context,
+                COMPUTED_DISCHARGE_W_MIN_DIGITS,
+                COMPUTED_DISCHARGE_W_MAX_DIGITS);
     }
 
 
@@ -207,9 +205,9 @@
      */
     public static NumberFormat getComputedDischargeQ(CallContext context) {
         return getFormatter(
-            context,
-            COMPUTED_DISCHARGE_Q_MIN_DIGITS,
-            COMPUTED_DISCHARGE_Q_MAX_DIGITS);
+                context,
+                COMPUTED_DISCHARGE_Q_MIN_DIGITS,
+                COMPUTED_DISCHARGE_Q_MAX_DIGITS);
     }
 
 
@@ -221,9 +219,9 @@
      */
     public static NumberFormat getHistoricalDischargeW(CallContext context) {
         return getFormatter(
-            context,
-            HISTORICAL_DISCHARGE_W_MIN_DIGITS,
-            HISTORICAL_DISCHARGE_W_MAX_DIGITS);
+                context,
+                HISTORICAL_DISCHARGE_W_MIN_DIGITS,
+                HISTORICAL_DISCHARGE_W_MAX_DIGITS);
     }
 
 
@@ -235,9 +233,9 @@
      */
     public static NumberFormat getHistoricalDischargeQ(CallContext context) {
         return getFormatter(
-            context,
-            HISTORICAL_DISCHARGE_Q_MIN_DIGITS,
-            HISTORICAL_DISCHARGE_Q_MAX_DIGITS);
+                context,
+                HISTORICAL_DISCHARGE_Q_MIN_DIGITS,
+                HISTORICAL_DISCHARGE_Q_MAX_DIGITS);
     }
 
 
@@ -248,9 +246,9 @@
      */
     public static NumberFormat getDurationW(CallContext context) {
         return getFormatter(
-            context,
-            DURATION_W_MIN_DIGITS,
-            DURATION_W_MAX_DIGITS);
+                context,
+                DURATION_W_MIN_DIGITS,
+                DURATION_W_MAX_DIGITS);
     }
 
 
@@ -261,9 +259,9 @@
      */
     public static NumberFormat getDurationQ(CallContext context) {
         return getFormatter(
-            context,
-            DURATION_Q_MIN_DIGITS,
-            DURATION_Q_MAX_DIGITS);
+                context,
+                DURATION_Q_MIN_DIGITS,
+                DURATION_Q_MAX_DIGITS);
     }
 
 
@@ -274,123 +272,123 @@
      */
     public static NumberFormat getDurationD(CallContext context) {
         return getFormatter(
-            context,
-            DURATION_D_MIN_DIGITS,
-            DURATION_D_MAX_DIGITS);
+                context,
+                DURATION_D_MIN_DIGITS,
+                DURATION_D_MAX_DIGITS);
     }
 
     public static NumberFormat getCalculationKm(CallMeta meta) {
         return getFormatter(
-            meta,
-            CALCULATION_REPORT_KM_MIN_DIGITS,
-            CALCULATION_REPORT_KM_MAX_DIGITS);
+                meta,
+                CALCULATION_REPORT_KM_MIN_DIGITS,
+                CALCULATION_REPORT_KM_MAX_DIGITS);
     }
 
 
     public static NumberFormat getFlowVelocityKM(CallContext context) {
         return getFormatter(
-            context,
-            FLOW_VELOCITY_KM_MIN_DIGITS,
-            FLOW_VELOCITY_KM_MAX_DIGITS);
+                context,
+                FLOW_VELOCITY_KM_MIN_DIGITS,
+                FLOW_VELOCITY_KM_MAX_DIGITS);
     }
 
 
     public static NumberFormat getFlowVelocityValues(CallContext context) {
         return getFormatter(
-            context,
-            FLOW_VELOCITY_VALUES_MIN_DIGITS,
-            FLOW_VELOCITY_VALUES_MAX_DIGITS);
+                context,
+                FLOW_VELOCITY_VALUES_MIN_DIGITS,
+                FLOW_VELOCITY_VALUES_MAX_DIGITS);
     }
 
 
     public static NumberFormat getFlowVelocityQ(CallContext context) {
         return getFormatter(
-            context,
-            FLOW_VELOCITY_Q_MIN_DIGITS,
-            FLOW_VELOCITY_Q_MAX_DIGITS);
+                context,
+                FLOW_VELOCITY_Q_MIN_DIGITS,
+                FLOW_VELOCITY_Q_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightKM(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_KM_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_KM_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_KM_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_KM_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightHeight(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_HEIGHT_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_HEIGHT_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightUncert(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_UNCERT_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_UNCERT_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightDataGap(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_DATAGAP_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_DATAGAP_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightSounding(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_SOUNDING_WIDTH_MAX_DIGITS);
     }
 
 
     public static NumberFormat getMiddleBedHeightWidth(CallContext context) {
         return getFormatter(
-            context,
-            MIDDLE_BED_HEIGHT_WIDTH_MIN_DIGITS,
-            MIDDLE_BED_HEIGHT_WIDTH_MAX_DIGITS);
+                context,
+                MIDDLE_BED_HEIGHT_WIDTH_MIN_DIGITS,
+                MIDDLE_BED_HEIGHT_WIDTH_MAX_DIGITS);
     }
 
     public static NumberFormat getFixDeltaWKM(CallContext context) {
         return getFormatter(
-            context,
-            FIX_DELTA_W_KM_MIN_DIGITS,
-            FIX_DELTA_W_KM_MAX_DIGITS);
+                context,
+                FIX_DELTA_W_KM_MIN_DIGITS,
+                FIX_DELTA_W_KM_MAX_DIGITS);
     }
 
     public static NumberFormat getFixDeltaWDeltaW(CallContext context) {
         return getFormatter(
-            context,
-            FIX_DELTA_W_DELTA_W_MIN_DIGITS,
-            FIX_DELTA_W_DELTA_W_MAX_DIGITS);
+                context,
+                FIX_DELTA_W_DELTA_W_MIN_DIGITS,
+                FIX_DELTA_W_DELTA_W_MAX_DIGITS);
     }
 
     public static NumberFormat getFixDeltaWQ(CallContext context) {
         return getFormatter(
-            context,
-            FIX_DELTA_W_DELTA_Q_MIN_DIGITS,
-            FIX_DELTA_W_DELTA_Q_MAX_DIGITS);
+                context,
+                FIX_DELTA_W_DELTA_Q_MIN_DIGITS,
+                FIX_DELTA_W_DELTA_Q_MAX_DIGITS);
     }
 
     public static NumberFormat getFixDeltaWW(CallContext context) {
         return getFormatter(
-            context,
-            FIX_DELTA_W_DELTA_W_MIN_DIGITS,
-            FIX_DELTA_W_DELTA_W_MAX_DIGITS);
+                context,
+                FIX_DELTA_W_DELTA_W_MIN_DIGITS,
+                FIX_DELTA_W_DELTA_W_MAX_DIGITS);
     }
 
     public static NumberFormat getMeterFormat(CallContext context) {
         return getFormatter(
-            context,
-            0,
-            2);
+                context,
+                0,
+                2);
 
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/utils/ThemeUtil.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,12 +1,5 @@
 package de.intevation.flys.utils;
 
-import de.intevation.artifacts.common.utils.XMLUtils;
-import de.intevation.flys.artifacts.model.MapserverStyle;
-import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
-import de.intevation.flys.artifacts.model.MapserverStyle.Expression;
-import de.intevation.flys.artifacts.model.MapserverStyle.Label;
-import de.intevation.flys.artifacts.model.MapserverStyle.Style;
-
 import java.awt.Color;
 import java.awt.Font;
 
@@ -17,6 +10,13 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.flys.artifacts.model.MapserverStyle;
+import de.intevation.flys.artifacts.model.MapserverStyle.Clazz;
+import de.intevation.flys.artifacts.model.MapserverStyle.Expression;
+import de.intevation.flys.artifacts.model.MapserverStyle.Label;
+import de.intevation.flys.artifacts.model.MapserverStyle.Style;
+
 
 /**
  * Utility to deal with themes and their representations.
@@ -73,10 +73,7 @@
             "/theme/field[@name='showlevel']/@default";
 
     public final static String XPATH_TRANSPARENCY =
-            "/theme/field[@name='transparent']/@default";
-
-    public final static String XPATH_TRANSPARENCY_ALPHA =
-            "/theme/field[@name='alpha']/@default";
+            "/theme/field[@name='transparency']/@default";
 
     public final static String XPATH_SHOW_AREA =
             "/theme/field[@name='showarea']/@default";
@@ -556,11 +553,6 @@
     }
 
 
-    public static String getTransparencyAlpha(Document theme) {
-        return XMLUtils.xpathString(theme, XPATH_TRANSPARENCY_ALPHA, 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:44 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/wsplgen/FacetCreator.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages.properties	Fri Sep 28 12:15:44 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
@@ -50,9 +50,11 @@
 state.minfo.bed.location = Location/Distance
 state.minfo.bed.periods = Periods
 state.minfo.bed.char_diameter = Characteristic Diameter
+state.minfo.soundings = Choose Soundings
 
 year=Year
 epoch=Epoch
+soundings = Soundings / Epochs
 
 historical.mode.w = Waterlevel Analyse
 historical.mode.q = Discharge Analyse
@@ -118,8 +120,8 @@
 river = River
 calculation_mode = Calculation Mode
 ld_locations = Location(s)
-main.channel = Main channel
-total.channel = Total channel
+main_channel = Main channel
+total_channel = Total channel
 
 chart.longitudinal.section.title = W-Longitudinal Section
 chart.longitudinal.section.subtitle = Range: {0}-km {1,number,#.###} - {2,number,#.###}
@@ -176,6 +178,19 @@
 chart.fixings.wq.subtitle1={0,date,short} to {1,date,short}
 chart.fixings.analysis.title = Longitudinal section at km {0}
 
+chart.bedquality.title=Bed Longitudinal Section
+chart.bedquality.xaxis.label=River-Km
+chart.bedquality.yaxis.label=Diameter [m]
+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
@@ -198,6 +213,35 @@
 facet.flow_velocity.tauchannel = TAU Mainchannel at {0}
 facet.bedheight_middle.single = Bed Height {0,number,####}
 facet.bedheight_middle.epoch = Bed Height Epoch {0,number,####} - {1,number,####}
+facet.bedquality.bed.porosity.toplayer = Porosity ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.porosity.sublayer = Porosity ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.toplayer = Density ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.sublayer = Density ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.diameter.toplayer = {0}_Bed ({1,date} - {2,date}) ({3})
+facet.bedquality.bed.diameter.sublayer = {0}_Bed ({1,date} - {2,date}) ({3})
+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]
@@ -277,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
@@ -445,3 +497,6 @@
 
 load_diameter = Bedload Diameter
 bed_diameter = Bed Diameter
+
+area.label.template = Area = %s m\u00b3
+
--- a/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_de.properties	Fri Sep 28 12:15:44 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
@@ -50,9 +50,11 @@
 state.minfo.bed.location = Ort(e)/Strecke
 state.minfo.bed.periods = Zeitraum/Zeitr\u00e4ume
 state.minfo.bed.char_diameter = Charakteristischer Durchmesser
+state.minfo.soundings = Wahl der Peilungen
 
 year=Jahr
 epoch=Epoche
+soundings = Peilungen / Epochen
 
 historical.mode.w = Wasserstandsanalyse
 historical.mode.q = Abflussanalyse
@@ -118,8 +120,8 @@
 river = Fluss
 calculation_mode = Berechnungsart
 ld_locations = Ort(e)
-main.channel = Hauptgerinne
-total.channel = Gesamtgerinne
+main_channel = Hauptgerinne
+total_channel = Gesamtgerinne
 
 chart.cross_section.title = Querprofildiagramm f\u00fcr Gew\u00e4sser {0}
 chart.cross_section.subtitle = {0}-km: {1,number,#.###}
@@ -176,6 +178,19 @@
 chart.w_differences.yaxis.label = m
 chart.w_differences.yaxis.second.label = W [NN + m]
 
+chart.bedquality.title=Sohlen L\u00e4ngsschnitt
+chart.bedquality.xaxis.label=Fluss-Km
+chart.bedquality.yaxis.label=Durchmesser [m]
+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
@@ -198,6 +213,34 @@
 facet.flow_velocity.tauchannel = TAU Hauptgerinne bei {0}
 facet.bedheight_middle.single = Sohlh\u00f6he {0,number,####}
 facet.bedheight_middle.epoch = Sohlh\u00f6he Epoche {0,number,####} - {1,number,####}
+facet.bedquality.bed.porosity.toplayer = Porosit\u00e4t ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.porosity.sublayer = Porosit\u00e4t ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.toplayer = Dichte ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.sublayer = Dichte ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.diameter.toplayer = {0}_Sohle ({1,date} - {2,date}) ({3})
+facet.bedquality.bed.diameter.sublayer = {0}_Sohle ({1,date} - {2,date}) ({3})
+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]
@@ -278,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
@@ -448,3 +499,6 @@
 
 load_diameter = Geschiebedurchmesser
 bed_diameter = Sohldurchmesser
+
+area.label.template = Fl\u00e4che = %s m\u00b3
+
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_de_DE.properties	Fri Sep 28 12:15:44 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
@@ -50,9 +50,11 @@
 state.minfo.bed.location = Ort(e)/Strecke
 state.minfo.bed.periods = Zeitraum/Zeitr\u00e4ume
 state.minfo.bed.char_diameter = Charakteristischer Durchmesser
+state.minfo.soundings = Wahl der Peilungen
 
 year=Jahr
 epoch=Epoche
+soundings = Peilungen / Epochen
 
 historical.mode.w = Wasserstandsanalyse
 historical.mode.q = Abflussanalyse
@@ -118,8 +120,8 @@
 river = Fluss
 calculation_mode = Berechnungsart
 ld_locations = Ort(e)
-main.channel = Hauptgerinne
-total.channel = Gesamtgerinne
+main_channel = Hauptgerinne
+total_channel = Gesamtgerinne
 
 chart.cross_section.title = Querprofildiagramm f\u00fcr Gew\u00e4sser {0}
 chart.cross_section.subtitle = {0}-km: {1,number,#.###}
@@ -174,6 +176,19 @@
 chart.w_differences.yaxis.label = m
 chart.w_differences.yaxis.second.label = W [NN + m]
 
+chart.bedquality.title=Sohlen L\u00e4ngsschnitt
+chart.bedquality.xaxis.label=Fluss-Km
+chart.bedquality.yaxis.label=Durchmesser [m]
+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
@@ -196,6 +211,34 @@
 facet.flow_velocity.tauchannel = TAU Hauptgerinne bei {0}
 facet.bedheight_middle.single = Sohlh\u00f6he {0,number,####}
 facet.bedheight_middle.epoch = Sohlh\u00f6he Epoche {0,number,####} - {1,number,####}
+facet.bedquality.bed.porosity.toplayer = Porosit\u00e4t ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.porosity.sublayer = Porosit\u00e4t ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.toplayer = Dichte ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.sublayer = Dichte ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.diameter.toplayer = {0}_Sohle ({1,date} - {2,date}) ({3})
+facet.bedquality.bed.diameter.sublayer = {0}_Sohle ({1,date} - {2,date}) ({3})
+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]
@@ -275,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
@@ -448,3 +499,5 @@
 load_diameter = Geschiebedurchmesser
 bed_diameter = Sohldurchmesser
 
+area.label.template = Fl\u00e4che = %s m\u00b3
+
--- a/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-artifacts/src/main/resources/messages_en.properties	Fri Sep 28 12:15:44 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
@@ -50,9 +50,11 @@
 state.minfo.bed.location = Location/Distance
 state.minfo.bed.periods = Periods
 state.minfo.bed.char_diameter = Characteristic Diameter
+state.minfo.soundings = Choose Soundings
 
 year=Year
 epoch=Epoch
+soundings = Soundings / Epochs
 
 historical.mode.w = Waterlevel Analyse
 historical.mode.q = Discharge Analyse
@@ -118,8 +120,8 @@
 river = River
 calculation_mode = Calculation Mode
 ld_locations = Location(s)
-main.channel = Main channel
-total.channel = Total channel
+main_channel = Main channel
+total_channel = Total channel
 
 chart.cross_section.title = Cross Section for river {0}
 chart.cross_section.subtitle = {0}-km: {1,number,#.###}
@@ -178,6 +180,19 @@
 chart.w_differences.yaxis.label = m
 chart.w_differences.yaxis.second.label = W [NN + m]
 
+chart.bedquality.title=Bed Longitudinal Section
+chart.bedquality.xaxis.label=River-Km
+chart.bedquality.yaxis.label=Diameter [m]
+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
@@ -200,6 +215,34 @@
 facet.flow_velocity.tauchannel = TAU Mainchannel at {0}
 facet.bedheight_middle.single = Bed Height {0,number,####}
 facet.bedheight_middle.epoch = Bed Height Epoch {0,number,####} - {1,number,####}
+facet.bedquality.bed.porosity.toplayer = Porosity ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.porosity.sublayer = Porosity ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.toplayer = Density ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.density.sublayer = Density ({0,date} - {1,date}) ({2})
+facet.bedquality.bed.diameter.toplayer = {0}_Bed ({1,date} - {2,date}) ({3})
+facet.bedquality.bed.diameter.sublayer = {0}_Bed ({1,date} - {2,date}) ({3})
+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]
@@ -279,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
@@ -446,3 +497,5 @@
 
 load_diameter = Bedload Diameter
 bed_diameter = Bed Diameter
+
+area.label.template = Area = %s m\u00b3
--- a/flys-backend/ChangeLog	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/ChangeLog	Fri Sep 28 12:15:44 2012 +0200
@@ -1,3 +1,254 @@
+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:
+	  Corrected broken loop to find epochs for river and km range.
+
+	* src/main/java/de/intevation/flys/model/BedHeightSingle.java:
+	  Corrected broken loop to find singles for river and km range.
+
+2012-09-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java:
+	  Made code more robust.
+
+2012-09-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/importer/Config.java:
+	  Add system property 'flys.backend.importer.skip.default'
+	  which enables the switching of the skipping default.
+	  Very useful if you want only some sub systems by
+	  setting this to 'true' and the sub systems to 'false'.
+
+2012-09-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/schema/postgresql.sql: Indices on cross sections
+	  were created too early (before the referenced tables
+	  were created).
+
+2012-09-12	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/River.java:
+	  Add new method determineMinMaxQ to fetch the mimimum and maximum q values
+	  from the database.
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* postgresql-minfo.sql: Added missing tables.
+	* oracle-minfo.sql: Fixed small typos.
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml: Java 1.6 -> 1.6
+
+	* src/main/java/de/intevation/flys/utils/StringUtil.java:
+	  Replaced german comment (with an ill encoded Umlaut).
+
+2012-09-10	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java:
+	  Remove obsolet method (#851).
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java:
+	  We need min/max Q, too.
+
+2012-09-10	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/MinMaxWQ.java,
+	  src/main/java/de/intevation/flys/model/Gauge.java:
+	  Add method fetchMinMaxWQ to Gauge. This mehtod returns a new MinMaxWQ
+	  instance that contains the fetched values for the gauge overview info.
+
+2012-09-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java:
+	  Moved some code over from flys-artifacts.
+
+2012-09-07  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged module as '2.9'.
+
 2012-09-07	Björn Ricks <bjoern.ricks@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/Gauge.java:
--- a/flys-backend/contrib/shpimporter/importer.py	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/contrib/shpimporter/importer.py	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/doc/schema/import-dems.sql	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/doc/schema/oracle-minfo.sql	Fri Sep 28 12:15:44 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)
 );
@@ -245,7 +245,7 @@
     name    VARCHAR(64)    NOT NULL,
     lower   NUMBER(38,3),
     upper   NUMBER(38,3),
-    unit_id NUMBER (38,0),
+    unit_id NUMBER(38,0),
     PRIMARY KEY (id),
     CONSTRAINT fk_gf_unit_id FOREIGN KEY (unit_id) REFERENCES units(id)
 );
@@ -306,7 +306,7 @@
 
 CREATE SEQUENCE WATERLEVEL_VALUES_ID_SEQ;
 
-CREATE TABLE waterlevel_values(
+CREATE TABLE waterlevel_values (
     id                      NUMBER(38,0) NOT NULL,
     waterlevel_q_range_id   NUMBER(38,0) NOT NULL,
     station                 NUMBER(38,3) NOT NULL,
@@ -374,7 +374,7 @@
     fraction       VARCHAR(32)  NOT NULL,
     function       VARCHAR(32)  NOT NULL,
     km             NUMBER(38,3) NOT NULL,
-    a              NUMBER       NOT NULL,
+    a              NUMBER(38, 3) NOT NULL,
     b              NUMBER(38,3) NOT NULL,
     PRIMARY KEY (id),
     CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id)
--- a/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/doc/schema/oracle-spatial.sql	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/doc/schema/oracle.sql	Fri Sep 28 12:15:44 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:44 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:44 2012 +0200
+++ b/flys-backend/doc/schema/postgresql-minfo.sql	Fri Sep 28 12:15:44 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)
 );
@@ -306,7 +306,7 @@
 
 CREATE SEQUENCE WATERLEVEL_VALUES_ID_SEQ;
 
-CREATE TABLE waterlevel_values(
+CREATE TABLE waterlevel_values (
     id                      int NOT NULL,
     waterlevel_q_range_id   int NOT NULL,
     station                 NUMERIC NOT NULL,
@@ -351,4 +351,32 @@
     CONSTRAINT fk_wdv_column_id FOREIGN KEY (column_id) REFERENCES waterlevel_difference_column (id)
 );
 
+
+CREATE SEQUENCE SQ_RELATION_ID_SEQ;
+
+CREATE TABLE sq_relation (
+    id               int NOT NULL,
+    river_id         int NOT NULL,
+    time_interval_id int NOT NULL,
+    description      VARCHAR(256),
+    PRIMARY KEY (id),
+    CONSTRAINT fk_sqr_river_id FOREIGN KEY (river_id) REFERENCES rivers(id),
+    CONSTRAINT fk_sqr_tinterval_id FOREIGN KEY (time_interval_id) REFERENCES time_intervals(id)
+);
+
+
+CREATE SEQUENCE SQ_RELATION_VALUES_ID_SEQ;
+
+CREATE TABLE sq_relation_value (
+    id             int NOT NULL,
+    sq_relation_id int NOT NULL,
+    parameter      VARCHAR(16)  NOT NULL,
+    fraction       VARCHAR(32)  NOT NULL,
+    function       VARCHAR(32)  NOT NULL,
+    km             NUMERIC NOT NULL,
+    a              NUMERIC NOT NULL,
+    b              NUMERIC NOT NULL,
+    PRIMARY KEY (id),
+    CONSTRAINT fk_sqr_id FOREIGN KEY (sq_relation_id) REFERENCES sq_relation(id)
+);
 COMMIT;
--- a/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/doc/schema/postgresql-spatial.sql	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/doc/schema/postgresql.sql	Fri Sep 28 12:15:44 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.
@@ -280,12 +281,6 @@
     description      VARCHAR(256)
 );
 
--- Indices for faster access of the points
-CREATE INDEX cross_section_lines_km_idx
-    ON cross_section_lines(km);
-CREATE INDEX cross_section_points_line_idx
-    ON cross_section_points(cross_section_line_id);
-
 CREATE SEQUENCE CROSS_SECTION_LINES_ID_SEQ;
 
 CREATE TABLE cross_section_lines (
@@ -306,6 +301,12 @@
     UNIQUE (cross_section_line_id, col_pos)
 );
 
+-- Indices for faster access of the points
+CREATE INDEX cross_section_lines_km_idx
+    ON cross_section_lines(km);
+CREATE INDEX cross_section_points_line_idx
+    ON cross_section_points(cross_section_line_id);
+
 -- Hydraulische Kenngroessen
 
 CREATE SEQUENCE HYKS_ID_SEQ;
--- a/flys-backend/pom.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/pom.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -33,8 +33,8 @@
         <artifactId>maven-compiler-plugin</artifactId>
         <version>2.0.2</version>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.6</source>
+          <target>1.6</target>
         </configuration>
       </plugin>
     </plugins>
@@ -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/Config.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/Config.java	Fri Sep 28 12:15:44 2012 +0200
@@ -2,6 +2,9 @@
 
 public class Config
 {
+    public static final String SKIP_DEFAULT =
+        "flys.backend.importer.skip.default";
+
     public static final String DRY_RUN =
         "flys.backend.importer.dry.run";
 
@@ -74,8 +77,15 @@
     private Config () {
     }
 
+    public static final boolean getFlag(String key) {
+        String flag = System.getProperty(key);
+        return flag != null
+            ? Boolean.valueOf(flag)
+            : Boolean.getBoolean(SKIP_DEFAULT);
+    }
+
     public boolean dryRun() {
-        return Boolean.getBoolean(DRY_RUN);
+        return getFlag(DRY_RUN);
     }
 
     public String getInfoGewFile() {
@@ -87,79 +97,79 @@
     }
 
     public boolean skipGauges() {
-        return Boolean.getBoolean(SKIP_GAUGES);
+        return getFlag(SKIP_GAUGES);
     }
 
     public boolean skipAnnotations() {
-        return Boolean.getBoolean(SKIP_ANNOTATIONS);
+        return getFlag(SKIP_ANNOTATIONS);
     }
 
     public boolean skipPRFs() {
-        return Boolean.getBoolean(SKIP_PRFS);
+        return getFlag(SKIP_PRFS);
     }
 
     public boolean skipHYKs() {
-        return Boolean.getBoolean(SKIP_HYKS);
+        return getFlag(SKIP_HYKS);
     }
 
     public boolean skipWst() {
-        return Boolean.getBoolean(SKIP_WST);
+        return getFlag(SKIP_WST);
     }
 
     public boolean skipExtraWsts() {
-        return Boolean.getBoolean(SKIP_EXTRA_WSTS);
+        return getFlag(SKIP_EXTRA_WSTS);
     }
 
     public boolean skipFixations() {
-        return Boolean.getBoolean(SKIP_FIXATIONS);
+        return getFlag(SKIP_FIXATIONS);
     }
 
     public boolean skipOfficialLines() {
-        return Boolean.getBoolean(SKIP_OFFICIAL_LINES);
+        return getFlag(SKIP_OFFICIAL_LINES);
     }
 
     public boolean skipFloodWater() {
-        return Boolean.getBoolean(SKIP_FLOOD_WATER);
+        return getFlag(SKIP_FLOOD_WATER);
     }
 
     public boolean skipFloodProtection() {
-        return Boolean.getBoolean(SKIP_FLOOD_PROTECTION);
+        return getFlag(SKIP_FLOOD_PROTECTION);
     }
 
     public boolean skipBedHeightSingle() {
-        return Boolean.getBoolean(SKIP_BED_HEIGHT_SINGLE);
+        return getFlag(SKIP_BED_HEIGHT_SINGLE);
     }
 
     public boolean skipBedHeightEpoch() {
-        return Boolean.getBoolean(SKIP_BED_HEIGHT_EPOCH);
+        return getFlag(SKIP_BED_HEIGHT_EPOCH);
     }
 
     public boolean skipSedimentDensity() {
-        return Boolean.getBoolean(SKIP_SEDIMENT_DENSITY);
+        return getFlag(SKIP_SEDIMENT_DENSITY);
     }
 
     public boolean skipMorphologicalWidth() {
-        return Boolean.getBoolean(SKIP_MORPHOLOGICAL_WIDTH);
+        return getFlag(SKIP_MORPHOLOGICAL_WIDTH);
     }
 
     public boolean skipFlowVelocity() {
-        return Boolean.getBoolean(SKIP_FLOW_VELOCITY);
+        return getFlag(SKIP_FLOW_VELOCITY);
     }
 
     public boolean skipSedimentYield() {
-        return Boolean.getBoolean(SKIP_SEDIMENT_YIELD);
+        return getFlag(SKIP_SEDIMENT_YIELD);
     }
 
     public boolean skipWaterlevels() {
-        return Boolean.getBoolean(SKIP_WATERLEVELS);
+        return getFlag(SKIP_WATERLEVELS);
     }
 
     public boolean skipWaterlevelDifferences() {
-        return Boolean.getBoolean(SKIP_WATERLEVEL_DIFFERENCES);
+        return getFlag(SKIP_WATERLEVEL_DIFFERENCES);
     }
 
     public boolean skipSQRelation() {
-        return Boolean.getBoolean(SKIP_SQ_RELATION);
+        return getFlag(SKIP_SQ_RELATION);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightEpoch.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingleValue.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportElevationModel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityMeasurement.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportFlowVelocityModel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportMorphWidth.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSQRelation.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentYield.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportWaterlevelDifference.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightEpochParser.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java	Fri Sep 28 12:15:44 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;
@@ -328,11 +331,15 @@
         if (m.matches()) {
             String tmp = m.group(1).replace(";", "");
 
-            obj.setType(new ImportBedHeightType(
-                BedHeightType.getBedHeightName(tmp),
-                tmp));
+            String name = BedHeightType.getBedHeightName(tmp);
 
-            return true;
+            if (name != null) {
+                obj.setType(new ImportBedHeightType(name, tmp));
+                return true;
+            }
+            else {
+                log.warn("Unknown bed height type: '" + tmp + "'");
+            }
         }
 
         return false;
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightSingleParser.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentYieldParser.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java	Fri Sep 28 12:15:44 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/BedHeightEpoch.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightEpoch.java	Fri Sep 28 12:15:44 2012 +0200
@@ -180,8 +180,7 @@
         List<BedHeightEpoch> epochs = query.list();
         List<BedHeightEpoch> good   = new ArrayList<BedHeightEpoch>();
 
-        for (BedHeightEpoch e: epochs) {
-            OUTER:
+        OUTER: for (BedHeightEpoch e: epochs) {
             for (BedHeightEpochValue value: e.getValues()) {
                 double station = value.getStation().doubleValue();
 
--- a/flys-backend/src/main/java/de/intevation/flys/model/BedHeightSingle.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightSingle.java	Fri Sep 28 12:15:44 2012 +0200
@@ -242,13 +242,12 @@
         List<BedHeightSingle> good    = new ArrayList<BedHeightSingle>();
 
         for (BedHeightSingle s: singles) {
-            OUTER:
             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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightType.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Fri Sep 28 12:15:44 2012 +0200
@@ -284,5 +284,46 @@
         return new Object[] { days, qs };
     }
 
+    /**
+     * Calculates the maximum and minimum W and Q values
+     *
+     * @return the MaxMinWQ object representing the calculated values
+     */
+    public MinMaxWQ fetchMaxMinWQ() {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "select max(mv.value) as max, min(mv.value) as min " +
+            "from MainValue as mv " +
+            "join mv.mainValue as nmv " +
+            "join nmv.type mvt " +
+            "where mvt.name in ('W', 'Q') " +
+            "and mv.gauge.id = :gauge_id " +
+            "group by mvt.name order by mvt.name"
+            );
+
+        query.setParameter("gauge_id", getId());
+
+        List<Object> results = query.list();
+        if (results.isEmpty()) {
+            // No values found
+            return new MinMaxWQ();
+        }
+
+        Object[] arr = (Object[]) results.get(0);
+        BigDecimal maxw = (BigDecimal)arr[0];
+        BigDecimal minw = (BigDecimal)arr[1];
+        BigDecimal maxq = null;
+        BigDecimal minq = null;
+
+
+        if (results.size() > 1) {
+            arr = (Object[]) results.get(1);
+            maxq = (BigDecimal)arr[0];
+            minq = (BigDecimal)arr[1];
+        }
+
+        return new MinMaxWQ(minw, maxw, minq, maxq);
+    }
 }
 // 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-backend/src/main/java/de/intevation/flys/model/MinMaxWQ.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,58 @@
+package de.intevation.flys.model;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * Represents minmimum and maximum values for W and Q
+ */
+public class MinMaxWQ implements Serializable {
+
+    private BigDecimal minw;
+    private BigDecimal maxw;
+    private BigDecimal minq;
+    private BigDecimal maxq;
+
+    /**
+     * Default constuctor to indecate that no min and max w and q values
+     * are available
+     */
+    public MinMaxWQ() {
+    }
+
+    /**
+     * Constructor for a new MinMaxWQ value
+     *
+     * @param minw Mimimim W
+     * @param maxw Maximum W
+     * @param minq Mimimim Q
+     * @param maxq Maximum Q
+     */
+    public MinMaxWQ(
+            BigDecimal minw,
+            BigDecimal maxw,
+            BigDecimal minq,
+            BigDecimal maxq)
+    {
+        this.minw = minw;
+        this.maxw = maxw;
+        this.minq = minq;
+        this.maxq = maxq;
+    }
+
+    public BigDecimal getMinW() {
+        return this.minw;
+    }
+
+    public BigDecimal getMaxW() {
+        return this.maxw;
+    }
+
+    public BigDecimal getMinQ() {
+        return this.minq;
+    }
+
+    public BigDecimal getMaxQ() {
+        return this.maxq;
+    }
+}
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java	Fri Sep 28 12:15:44 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;
@@ -220,6 +231,34 @@
         return gauges.isEmpty() ? null : gauges.get(0);
     }
 
+    public double[] determineMinMaxQ() {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "select min(wqr.q) as min, max(wqr.q) as max " +
+            "from Wst as w " +
+            "join w.columns as wc " +
+            "join wc.columnQRanges as wcqr " +
+            "join wcqr.wstQRange as wqr " +
+            "where w.kind = 0 and river_id = :river");
+
+        query.setParameter("river", getId());
+
+        double minmax[] = new double[] { Double.MAX_VALUE, Double.MIN_VALUE };
+
+        List<Object> results = query.list();
+
+        if (!results.isEmpty()) {
+            Object[] arr = (Object[]) results.get(0);
+            BigDecimal minq = (BigDecimal)arr[0];
+            BigDecimal maxq = (BigDecimal)arr[1];
+            minmax[0] = minq.doubleValue();
+            minmax[1] = maxq.doubleValue();
+        }
+
+        return minmax;
+    }
+
 
     /**
      * This method returns the first gauge that is intersected by <i>a</i> and
@@ -288,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:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/model/RiverAxis.java	Fri Sep 28 12:15:44 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:44 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-backend/src/main/java/de/intevation/flys/utils/StringUtil.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-backend/src/main/java/de/intevation/flys/utils/StringUtil.java	Fri Sep 28 12:15:44 2012 +0200
@@ -517,7 +517,7 @@
     }
 
     /**
-     * Gibt den Dateinamen in S ohne Dateiendung zurück.
+     * Returns the file name without extension.
      */
     public static final String cutExtension(String s) {
         if (s == null) {
--- a/flys-client/ChangeLog	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/ChangeLog	Fri Sep 28 12:15:44 2012 +0200
@@ -1,3 +1,532 @@
+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,
+	  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/client/ui/GaugePanel.java:
+	  Use the wstunit from the river as unit for the Pegelnullpunkt.
+
+2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Don't display the GaugePanel if no river is selected.
+
+2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/DefaultArtifactDescription.java:
+	  Fix NullPointerException when going back in WINFO artifact to the river
+	  selection.
+
+2012-09-19	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.java,
+	  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/GaugePanel.java:
+	  Add locale aware formatting of the gauge values.
+	  Don't reload the gauges if the river doesn't change.
+	  Correctly handle kmup of the river.
+
+2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Improve handling of the GaugePanel and don't delete members of the
+	  GaugePanel.
+
+2012-09-19	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 station information to the gauges.
+
+2012-09-19	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/webapp/FLYS.css,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Get a working GaugeInfo solution with scrolling adjustments if gauge info
+	  elements are folded in an out.
+
+2012-09-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Removed trailing whitespace.
+
+2012-09-17  Ingo Weinzierl <ingo@intevation.de>
+
+	Tagged RELEASE 2.9.1
+
+2012-09-17  Ingo Weinzierl <ingo@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 missing i18n strings for minfo state description.
+
+2012-09-16	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/widgets/KMSpinnerChangeListener.java (NEW),
+	  src/main/java/de/intevation/flys/client/client/widgets/KMSpinner.java (NEW),
+	  src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java:
+	  Refactored some KMSpinner code. KMSpinner has now a human-readable size (#853).
+
+2012-09-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* 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/client/ui/ParameterList.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java,
+	  src/main/java/de/intevation/flys/client/client/services/GaugeOverviewInfoService.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Removed trailing whitespace and superfluous imports.
+
+2012-09-14	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.java,
+	  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/ParameterList.java,
+	  src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java:
+	  Add first draft for the gauge overview info ui
+
+2012-09-14	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/services/GaugeOverviewInfoService.java,
+	  src/main/java/de/intevation/flys/client/client/services/GaugeOverviewInfoServiceAsync.java,
+	  src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java,
+	  src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java,
+	  src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java:
+	  Implement a service to handle the gauge info
+
+2012-09-13	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java:
+	  Adding "from" and "to" in table columns with the green/red marker icons (#808).
+
+2012-09-13  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.properties:
+	  Translated german strings.
+
+2012-09-13  Ingo Weinzierl <ingo@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 'main_channel' and 'total_channel' strings.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java:
+	  Use the correct label for the UI.
+
+2012-09-13  Ingo Weinzierl <ingo@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 strings for bed quality chart and export.
+
+2012-09-13	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ProjectList.java:
+	  Scrolling long Project lists is now more robust (#757), although
+	  the search box is now part of the scrolling pane.
+
+2012-09-13	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/FLYSConstants_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants.java:
+	  Adding string for error_no_modules_found (#855).
+
+2012-09-13	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
+	  src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java:
+	  Cosmetics.
+
+2012-09-12  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/minfo/BedCampaignChart.java,
+	  src/main/java/de/intevation/flys/client/client/ui/minfo/BedloadCampaignChart.java:
+	  New. Container for overview charts.
+
+	* src/main/java/de/intevation/flys/client/server/BedKMChartServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/BedloadKMChartServiceImpl.java:
+	  New. Services for overview charts.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java:
+	  Show i18n strings in column titles.
+
+	* src/main/java/de/intevation/flys/client/client/ui/minfo/BedMultiPeriodPanel.java:
+	  New. UI provider that allows multiple period input and displays the overview
+	  charts.
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java:
+	  Added new ui provider.
+
+	* src/main/webapp/WEB-INF/web.xml:
+	  Added new services.
+
+	* 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_en.properties,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Added i18n strings.
+
+2012-09-12  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/shared/model/StringOptionsData.java:
+	  Fixed constructor.
+
+2012-09-11	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/StyleEditorWindow.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Fix for line label text in Delta W(t) chart (#837).
+
+2012-09-10	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
+	  Minimal fix for 'Transparency' combobox appearence (#840).
+
+2012-09-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml: Java 1.5 -> 1.6
+
+2012-09-09	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/StyleEditorWindow.java,
+	  src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties:
+	  Rename attribute 'alpha' to 'transparency' which now represents the 
+	  transparency percentage instead raw rgba alpha value. StyledEditorWindow
+	  can now handle this transparency attribute.
+
+2012-09-09	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/FLYSConstants_de.properties:
+	  Add 'error_update_collection_attribute' string (#843).
+
+2012-09-09	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/UserServiceImpl.java:
+	  Remove blank line.
+
+	* src/main/java/de/intevation/flys/client/client/FLYS.java:
+	  Catch MissingResourceException on unexpected server exceptions (#843).
+
+2012-09-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java:
+	  Reverted functional change from clins last commit.
+
+	* src/main/java/de/intevation/flys/client/server/LoginServlet.java,
+	  src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java,
+	  src/main/java/de/intevation/flys/client/server/auth/UserClient.java:
+	  Removed trailing whitespace.
+
+2012-09-08	Christian Lins	<christian.lins@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java,
+	  src/main/java/de/intevation/flys/client/server/LoginServlet.java,
+	  src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java,
+	  src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java,
+	  src/main/java/de/intevation/flys/client/server/auth/UserClient.java,
+	  src/main/java/de/intevation/flys/client/client/FLYS.java:
+	  Cosmetics, add robustness checks etc.
+
+2012-09-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/UserServiceImpl.java,
+	  src/main/java/de/intevation/flys/client/server/auth/UserClient.java:
+	  Be more defensive about fetchimg users from session.
+
+2012-09-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	Improved panning in TimeseriesCharts (issue715).
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java
+	  (computeZoom): Prevent confusion of scoped 'zoom' variable.
+	  (divide): Cast to double, we do not want long precision divisions.
+
 2012-09-07	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/ChartInfo.java,
--- a/flys-client/pom.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/pom.xml	Fri Sep 28 12:15:44 2012 +0200
@@ -15,8 +15,8 @@
       <!-- Convenience property to set the GWT version -->
       <gwtVersion>2.4.0</gwtVersion>
       <!-- GWT needs at least java 1.5 -->
-      <maven.compiler.source>1.5</maven.compiler.source>
-      <maven.compiler.target>1.5</maven.compiler.target>
+      <maven.compiler.source>1.6</maven.compiler.source>
+      <maven.compiler.target>1.6</maven.compiler.target>
   </properties>
 
   <dependencies>
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYS.java	Fri Sep 28 12:15:44 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;
@@ -40,6 +42,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.MissingResourceException;
 import java.util.Set;
 
 
@@ -71,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;
@@ -137,13 +143,22 @@
         Config config = Config.getInstance();
         String locale = config.getLocale();
 
-        getRivers();
-
         userService.getCurrentUser(locale, new AsyncCallback<User>() {
             @Override
             public void onFailure(Throwable caught) {
                 GWT.log("Could not find a logged in user.");
-                SC.warn(MSG.getString(caught.getMessage()));
+                String msg = caught.getLocalizedMessage();
+                try {
+                    msg = MSG.getString(caught.getMessage());
+                }
+                catch(MissingResourceException ex) {
+                    // There are some server error exceptions with
+                    // varying text messages that cannot be localized
+                    // easily. In this rare cases, use the plain
+                    // exception message.
+                    GWT.log("Missing resource for: " + caught.getMessage());
+                }
+                SC.warn(msg);
             }
 
             @Override
@@ -430,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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java	Fri Sep 28 12:15:44 2012 +0200
@@ -8,6 +8,8 @@
  */
 public interface FLYSConstants extends ConstantsWithLookup {
 
+    String add();
+
     String unexpected_exception();
 
     String title();
@@ -228,6 +230,8 @@
 
     String helperPanelTitle();
 
+    String gaugePanelTitle();
+
     String wqTitle();
 
     String wqadaptedTitle();
@@ -264,6 +268,10 @@
 
     String unitQStep();
 
+    String main_channel();
+
+    String total_channel();
+
     String footerHome();
 
     String footerContact();
@@ -361,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();
@@ -387,6 +406,8 @@
 
     String discharge_curve();
 
+    String gauge_discharge_curve();
+
     String computed_discharge_curve();
 
     String computed_discharge_curves();
@@ -503,6 +524,10 @@
 
     String bedheight_middle_export();
 
+    String bed_longitudinal_section();
+
+    String bed_longitudinal_section_export();
+
     String sq_relation_a();
 
     String sq_relation_b();
@@ -519,6 +544,18 @@
 
     String exportATTooltip();
 
+    String load_diameter();
+
+    String bed_diameter();
+
+    String soundings();
+
+    String bed_difference_year();
+
+    String bed_difference_epoch();
+
+    String bed_difference_height_year();
+
     // ERRORS
 
     String error_read_minmax_values();
@@ -549,8 +586,12 @@
 
     String error_no_rivers_found();
 
+    String error_no_gaugeoverviewinfo_found();
+
     String error_no_such_user();
 
+    String error_no_users();
+
     String error_no_waterlevel_pair_selected();
 
     String error_same_waterlevels_in_pair();
@@ -603,6 +644,8 @@
 
     String error_no_map_output_type();
 
+    String error_no_module_found();
+
     String warning_use_first_feature();
 
     String error_no_valid_gfi_url();
@@ -639,6 +682,8 @@
 
     String error_contains_same_location();
 
+    String error_update_collection_attribute();
+
     // MAP RELATED STRINGS
 
     String digitize();
@@ -877,6 +922,10 @@
 
     String showverticalline();
 
+    String horizontal();
+
+    String vertical();
+
     String textcolor();
 
     String textsize();
@@ -929,7 +978,7 @@
 
     String transparent();
 
-    String alpha();
+    String transparency();
 
     String showarea();
 
@@ -982,5 +1031,21 @@
     String fix_parameters();
 
     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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties	Fri Sep 28 12:15:44 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]
@@ -69,7 +69,7 @@
 unitTo = km a
 unitWidth = m
 search = Search
-discharge = FIXME(Name)
+discharge = Discharge Name
 properties = Properties
 activateTheme = Activate
 deactivateTheme = Deactivate
@@ -84,6 +84,7 @@
 start_year = Start
 end_year = End
 period = Period
+
 # Header images
 flysLogo = images/flys_logo.gif
 bfgLogo = images/bfg_logo.gif
@@ -156,6 +157,7 @@
 wqHistorical = Selection of Analyse Type
 calcTableTitle = Calculated Output
 helperPanelTitle = Input Support
+gaugePanelTitle = Gauge Information
 wqW = W at Gauge [cm]
 wqQ = Q [m\u00b3/s]
 wqWFree = W free position [m+NHN]
@@ -171,9 +173,11 @@
 unitQFrom = m³/s&nbsp;-
 unitQTo = m³/s&nbsp;a
 unitQStep = m³/s
+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
@@ -188,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
@@ -201,6 +207,8 @@
 flow_velocity_export = Flow Velocity Export
 bedheight_middle = Middle Bed Height
 bedheight_middle_export = Middle Bed Height Export
+bed_longitudinal_section = Bed Quality
+bed_longitudinal_section_export = Bed Quality Export
 sq_relation_a = A Feinkornanteil
 sq_relation_b = B Sand (Suspensionstransport)
 sq_relation_c = C Sand (Geschiebetransport)
@@ -220,6 +228,12 @@
 fix_derivate_curve = Derivate
 fix_vollmer_wq_curve = W/Q
 datacage_add_pair = Add difference pair
+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
 
@@ -231,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
@@ -253,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
@@ -282,11 +301,13 @@
 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.
 error_load_parameterization = Could not load the parameterization.
 error_wrong_date = Please enter valid dates.
+error_no_gaugeoverviewinfo_found = Error while fetching the river and gauge info
 
 error_feed_no_data = No input data found.
 error_feed_from_out_of_range = The lower value is bigger than the upper value.
@@ -324,6 +345,8 @@
 error_invalid_date = The entered date is not valid.
 error_same_location = Reference location equals selected location.
 error_contains_same_location = Target locations contains reference location.
+error_update_collection_attribute = Error while updating the collection attribut
+error_no_module_found = No modules found
 
 ## map related strings
 digitize = images/digitize.png
@@ -469,13 +492,15 @@
 labelfontstyle = Label: Style
 labelbgcolor = Label: Background Color
 labelshowbg = Label: Show Background
+horizontal = horizontal
+vertical = vertical
 showwidth = Show width
 showlevel = Show waterlevel
 showminimum = Show minimum
 showmaximum = Show maximum
 showborder = Show line
 transparent = Transparency
-alpha = Transparency Alpha
+transparency = Transparency
 showarea = Show Area
 showmiddleheight = Show middle depth
 fillcolor = Fill Color
@@ -511,3 +536,11 @@
 fix_parameters = CSV
 
 sq_overview=Overview
+
+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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties	Fri Sep 28 12:15:44 2012 +0200
@@ -143,6 +143,7 @@
 wqHistorical = Auswahl der Analyseart
 calcTableTitle = Berechnungsausgabe
 helperPanelTitle = Eingabeunterst\u00fctzung
+gaugePanelTitle = Gew\u00e4sser/Pegel-Info
 wqW = W am Pegel [cm]
 wqQ = Q [m\u00b3/s]
 wqWFree = W auf freier Strecke [m+NHN]
@@ -158,6 +159,8 @@
 unitQFrom = m\u00b3/s&nbsp;-
 unitQTo = m\u00b3/s&nbsp;a
 unitQStep = m\u00b3/s
+main_channel = Hauptgerinne
+total_channel = Gesamtgerinne
 footerHome = Home
 footerContact = Kontakt
 footerImpressum = Impressum
@@ -175,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
@@ -190,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
@@ -201,6 +206,8 @@
 flow_velocity_export = Flie\u00dfgeschwindigkeiten Export
 bedheight_middle = Mittlere Sohlh\u00f6he
 bedheight_middle_export = Mittlere Sohlh\u00f6he Export
+bed_longitudinal_section = Sohlbeschaffenheit
+bed_longitudinal_section_export = Sohlbeschaffenheit Export
 sq_relation_a = A Feinkornanteil
 sq_relation_b = B Sand (Suspensionstransport)
 sq_relation_c = C Sand (Geschiebetransport)
@@ -220,6 +227,12 @@
 fix_derivate_curve = Ableitungskurve
 fix_vollmer_wq_curve = W/Q
 datacage_add_pair = Differenzenpaar hinzuf\u00fcgen
+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
@@ -253,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
@@ -281,12 +299,14 @@
 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.
 error_load_parameterization = Fehler beim Laden der Parametrisierung.
 error_wrong_date = Bitte geben Sie gültige Daten ein.
+error_no_gaugeoverviewinfo_found = Fehler beim Laden der Fluss- und Pegelinformationen
 
 error_feed_no_data = Keine Eingabedaten gefunden.
 error_feed_from_out_of_range = Der untere Wert liegt au\u00dferhalb des g\u00fcltigen Wertebereiches.
@@ -324,6 +344,8 @@
 error_invalid_date = Das eingegebene Datum ist nicht korrekt.
 error_same_location = Der gewählte Ort ist der Bezugsort.
 error_contains_same_location = Zielorte beinhalten den Bezugsort.
+error_update_collection_attribute = Fehler beim Aktualisieren des Collection-Attributs.
+error_no_module_found = Keine nutzbaren Module gefunden.
 
 ## map related strings
 digitize = images/digitize.png
@@ -469,13 +491,15 @@
 labelfontstyle = Beschriftung: Schriftstil
 labelbgcolor = Beschriftung: Hintergrundfarbe
 labelshowbg = Beschriftung: Hintergrund f\u00fcllen
+horizontal = horizontal
+vertical = vertikal
 showwidth = Breite anzeigen
 showlevel = Wasserstand anzeigen
 showminimum = Minimum anzeigen
 showmaximum = Maximum anzeigen
 showborder = Linie anzeigen
-transparent = Transparenz
-alpha = Alpha-Transparenzwert
+transparent = Transparent
+transparency = Transparenz
 showarea = Fl\u00e4che beschriften
 showmiddleheight = Mittlere Tiefe anzeigen
 fillcolor = F\u00fcllfarbe
@@ -510,3 +534,11 @@
 fix_parameters_export = Angepasste Koeffizienten
 fix_parameters = CSV
 sq_overview=\u00dcbersicht
+
+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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties	Fri Sep 28 12:15:44 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]
@@ -157,6 +157,7 @@
 wqHistorical = Selection of Analyse Type
 calcTableTitle = Calculated Output
 helperPanelTitle = Input Support
+gaugePanelTitle = Gauge Information
 wqW = W at Gauge [cm]
 wqQ = Q [m\u00b3/s]
 wqWFree = W at free position [m+NHN]
@@ -172,9 +173,11 @@
 unitQFrom = m³/s&nbsp;-
 unitQTo = m³/s&nbsp;a
 unitQStep = m³/s
+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
@@ -189,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
@@ -202,6 +207,8 @@
 flow_velocity_export = Flow Velocity Export
 bedheight_middle = Middle Bed Height
 bedheight_middle_export = Middle Bed Height Export
+bed_longitudinal_section = Bed Quality
+bed_longitudinal_section_export = Bed Quality Export
 sq_relation_a = A Feinkornanteil
 sq_relation_b = B Sand (Suspensionstransport)
 sq_relation_c = C Sand (Geschiebetransport)
@@ -221,6 +228,12 @@
 fix_derivate_curve = Derivate
 fix_vollmer_wq_curve = W/Q
 datacage_add_pair = Add difference pair
+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
 
@@ -232,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
@@ -254,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
@@ -283,11 +301,13 @@
 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.
 error_load_parameterization = Could not load the parameterization.
 error_wrong_date = Please enter valid dates.
+error_no_gaugeoverviewinfo_found = Error while fetching the river and gauge info
 
 error_feed_no_data = No input data found.
 error_feed_from_out_of_range = The lower value is bigger than the upper value.
@@ -325,6 +345,8 @@
 error_invalid_date = The entered date is not valid.
 error_same_location = Reference location equals selected location.
 error_contains_same_location = Target locations contains reference location.
+error_update_collection_attribute = Error while updating the collection attribut
+error_no_module_found = No modules found
 
 ## map related strings
 digitize = images/digitize.png
@@ -470,13 +492,15 @@
 labelfontstyle = Label: Style
 labelbgcolor = Label: Background Color
 labelshowbg = Label: Show Background
+horizontal = horizontal
+vertical = vertical
 showwidth = Show width
 showlevel = Show waterlevel
 showminimum = Show minimum
 showmaximum = Show maximum
 showborder = Show line
 transparent = Transparency
-alpha = Transparency Alpha
+transparency = Transparency
 showarea = Show Area
 showmiddleheight = Show middle depth
 fillcolor = Fill Color
@@ -511,3 +535,11 @@
 fix_parameters_export = Adjusted coefficient
 fix_parameters = CSV
 sq_overview=Overview
+
+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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactService.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ArtifactServiceAsync.java	Fri Sep 28 12:15:44 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 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/GaugeOverviewInfoService.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,17 @@
+package de.intevation.flys.client.client.services;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+
+import de.intevation.flys.client.shared.exceptions.ServerException;
+import de.intevation.flys.client.shared.model.RiverInfo;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+@RemoteServiceRelativePath("gaugeoverviewinfo")
+public interface GaugeOverviewInfoService extends RemoteService {
+
+    public RiverInfo getRiverInfo(String river) throws ServerException;
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/GaugeOverviewInfoServiceAsync.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,16 @@
+package de.intevation.flys.client.client.services;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+import de.intevation.flys.client.shared.model.RiverInfo;
+
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public interface GaugeOverviewInfoServiceAsync {
+
+    public void getRiverInfo(String river, AsyncCallback<RiverInfo> 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/services/ModuleServiceAsync.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/services/ModuleServiceAsync.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java	Fri Sep 28 12:15:44 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;
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,209 @@
+package de.intevation.flys.client.client.ui;
+
+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.Anchor;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+
+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.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.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 {
+
+    /** SectionStackSection where this GaugePanel belongs in*/
+    private SectionStackSection sectionStack;
+
+    /** Name of the river */
+    private String river;
+
+    /** 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;
+
+    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(FLYS flys, SectionStackSection sectionStack) {
+        gaugetree = new GaugeTree(flys);
+        setOverflow(Overflow.HIDDEN);
+        sectionStack.setHidden(true);
+        sectionStack.setItems(this);
+        this.sectionStack = sectionStack;
+        setStyleName("gaugepanel");
+        addResizedHandler(this);
+    }
+
+    /**
+     * Sets and loads the river data if river is not the current set river
+     */
+    public void setRiver(String river) {
+        if (!river.equals(this.river)) {
+            this.river = river;
+            this.refresh();
+        }
+    }
+
+    /**
+     * 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() {
+        gaugeOverviewInfoService.getRiverInfo(this.river, new AsyncCallback<RiverInfo>() {
+            public void onFailure(Throwable e) {
+                GWT.log("Could not load the river info." + e);
+            }
+
+            public void onSuccess(RiverInfo riverinfo) {
+                GWT.log("Loaded river info");
+                renderGaugeOverviewInfo(riverinfo);
+            }
+        });
+    }
+
+    public void renderGaugeOverviewInfo(RiverInfo riverinfo) {
+        removeMembers(getMembers());
+
+        riverinfopanel = new RiverInfoPanel(riverinfo);
+        addMember(riverinfopanel);
+        addMember(gaugetree);
+
+        gaugetree.setGauges(riverinfo);
+    }
+
+    @Override
+    public void onResized(ResizedEvent event) {
+        /* this height calculation is only an approximation and doesn't reflect
+         * the real height of the the gaugetree. */
+        int height = getInnerContentHeight() -
+            (RiverInfoPanel.HEIGHT +
+            (2 * RiverInfoPanel.BORDER_WIDTH) +
+            (2 * RiverInfoPanel.PADDING) +
+            (2 * RiverInfoPanel.MARGIN));
+
+        if (height < 0) {
+            height = 0;
+        }
+
+        gaugetree.setHeight("" + height + "px");
+    }
+
+
+    /**
+     * Hide the section stack section.
+     */
+    public void hide() {
+        GWT.log("GaugePanel - hide");
+        this.sectionStack.setHidden(true);
+    }
+
+    /**
+     * Show the section stack section.
+     */
+    public void show() {
+        GWT.log("GaugePanel - show");
+        this.sectionStack.setHidden(false);
+    }
+
+    class RiverInfoPanel extends HorizontalPanel {
+
+        public final static int HEIGHT = 30;
+        public final static int BORDER_WIDTH = 3;
+        public final static int PADDING = 8;
+        public final static int MARGIN = 10;
+
+        public RiverInfoPanel(RiverInfo riverinfo) {
+            setStyleName("riverinfopanel");
+            setHeight("" + HEIGHT + "px");
+            setVerticalAlignment(ALIGN_MIDDLE);
+
+            NumberFormat nf = NumberFormat.getDecimalFormat();
+
+            addLabel(riverinfo.getName(), false);
+
+            String kmtext = "";
+            Double start = riverinfo.getKmStart();
+            Double end = riverinfo.getKmEnd();
+
+            if (!riverinfo.isKmUp()) {
+                Double tmp = end;
+                end = start;
+                start = tmp;
+            }
+            if (end != null) {
+                kmtext += nf.format(end);
+                kmtext += " - ";
+            }
+            if (start != null) {
+                kmtext += nf.format(start);
+            }
+            kmtext += " km";
+
+            addLabel(kmtext, false);
+
+            String qtext = "";
+            Double qmin = riverinfo.getMinQ();
+            Double qmax = riverinfo.getMaxQ();
+            if (qmin != null) {
+                qtext += nf.format(qmin);
+                qtext += " " + MSG.gauge_q_unit();
+                qtext += " - ";
+            }
+            if (qmax != null) {
+                qtext += nf.format(qmax);
+                qtext += " " + MSG.gauge_q_unit();
+            }
+
+            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) {
+            Label label = new Label(text, wordwrap);
+            add(label);
+            setCellHeight(label, "" + HEIGHT + "px");
+        }
+    }
+}
--- /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:44 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/LocationDistancePanel.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Fri Sep 28 12:15:44 2012 +0200
@@ -452,14 +452,14 @@
             }
         };
 
-        ListGridField addfrom = new ListGridField ("", "");
+        ListGridField addfrom = new ListGridField ("from", MESSAGES.from());
         addfrom.setType (ListGridFieldType.ICON);
-        addfrom.setWidth (20);
+        addfrom.setWidth (30);
         addfrom.setCellIcon(baseUrl + MESSAGES.markerGreen());
 
-        ListGridField addto2 = new ListGridField ("", "");
+        ListGridField addto2 = new ListGridField ("to", MESSAGES.to());
         addto2.setType (ListGridFieldType.ICON);
-        addto2.setWidth (20);
+        addto2.setWidth (30);
         addto2.setCellIcon(baseUrl + MESSAGES.markerRed());
 
         locationDistanceTable.addCellClickHandler (new CellClickHandler () {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 28 12:15:44 2012 +0200
@@ -21,6 +21,7 @@
 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
 
 import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.WINFOArtifact;
 import de.intevation.flys.client.shared.model.ArtifactDescription;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.Data;
@@ -109,6 +110,7 @@
     protected VLayout report;
     protected VLayout helperPanel;
     protected VLayout tablePanel;
+    protected GaugePanel gaugePanel;
     protected Canvas  reportPanel;
 
     public ParameterList(FLYS flys, CollectionView cView, String title) {
@@ -207,6 +209,23 @@
         stack.setCanResizeSections(true);
         stack.setVisibilityMode(VisibilityMode.MULTIPLE);
 
+        final SectionStackSection gaugeSection = new SectionStackSection();
+        gaugeSection.setExpanded(false);
+        gaugeSection.setTitle(MSG.gaugePanelTitle());
+        gaugePanel = new GaugePanel(flys, gaugeSection) {
+            public void addMember(Canvas component) {
+                super.addMember(component);
+                gaugeSection.setExpanded(true);
+            }
+
+            public void removeMembers(Canvas[] components) {
+                super.removeMembers(components);
+                gaugeSection.setExpanded(false);
+            }
+        };
+        gaugePanel.setWidth100();
+        gaugePanel.setHeight100();
+
         // This canvas is used to render helper widgets.
         final SectionStackSection helperSection = new SectionStackSection();
         helperSection.setExpanded(false);
@@ -245,7 +264,7 @@
         tablePanel.setWidth100();
         tableSection.setItems(tablePanel);
 
-        stack.setSections(helperSection, tableSection);
+        stack.setSections(gaugeSection, helperSection, tableSection);
 
         return stack;
     }
@@ -723,6 +742,15 @@
                 setCurrentData(null, null);
             }
         }
+        if (art instanceof WINFOArtifact) {
+            String river = desc.getRiver();
+            if (river != null) {
+                renderGaugeInfo(desc.getRiver(), desc.getOldData());
+            }
+            else {
+                gaugePanel.hide();
+            }
+        }
 
         addOldDatas(
             desc.getOldData(),
@@ -895,5 +923,13 @@
     protected void unlockUI() {
         cView.unlockUI();
     }
+
+
+    private void renderGaugeInfo(String river, DataList[] data) {
+        gaugePanel.setRiver(river);
+        gaugePanel.setData(data);
+        gaugePanel.show();
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrix.java	Fri Sep 28 12:15:44 2012 +0200
@@ -13,13 +13,24 @@
 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;
 import de.intevation.flys.client.shared.model.IntegerOptionsData;
 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 {
@@ -44,6 +55,8 @@
         }
     } // end of class Column
 
+    /** The message class that provides i18n strings.*/
+    protected FLYSConstants MESSAGE = GWT.create(FLYSConstants.class);
 
     public static final int CELL_HEIGHT = 25;
 
@@ -114,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);
@@ -123,7 +183,7 @@
 
             selected.put(columnName, new ArrayList<String>());
 
-            grid.setWidget(0, i+1, createLabel(columnName));
+            grid.setWidget(0, i+1, createLabel(MESSAGE.getString(columnName)));
 
             for (int j = 0, o = valueNames.size(); j < o; j++) {
                 String valueName = valueNames.get(j);
@@ -134,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));
                 }
             }
         }
@@ -143,6 +203,7 @@
     }
 
 
+    /** Creates label with given text. */
     protected Label createLabel(String text) {
         Label label = new Label(text);
         label.setHeight(CELL_HEIGHT);
@@ -151,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
@@ -169,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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterMatrixPanel.java	Fri Sep 28 12:15:44 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,15 +138,24 @@
             }
         }
 
-        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) {
-        Label label = new Label(dataList.getState());
+        Data data = dataList.get(0);
+        Label label = new Label(data.getDescription());
         label.setHeight(35);
 
         return label;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ProjectList.java	Fri Sep 28 12:15:44 2012 +0200
@@ -5,8 +5,10 @@
 import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.Autofit;
 import com.smartgwt.client.types.ListGridEditEvent;
 import com.smartgwt.client.types.ListGridFieldType;
+import com.smartgwt.client.types.Overflow;
 import com.smartgwt.client.types.SelectionStyle;
 import com.smartgwt.client.types.SortArrow;
 import com.smartgwt.client.types.SortDirection;
@@ -191,7 +193,7 @@
 
     protected void initGrid() {
         grid.setWidth100();
-        grid.setHeight100();
+        grid.setAutoFitData(Autofit.VERTICAL);
         grid.setAutoFitMaxWidth(500);
         grid.setEmptyMessage(messages.no_projects());
         grid.setLoadingDataMessage(messages.load_projects());
@@ -204,6 +206,7 @@
         grid.setSelectionType(SelectionStyle.SINGLE);
         grid.setCanReorderFields(false);
         grid.setLeaveScrollbarGap(false);
+        grid.setBorder("0px");
 
         ListGridField date = buildDateField();
         ListGridField name = buildNameField();
@@ -363,6 +366,7 @@
         setShowEdges(false);
         setLayoutMargin(0);
         setLayoutAlign(VerticalAlignment.TOP);
+        setOverflow(Overflow.AUTO);
 
         Label title = new Label(messages.projects());
         title.setHeight("20");
@@ -384,6 +388,7 @@
         TableFilter filter = new TableFilter();
         filter.setHeight("30px");
         filter.addFilterHandler(this);
+        filter.setBorder("1px solid gray");
 
         addMember(titleWrapper);
         addMember(gridWrapper);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java	Fri Sep 28 12:15:44 2012 +0200
@@ -295,7 +295,6 @@
                          "pointcolor",
                          "pointsize",
                          "textcolor",
-                         "textorientation",
                          "backgroundcolor",
                          "showbackground",
                          "showlinelabel",
@@ -303,6 +302,7 @@
                          "labelfontcolor",
                          "labelfontsize",
                          "labelfontstyle",
+                         "textorientation",
                          "labelshowbg",
                          "labelbgcolor",
                          "showpointlabel",
@@ -366,6 +366,7 @@
             f = new SelectItem(name, MSG.getString(name));
             if (name.equals("linesize")) {
                 f = createLineSizeUI(f);
+                f.setValue(value);
             }
             else if (name.equals("labelfontsize")) {
                 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
@@ -378,6 +379,7 @@
                 valueMap.put("18", "18");
                 valueMap.put("24", "24");
                 f.setValueMap(valueMap);
+                f.setValue(value);
             }
             else if (name.equals("bandwidth")) {
                 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
@@ -394,6 +396,7 @@
                 valueMap.put("10", "10");
                 valueMap.put("11", "11");
                 f.setValueMap(valueMap);
+                f.setValue(value);
             }
             else if (name.equals("pointsize")) {
                 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
@@ -405,15 +408,23 @@
                 valueMap.put("6", "6");
                 valueMap.put("7", "7");
                 f.setValueMap(valueMap);
+                f.setValue(value);
             }
-            f.setValue(value);
+            else if (name.equals("transparency")) {
+                LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
+                for (int n = 10; n < 100; n += 10) {
+                    valueMap.put(Integer.toString(n), n + "%");
+                }
+                f.setValueMap(valueMap);
+                f.setValue(value);
+            }
         }
         else if (type.equals("boolean")) {
             if(name.equals("textorientation")) {
                 f = new SelectItem(name, MSG.getString(name));
                 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
-                valueMap.put("true", "horizontal");
-                valueMap.put("false", "vertical");
+                valueMap.put("true", MSG.getString("horizontal"));
+                valueMap.put("false", MSG.getString("vertical"));
                 f.setValueMap(valueMap);
                 f.setValue(value);
             }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -9,6 +9,7 @@
 import de.intevation.flys.client.client.ui.fixation.FixQSelectPanel;
 import de.intevation.flys.client.client.ui.sq.SQPeriodPanel;
 import de.intevation.flys.client.client.ui.minfo.BedHeightsDatacagePanel;
+import de.intevation.flys.client.client.ui.minfo.BedMultiPeriodPanel;
 import de.intevation.flys.client.client.ui.minfo.CheckboxPanel;
 import de.intevation.flys.client.shared.model.User;
 
@@ -136,6 +137,9 @@
         else if (uiProvider.equals("minfo.bed.year_epoch")) {
             return new RadioPanel();
         }
+        else if (uiProvider.equals("bedquality_periods_select")) {
+            return new BedMultiPeriodPanel();
+        }
         else if (uiProvider.equals("bedheights_twin_panel")) {
             return new BedHeightsDatacagePanel(user);
         }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java	Fri Sep 28 12:15:44 2012 +0200
@@ -53,7 +53,7 @@
     public static final int DEFAULT_CHART_WIDTH  = 600;
     public static final int DEFAULT_CHART_HEIGHT = 500;
 
-    public static final int THEMEPANEL_MIN_WIDTH = 200;
+    public static final int THEMEPANEL_MIN_WIDTH = 250;
 
     /** The service that is used to fetch chart information. */
     protected ChartInfoServiceAsync info = GWT.create(ChartInfoService.class);
@@ -115,8 +115,8 @@
         zoomStack = new Stack<ZoomObj>();
 
         zoom = new Number[] {
-            new Integer(0), new Integer(1),
-            new Integer(0), new Integer(1) };
+            new Double(0), new Double(1),
+            new Double(0), new Double(1) };
 
         left.setBorder("1px solid gray");
         left.setWidth(THEMEPANEL_MIN_WIDTH);
@@ -153,7 +153,7 @@
         tbarPanel = createChartToolbar(this);
         vLayout.addMember(tbarPanel);
         vLayout.addMember(hLayout);
-	vLayout.setOverflow(Overflow.HIDDEN);
+        vLayout.setOverflow(Overflow.HIDDEN);
 
         setPane(vLayout);
 
@@ -328,6 +328,7 @@
         Number[] x = panAxis(xAxis, diffX);
         Number[] y = panAxis(yAxis, diffY);
 
+        // Set the zoom coordinates.
         zoom[0] = x[0];
         zoom[1] = x[1];
         zoom[2] = y[0];
@@ -441,7 +442,7 @@
 
 
     public static Number[] computeZoom(Axis axis, Number min, Number max) {
-        Number[] zoom = new Number[2];
+        Number[] hereZoom = new Number[2];
 
         Number absMin = axis.getMin();
         Number absMax = axis.getMax();
@@ -449,10 +450,10 @@
             ? subtract(absMax, absMin)
             : subtract(absMin, absMax);
 
-        zoom[0] = divide(subtract(min, absMin), diff);
-        zoom[1] = divide(subtract(max, absMin), diff);
+        hereZoom[0] = divide(subtract(min, absMin), diff);
+        hereZoom[1] = divide(subtract(max, absMin), diff);
 
-        return zoom;
+        return hereZoom;
     }
 
 
@@ -707,6 +708,7 @@
     }
 
 
+    /** Add two numbers, casting to Type of param left. */
     public static Number add(Number left, Number right) {
         if (left instanceof Double) {
             return new Double(left.doubleValue() + right.doubleValue());
@@ -720,12 +722,13 @@
     }
 
 
+    /** Divde left by right. Note that Long will be casted to double. */
     public static Number divide(Number left, Number right) {
         if (left instanceof Double) {
             return new Double(left.doubleValue() / right.doubleValue());
         }
         else if (left instanceof Long) {
-            return new Long(left.longValue() / right.longValue());
+            return new Double(left.doubleValue() / right.doubleValue());
         }
         else {
             return new Integer(left.intValue() / right.intValue());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,60 +1,30 @@
 package de.intevation.flys.client.client.ui.chart;
 
 import com.google.gwt.core.client.GWT;
-
-import com.google.gwt.i18n.client.NumberFormat;
-
 import com.google.gwt.user.client.rpc.AsyncCallback;
-
-import com.smartgwt.client.data.Record;
-
 import com.smartgwt.client.types.ListGridFieldType;
-
 import com.smartgwt.client.util.SC;
-
-import com.smartgwt.client.widgets.Button;
 import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Label;
-
-import com.smartgwt.client.widgets.events.ClickEvent;
-
 import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.FormItemValueFormatter;
-import com.smartgwt.client.widgets.form.FormItemValueParser;
-
-import com.smartgwt.client.widgets.form.fields.FormItem;
 import com.smartgwt.client.widgets.form.fields.SelectItem;
-import com.smartgwt.client.widgets.form.fields.SpinnerItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-
-import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
-import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
-import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
-
 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.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
-
 import com.smartgwt.client.widgets.menu.Menu;
 import com.smartgwt.client.widgets.menu.MenuItem;
-
 import com.smartgwt.client.widgets.menu.events.ClickHandler;
 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
 
 import de.intevation.flys.client.client.Config;
-
 import de.intevation.flys.client.client.services.CrossSectionKMServiceAsync;
 import de.intevation.flys.client.client.services.LoadArtifactService;
 import de.intevation.flys.client.client.services.LoadArtifactServiceAsync;
-
 import de.intevation.flys.client.client.ui.CollectionView;
-
+import de.intevation.flys.client.client.widgets.KMSpinner;
+import de.intevation.flys.client.client.widgets.KMSpinnerChangeListener;
 import de.intevation.flys.client.shared.model.Artifact;
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DefaultArtifact;
@@ -80,7 +50,9 @@
  * Also can show 'area creation' context menus.
  */
 public class CrossSectionChartThemePanel
-extends      ChartThemePanel {
+extends ChartThemePanel
+implements KMSpinnerChangeListener
+{
     /** Artifact Clone/Creation service. */
     protected LoadArtifactServiceAsync loadService =
                 GWT.create(LoadArtifactService.class);
@@ -270,12 +242,14 @@
 
 
     /** Disable the UI (becomes gray, inresponsive to user input). */
+    @Override
     public void disable() {
         this.layout.setDisabled(true);
     }
 
 
     /** DisDisable the UI (becomes ungray, responsive to user input). */
+    @Override
     public void enable() {
         this.layout.setDisabled(false);
     }
@@ -422,9 +396,7 @@
      *                    two values in \param in are in the same distance to
      *                    \param to.
      */
-    public void spinnerValueEntered(final SpinnerItem item,
-        final double enteredKm, final FacetRecord facetRecord, final boolean up
-    ) {
+    public void spinnerValueEntered(KMSpinner spinner, final double enteredKm, final FacetRecord facetRecord, final boolean up) {
         disable();
         Config config       = Config.getInstance();
         final String locale = config.getLocale();
@@ -455,6 +427,7 @@
                     //updateGrid();
                     enable();
                 }
+
                 @Override
                 public void onSuccess(Map<Integer, Double[]> obj) {
                     Double[] kms = obj.get(dbid);
@@ -492,156 +465,13 @@
 
 
     /**
-     * Create a "kilometer spinner" for CrossSection Facets.
-     * @param facetRecord The respective Facet/Theme.
-     * @return label, intialized SpinnerItem.
-     */
-    public SpinnerItem createSpinnerItem(FacetRecord facetRecord) {
-        SpinnerItem spinnerItem = new SpinnerItem();
-        spinnerItem.setShowTitle(false);
-        spinnerItem.setTitle("Waterlevel-Spinner");
-        spinnerItem.setWidth(45);
-        spinnerItem.setDefaultValue(Double.valueOf(facetRecord.getTheme()
-            .getCollectionItem()
-            .getData().get(CS_KM)));
-
-        spinnerItem.setMin(0);
-        spinnerItem.setMax(2000);
-        spinnerItem.setStep(0.1d);
-        spinnerItem.setChangeOnKeypress(true);
-        return spinnerItem;
-    }
-
-
-    /**
-     * SpinnerItem-like element with text label and up/down buttons.
-     */
-    public class KmSpinner extends HLayout {
-        protected Label label;
-
-        protected FacetRecord facetRecord;
-
-        protected double currentValue;
-
-        public KmSpinner(FacetRecord facetRecord) {
-            super(2);
-            this.facetRecord = facetRecord;
-            final FacetRecord _facetRecord = facetRecord;
-            currentValue = Double.valueOf(facetRecord.getTheme()
-                .getCollectionItem().getData().get(CS_KM));
-            // Buttons and labels.
-            int height = 18;
-            // minusButton shall ask service for previous available cs.
-            Button minusButton = new Button("-");
-            minusButton.setWidth(10);
-            minusButton.setHeight(height);
-            minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
-                public void onClick(ClickEvent evt) {
-                    spinnerValueEntered(null, currentValue - 0.1d, _facetRecord, false);
-                }
-            });
-
-            DynamicForm form = new DynamicForm();
-            final TextItem kmField = new TextItem();
-            kmField.setValue(currentValue);
-            kmField.setWidth(35);
-            kmField.setTitle("");
-            kmField.setHeight(height);
-
-            FormItemValueFormatter doubleFormat = new FormItemValueFormatter() {
-                public String formatValue(Object value, Record record,
-                    DynamicForm form, FormItem item) {
-                        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;
-                        }
-                    }
-            };
-            kmField.setEditorValueFormatter(doubleFormat);
-
-            FormItemValueParser doubleParser = new FormItemValueParser() {
-                public Object parseValue(String value,
-                                  DynamicForm form,
-                                  FormItem item) {
-                    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;
-                    }
-                }
-            };
-            kmField.setEditorValueParser(doubleParser);
-
-            // Update on focus lost and enter-pressed.
-            kmField.addBlurHandler(new BlurHandler() {
-                @Override
-                public void onBlur(BlurEvent be) {
-                    if (kmField.getValue() != null) {
-                        try {
-                            spinnerValueEntered(null,
-                                Double.parseDouble(kmField.getValue().toString()),
-                                _facetRecord, true);
-                        }
-                        catch(NumberFormatException nfe) {
-                            GWT.log("entered string cannot be parsed to double.");
-                        }
-                    }
-                }
-            });
-            kmField.addKeyPressHandler(new KeyPressHandler(){
-                @Override
-                public void onKeyPress(KeyPressEvent kpe) {
-                    if (kpe.getKeyName().equals("Enter")) {
-                        kmField.blurItem();
-                    }
-                }
-            });
-            // TODO: i18n Now add all the validators, formatters, editors/parsers  etc.
-            form.setFields(kmField);
-            form.setTitle("");
-            form.setTitlePrefix("");
-            form.setTitleSuffix("");
-            form.setTitleWidth(0);
-            form.setWidth(40);
-            form.setHeight(height);
-            // PlusButton shall ask service for next available cs.
-            Button plusButton = new Button("+");
-            plusButton.setWidth(10);
-            plusButton.setHeight(height);
-            plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
-                public void onClick(ClickEvent evt) {
-                    spinnerValueEntered(null, currentValue + 0.1d, _facetRecord, true);
-                }
-            });
-            this.addMember(minusButton);
-            this.addMember(form);
-            this.addMember(plusButton);
-
-            this.setHeight(height*2);
-            this.setWidth(60);
-        }
-    }
-
-
-    /**
      * Create and configure the Grid to display.
      * @return ListGrid with Themes and related controls inside.
      */
     @Override
     protected ListGrid createGrid() {
+        final CrossSectionChartThemePanel parent = this;
+
         ListGrid list = new ListGrid() {
             @Override
             protected Canvas createRecordComponent(
@@ -659,23 +489,11 @@
                     String fieldName = this.getFieldName(colNum);
 
                     if (fieldName.equals(GRID_FIELD_ACTIONS)) {
-                        /*
-                        TODO:
-                        if (facetRecord.getTheme().getActive() != 1) {
-                            spinnerItem.disable();
-                        }
-                        */
-
-                        /*
-                        // To have visual representation of synchronous
-                        // navigation or not per theme, snip:
-                        if (synchronCrossSectionThemes.contains (themeHash
-                            (facetRecord.getTheme()))) {
-                            spinnerItem.setTextBoxStyle("bgBlueDark");
-                        }
-                        */
-
-                        return new KmSpinner(facetRecord);
+                        double currentValue =
+                            Double.valueOf(facetRecord.getTheme().getCollectionItem().getData().get(CS_KM));
+                        KMSpinner kmSpinner = new KMSpinner(currentValue, facetRecord);
+                        kmSpinner.addChangeListener(parent);
+                        return kmSpinner;
                     }
                     else {
                         return null;
@@ -715,7 +533,7 @@
         name.setType(ListGridFieldType.TEXT);
 
         ListGridField actions = new ListGridField(GRID_FIELD_ACTIONS,
-             MSG.chart_themepanel_header_actions(), 65);
+             MSG.chart_themepanel_header_actions(), 100);
 
         list.setFields(active, name, actions);
     }
@@ -734,6 +552,7 @@
 
 
     /** Returns name of cross section area facets. */
+    @Override
     protected String getAreaFacetName() {
         return "cross_section.area";
     }
@@ -745,6 +564,7 @@
      * TODO join with canArea, generalize to allow easier modification
      *      in subclasses.
      */
+    @Override
     protected boolean areAreaCompatible(Theme a, Theme b) {
         if (a.equals(b)) {
             return false;
@@ -760,6 +580,7 @@
      * True if context menu should contain 'create area' submenu on
      * this theme.
      */
+    @Override
     protected boolean canArea(Theme a) {
         return a.getFacet().equals("cross_section")
             || a.getFacet().equals("cross_section_water_line")
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java	Fri Sep 28 12:15:44 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));
@@ -406,7 +426,7 @@
                         enable();
                     }
                     public void onSuccess(Artifact fartifact) {
-                        GWT.log("Successfully set points ");
+                        GWT.log("Successfully set points");
                         redrawRequestHandler.onRedrawRequest(
                             new RedrawRequestEvent());
                         destroy();
@@ -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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixFunctionSelect.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixGaugeSelectPanel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixMultiPeriodPanel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixationPanel.java	Fri Sep 28 12:15:44 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 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/minfo/BedCampaignChart.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,78 @@
+package de.intevation.flys.client.client.ui.minfo;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.json.client.JSONNumber;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONString;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ResizedHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import de.intevation.flys.client.client.Config;
+import de.intevation.flys.client.shared.model.Artifact;
+
+public class BedCampaignChart extends VLayout {
+
+    private final Artifact artifact;
+
+    protected Img chartImg;
+
+    public BedCampaignChart(Artifact artifact, ResizedHandler resizeHandler) {
+        super();
+
+        this.artifact = artifact;
+        this.chartImg = new Img();
+
+        addResizedHandler(resizeHandler);
+        setAlign(Alignment.CENTER);
+    }
+
+    public void update() {
+        Config config = Config.getInstance();
+        String locale = config.getLocale();
+
+        int hWidth = getWidth() - 12;
+        int hHeight = getHeight() - 12;
+
+        if ((int) (hHeight * 4f / 3) < hWidth) {
+            hWidth = (int) (hHeight * 4f / 3);
+        }
+        else {
+            hHeight = (int) (hWidth * 3f / 4);
+        }
+
+        String river = artifact.getArtifactDescription().getRiver();
+
+        JSONObject jfix = new JSONObject();
+        JSONObject jfilter = new JSONObject();
+        JSONObject jrName = new JSONObject();
+        JSONString jrValue = new JSONString(river);
+        JSONObject jextent = new JSONObject();
+        JSONNumber jwidth = new JSONNumber(hWidth);
+        JSONNumber jheight = new JSONNumber(hHeight);
+
+        jrName.put("name", jrValue);
+        jfilter.put("river", jrName);
+        jextent.put("width", jwidth);
+        jextent.put("height", jheight);
+        jfilter.put("extent", jextent);
+        jfix.put("bed", jfilter);
+        String filter = jfix.toString();
+
+        String imgUrl = GWT.getModuleBaseURL();
+        imgUrl += "bed-km-chart";
+        imgUrl += "?locale=" + locale;
+        imgUrl += "&filter=" + filter;
+
+        if (chartImg != null && hasMember(chartImg)) {
+            chartImg.setWidth(hWidth);
+            chartImg.setHeight(hHeight);
+            chartImg.setSrc(imgUrl);
+        }
+        else {
+            chartImg = new Img(imgUrl, hWidth, hHeight);
+            addMember(chartImg);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/minfo/BedMultiPeriodPanel.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,34 @@
+package de.intevation.flys.client.client.ui.minfo;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ResizedEvent;
+import com.smartgwt.client.widgets.events.ResizedHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import de.intevation.flys.client.client.ui.MultiPeriodPanel;
+
+public class BedMultiPeriodPanel
+extends MultiPeriodPanel
+implements ResizedHandler {
+    protected BedCampaignChart chartContainer1;
+    protected BedloadCampaignChart chartContainer2;
+
+    public BedMultiPeriodPanel() {
+    }
+
+    @Override
+    protected Canvas createHelper() {
+        chartContainer1 = new BedCampaignChart(artifact, this);
+        chartContainer2 = new BedloadCampaignChart(artifact, this);
+        VLayout layout = new VLayout();
+        layout.addMember(chartContainer1);
+        layout.addMember(chartContainer2);
+        return layout;
+    }
+
+    @Override
+    public void onResized(ResizedEvent re) {
+        chartContainer1.update();
+        chartContainer2.update();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/minfo/BedloadCampaignChart.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,78 @@
+package de.intevation.flys.client.client.ui.minfo;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.json.client.JSONNumber;
+import com.google.gwt.json.client.JSONObject;
+import com.google.gwt.json.client.JSONString;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ResizedHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+import de.intevation.flys.client.client.Config;
+import de.intevation.flys.client.shared.model.Artifact;
+
+public class BedloadCampaignChart extends VLayout {
+
+    private final Artifact artifact;
+
+    protected Img chartImg;
+
+    public BedloadCampaignChart(Artifact artifact, ResizedHandler resizeHandler) {
+        super();
+
+        this.artifact = artifact;
+        this.chartImg = new Img();
+
+        addResizedHandler(resizeHandler);
+        setAlign(Alignment.CENTER);
+    }
+
+    public void update() {
+        Config config = Config.getInstance();
+        String locale = config.getLocale();
+
+        int hWidth = getWidth() - 12;
+        int hHeight = getHeight() - 12;
+
+        if ((int) (hHeight * 4f / 3) < hWidth) {
+            hWidth = (int) (hHeight * 4f / 3);
+        }
+        else {
+            hHeight = (int) (hWidth * 3f / 4);
+        }
+
+        String river = artifact.getArtifactDescription().getRiver();
+
+        JSONObject jfix = new JSONObject();
+        JSONObject jfilter = new JSONObject();
+        JSONObject jrName = new JSONObject();
+        JSONString jrValue = new JSONString(river);
+        JSONObject jextent = new JSONObject();
+        JSONNumber jwidth = new JSONNumber(hWidth);
+        JSONNumber jheight = new JSONNumber(hHeight);
+
+        jrName.put("name", jrValue);
+        jfilter.put("river", jrName);
+        jextent.put("width", jwidth);
+        jextent.put("height", jheight);
+        jfilter.put("extent", jextent);
+        jfix.put("bedload", jfilter);
+        String filter = jfix.toString();
+
+        String imgUrl = GWT.getModuleBaseURL();
+        imgUrl += "bedload-km-chart";
+        imgUrl += "?locale=" + locale;
+        imgUrl += "&filter=" + filter;
+
+        if (chartImg != null && hasMember(chartImg)) {
+            chartImg.setWidth(hWidth);
+            chartImg.setHeight(hHeight);
+            chartImg.setSrc(imgUrl);
+        }
+        else {
+            chartImg = new Img(imgUrl, hWidth, hHeight);
+            addMember(chartImg);
+        }
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/range/LocationsTable.java	Fri Sep 28 12:15:44 2012 +0200
@@ -24,7 +24,6 @@
 
 
     public LocationsTable() {
-
         String baseUrl = GWT.getHostPageBaseURL();
 
         setWidth100();
@@ -37,14 +36,14 @@
         setEmptyMessage(MSG.empty_filter());
         setCanReorderFields(false);
 
-        ListGridField addfrom = new ListGridField ("", "");
+        ListGridField addfrom = new ListGridField ("from", MSG.from());
         addfrom.setType(ListGridFieldType.ICON);
-        addfrom.setWidth(20);
+        addfrom.setWidth(30);
         addfrom.setCellIcon(baseUrl + MSG.markerGreen());
 
-        ListGridField addto = new ListGridField("", "");
+        ListGridField addto = new ListGridField("to", MSG.to());
         addto.setType(ListGridFieldType.ICON);
-        addto.setWidth(20);
+        addto.setWidth(30);
         addto.setCellIcon(baseUrl + MSG.markerRed());
 
         ListGridField ldescr = new ListGridField(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/widgets/KMSpinner.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,176 @@
+package de.intevation.flys.client.client.widgets;
+
+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;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.FormItemValueFormatter;
+import com.smartgwt.client.widgets.form.FormItemValueParser;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
+import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressEvent;
+import com.smartgwt.client.widgets.form.fields.events.KeyPressHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import de.intevation.flys.client.shared.model.FacetRecord;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * SpinnerItem-like element with text label and up/down buttons.
+ */
+public class KMSpinner extends HLayout {
+    protected List<KMSpinnerChangeListener> listeners = new ArrayList<KMSpinnerChangeListener>();
+
+    protected Label label;
+    protected FacetRecord facetRecord;
+    protected double value;
+
+    public KMSpinner(double initialValue, FacetRecord facetRecord) {
+        super(2);
+        this.facetRecord = facetRecord;
+        this.value = initialValue;
+
+        setWidth("99%");
+        setHeight(18);
+
+        // minusButton shall ask service for previous available cs.
+        Button minusButton = new Button("-");
+        minusButton.setWidth(18);
+        minusButton.setHeight(18);
+        minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+            public void onClick(ClickEvent evt) {
+                fireChangedEvent(value - 0.1d, false);
+            }
+        });
+
+        DynamicForm form = new DynamicForm();
+        final TextItem kmField = new TextItem();
+        kmField.setValue(initialValue);
+        kmField.setWidth("*");
+        kmField.setTitle("");
+        kmField.setHeight(16);
+
+        FormItemValueFormatter doubleFormat = new FormItemValueFormatter() {
+            public String formatValue(Object value, Record record, DynamicForm form, FormItem item) {
+                if (value != null) {
+                    NumberFormat nf = NumberFormat.getDecimalFormat();
+                    try {
+                        double d = Double.valueOf(value.toString()).doubleValue();
+                        return nf.format(d);
+                    }
+                    catch (Exception e) {
+                        GWT.log("EditorValueFormatter exception: " + e.toString());
+
+                        // Remove junk chars from input string
+                        return doublefyString(value.toString());
+                    }
+                }
+                else {
+                    return null;
+                }
+            }
+        };
+        kmField.setEditorValueFormatter(doubleFormat);
+
+        FormItemValueParser doubleParser = new FormItemValueParser() {
+            public Object parseValue(String value, DynamicForm form, FormItem item) {
+                if (value == null)
+                    return null;
+                try {
+                    NumberFormat nf = NumberFormat.getDecimalFormat();
+                    double d = nf.parse(value.toString());
+                    return Double.toString(d);
+                }
+                catch(NumberFormatException nfe) {
+                    return value;
+                }
+            }
+        };
+        kmField.setEditorValueParser(doubleParser);
+
+        // Update on focus lost and enter-pressed.
+        kmField.addBlurHandler(new BlurHandler() {
+            @Override
+            public void onBlur(BlurEvent be) {
+                if (kmField.getValue() != null) {
+                    try {
+                        fireChangedEvent(Double.parseDouble(kmField.getValue().toString()), true);
+                    }
+                    catch(NumberFormatException nfe) {
+                        GWT.log("entered string cannot be parsed to double.");
+                    }
+                }
+            }
+        });
+        kmField.addKeyPressHandler(new KeyPressHandler() {
+            @Override
+            public void onKeyPress(KeyPressEvent kpe) {
+                if (kpe.getKeyName().equals("Enter")) {
+                    kmField.blurItem();
+                }
+            }
+        });
+
+        // TODO: i18n Now add all the validators, formatters, editors/parsers  etc.
+        form.setFields(kmField);
+        form.setTitle("");
+        form.setTitlePrefix("");
+        form.setTitleSuffix("");
+        form.setTitleWidth(0);
+        form.setWidth(50);
+        form.setHeight(18);
+
+        // PlusButton shall ask service for next available cs.
+        Button plusButton = new Button("+");
+        plusButton.setWidth(18);
+        plusButton.setHeight(18);
+        plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+            public void onClick(ClickEvent evt) {
+                fireChangedEvent(value + 0.1d, true);
+            }
+        });
+
+        this.addMember(minusButton);
+        this.addMember(form);
+        this.addMember(plusButton);
+    }
+
+    public void addChangeListener(KMSpinnerChangeListener listener) {
+        this.listeners.add(listener);
+    }
+
+    protected void fireChangedEvent(double val, boolean up) {
+        for(KMSpinnerChangeListener listener : listeners) {
+            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();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/widgets/KMSpinnerChangeListener.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,9 @@
+package de.intevation.flys.client.client.widgets;
+
+import de.intevation.flys.client.client.widgets.KMSpinner;
+
+import de.intevation.flys.client.shared.model.FacetRecord;
+
+public interface KMSpinnerChangeListener {
+    public void spinnerValueEntered(KMSpinner spinner, double km, FacetRecord facetRecord, boolean up);
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactHelper.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ArtifactServiceImpl.java	Fri Sep 28 12:15:44 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 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/BedKMChartServiceImpl.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,106 @@
+package de.intevation.flys.client.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+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.http.response.StreamResponseHandler;
+
+public class BedKMChartServiceImpl extends HttpServlet {
+    private static final Logger log =
+        Logger.getLogger(FixingsKMChartServiceImpl.class);
+
+    public static final String SERVICE_NAME = "bed-km-chart";
+
+    public BedKMChartServiceImpl() {
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse resp) {
+
+        log.info("BedKMChartServiceImpl.doGet");
+
+        String url    = getServletContext().getInitParameter("server-url");
+        String locale = req.getParameter("locale");
+        String filter = req.getParameter("filter");
+
+        if (filter == null || filter.length() == 0) {
+            log.warn("Missing 'filter' parameter.");
+            return;
+        }
+
+        if (locale == null || locale.length() == 0) {
+            locale = "de";
+        }
+
+        Document filterDoc = XMLUtils.jsonToXML(filter);
+
+        if (filterDoc == null) {
+            log.warn("Creating filter document failed.");
+            return;
+        }
+
+        InputStream in;
+
+        try {
+            HttpClient client = new HttpClientImpl(url, locale);
+            in = (InputStream)client.callService(
+                url, // XXX: Why? The URL is passed by construction already.
+                SERVICE_NAME,
+                filterDoc,
+                new StreamResponseHandler());
+        }
+        catch (ConnectionException ce) {
+            log.error(ce);
+            return;
+        }
+
+        resp.setHeader("Content-Type", guessMIMEType(filterDoc));
+
+        try {
+            OutputStream out = resp.getOutputStream();
+
+            byte [] buf = new byte[4096];
+            int i = -1;
+            while ((i = in.read(buf)) >= 0) {
+                out.write(buf, 0, i);
+            }
+            out.flush();
+        }
+        catch (IOException ioe) {
+            log.error(ioe);
+        }
+        finally {
+            try { in.close(); }
+            catch (IOException ioe) { /* ignored */ }
+        }
+    }
+
+    protected static String guessMIMEType(Document document) {
+
+        NodeList formats = document.getElementsByTagName("format");
+
+        String format = "png";
+
+        if (formats.getLength() > 0) {
+            String type = ((Element)formats.item(0)).getAttribute("type");
+            if (type.length() > 0) {
+                format = type;
+            }
+        }
+
+        return "image/" + format;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/BedloadKMChartServiceImpl.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,106 @@
+package de.intevation.flys.client.server;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+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.http.response.StreamResponseHandler;
+
+public class BedloadKMChartServiceImpl extends HttpServlet {
+   private static final Logger log =
+        Logger.getLogger(FixingsKMChartServiceImpl.class);
+
+    public static final String SERVICE_NAME = "bedload-km-chart";
+
+    public BedloadKMChartServiceImpl() {
+    }
+
+    public void doGet(HttpServletRequest req, HttpServletResponse resp) {
+
+        log.info("BedloadKMChartServiceImpl.doGet");
+
+        String url    = getServletContext().getInitParameter("server-url");
+        String locale = req.getParameter("locale");
+        String filter = req.getParameter("filter");
+
+        if (filter == null || filter.length() == 0) {
+            log.warn("Missing 'filter' parameter.");
+            return;
+        }
+
+        if (locale == null || locale.length() == 0) {
+            locale = "de";
+        }
+
+        Document filterDoc = XMLUtils.jsonToXML(filter);
+
+        if (filterDoc == null) {
+            log.warn("Creating filter document failed.");
+            return;
+        }
+
+        InputStream in;
+
+        try {
+            HttpClient client = new HttpClientImpl(url, locale);
+            in = (InputStream)client.callService(
+                url, // XXX: Why? The URL is passed by construction already.
+                SERVICE_NAME,
+                filterDoc,
+                new StreamResponseHandler());
+        }
+        catch (ConnectionException ce) {
+            log.error(ce);
+            return;
+        }
+
+        resp.setHeader("Content-Type", guessMIMEType(filterDoc));
+
+        try {
+            OutputStream out = resp.getOutputStream();
+
+            byte [] buf = new byte[4096];
+            int i = -1;
+            while ((i = in.read(buf)) >= 0) {
+                out.write(buf, 0, i);
+            }
+            out.flush();
+        }
+        catch (IOException ioe) {
+            log.error(ioe);
+        }
+        finally {
+            try { in.close(); }
+            catch (IOException ioe) { /* ignored */ }
+        }
+    }
+
+    protected static String guessMIMEType(Document document) {
+
+        NodeList formats = document.getElementsByTagName("format");
+
+        String format = "png";
+
+        if (formats.getLength() > 0) {
+            String type = ((Element)formats.item(0)).getAttribute("type");
+            if (type.length() > 0) {
+                format = type;
+            }
+        }
+
+        return "image/" + format;
+    }
+}
--- a/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/FLYSArtifactCreator.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/GGInAFilter.java	Fri Sep 28 12:15:44 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");
     }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,207 @@
+package de.intevation.flys.client.server;
+
+import java.util.ArrayList;
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifacts.common.ArtifactNamespaceContext;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
+import de.intevation.artifacts.httpclient.http.HttpClient;
+import de.intevation.artifacts.httpclient.http.HttpClientImpl;
+
+import de.intevation.flys.client.client.services.GaugeOverviewInfoService;
+import de.intevation.flys.client.shared.exceptions.ServerException;
+import de.intevation.flys.client.shared.model.DefaultGaugeInfo;
+import de.intevation.flys.client.shared.model.DefaultRiverInfo;
+import de.intevation.flys.client.shared.model.GaugeInfo;
+import de.intevation.flys.client.shared.model.RiverInfo;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class GaugeOverviewInfoServiceImpl
+extends      RemoteServiceServlet
+implements   GaugeOverviewInfoService
+{
+    private static final Logger logger =
+        Logger.getLogger(GaugeOverviewInfoServiceImpl.class);
+
+    public static final String ERROR_NO_RIVERINFO_FOUND =
+        "error_no_gaugeoverviewinfo_found";
+
+    private static final String XPATH_RIVER = "/art:gauge-info/art:river";
+
+    private static final String XPATH_GAUGES = "/art:gauge-info/art:gauges/art:gauge";
+
+    public RiverInfo getRiverInfo(String river) throws ServerException {
+        logger.info("RiverInfoServiceImpl.getRiverInfo");
+
+        String url = getServletContext().getInitParameter("server-url");
+
+        Document doc = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
+            doc,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element riverele = ec.create("river");
+        riverele.setTextContent(river);
+
+        doc.appendChild(riverele);
+
+        HttpClient client = new HttpClientImpl(url);
+
+        try {
+            Document result = client.callService(url, "gaugeoverviewinfo", doc);
+
+            Element riverresp = (Element) XMLUtils.xpath(
+                    result,
+                    XPATH_RIVER,
+                    XPathConstants.NODE,
+                    ArtifactNamespaceContext.INSTANCE);
+
+            String rname = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "name");
+            String rkmup = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "kmup");
+            String rstart = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "start");
+            String rend = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "end");
+            String rwstunit = riverresp.getAttributeNS(
+                    ArtifactNamespaceContext.NAMESPACE_URI, "wstunit");
+            String rminq = riverresp.getAttributeNS(
+                    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);
+
+            boolean kmup = rkmup.equalsIgnoreCase("true");
+
+            NodeList gaugenodes = (NodeList) XMLUtils.xpath(
+                result,
+                XPATH_GAUGES,
+                XPathConstants.NODESET,
+                ArtifactNamespaceContext.INSTANCE);
+
+            int num = gaugenodes == null ? 0 : gaugenodes.getLength();
+
+            ArrayList<GaugeInfo> gauges = new ArrayList<GaugeInfo>(num);
+
+            if (num == 0) {
+                logger.warn("No gauge info found.");
+            }
+            else {
+                logger.debug("Found " + num + " gauges.");
+
+                for (int i = 0; i < num; i++) {
+                    Element gaugeele = (Element)gaugenodes.item(i);
+
+                    String gname = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "name");
+                    String gstart = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "start");
+                    String gend = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "end");
+                    String gdatum = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "datum");
+                    String gaeo = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "aeo");
+                    String gminq = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "minq");
+                    String gminw = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "minw");
+                    String gmaxq = gaugeele.getAttributeNS(
+                            ArtifactNamespaceContext.NAMESPACE_URI, "maxq");
+                    String gmaxw = gaugeele.getAttributeNS(
+                            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),
+                            parseDouble(gstart),
+                            parseDouble(gend),
+                            parseDouble(gdatum),
+                            parseDouble(gaeo),
+                            parseDouble(gminq),
+                            parseDouble(gmaxq),
+                            parseDouble(gminw),
+                            parseDouble(gmaxw),
+                            rwstunit,
+                            parseLong(gofficial)
+                            );
+
+                    gauges.add(gaugeinfo);
+                }
+            }
+
+            RiverInfo riverinfo = new DefaultRiverInfo(
+                    rname,
+                    kmup,
+                    parseDouble(rstart),
+                    parseDouble(rend),
+                    rwstunit,
+                    parseDouble(rminq),
+                    parseDouble(rmaxq),
+                    parseLong(rofficial),
+                    gauges);
+
+            logger.debug("Finished RiverInfoService.");
+
+            return riverinfo;
+        }
+        catch (ConnectionException ce) {
+            logger.error(ce, ce);
+        }
+
+        logger.warn("No gauge found");
+        throw new ServerException(ERROR_NO_RIVERINFO_FOUND);
+    }
+
+    /**
+     * Avoids NullPointerException when parsing double value
+     */
+    private Double parseDouble(String value) {
+        if (value == null || value.isEmpty()) {
+            return null;
+        }
+        try {
+            return Double.valueOf(value);
+        }
+        catch(NumberFormatException e) {
+            logger.error(e, e);
+            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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/LoginServlet.java	Fri Sep 28 12:15:44 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,12 +49,13 @@
     protected void doGet(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
         logger.debug("Processing get request");
-        this.redirectFailure(resp);
+        this.redirectFailure(resp, req.getContextPath());
     }
 
     @Override
     protected void doPost(HttpServletRequest req, HttpServletResponse resp)
-    throws ServletException, IOException {
+    throws ServletException, IOException
+    {
         String encoding = req.getCharacterEncoding();
         String username = req.getParameter("username");
         String password = req.getParameter("password");
@@ -58,13 +64,15 @@
 
         if (username == null || password == null) {
             logger.debug("No username or password provided");
-            this.redirectFailure(resp);
+            this.redirectFailure(resp, req.getContextPath());
+            return;
         }
+
         try {
             Authentication aresp = this.auth(username, password, encoding);
             if (aresp == null || !aresp.isSuccess()) {
-                logger.debug("Athentication not successful");
-                this.redirectFailure(resp);
+                logger.debug("Authentication not successful");
+                this.redirectFailure(resp, req.getContextPath());
             }
             User user = aresp.getUser();
 
@@ -73,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");
                 }
             }
 
@@ -82,16 +91,17 @@
 
             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);
         }
     }
 
     private Authentication auth(String username, String password, String encoding)
-        throws AuthenticationException, IOException {
+        throws AuthenticationException, IOException
+    {
         ServletContext sc = this.getServletContext();
         Features features = (Features)sc.getAttribute(Features.CONTEXT_ATTRIBUTE);
         String auth = sc.getInitParameter("authentication");
--- a/flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/RemoteServiceServlet.java	Fri Sep 28 12:15:44 2012 +0200
@@ -9,9 +9,10 @@
 {
     /**
      * Return the current logged in user from the HTTP Session
-    */
+     */
     public User getUser() {
         HttpSession session = this.getThreadLocalRequest().getSession();
         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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/UserServiceImpl.java	Fri Sep 28 12:15:44 2012 +0200
@@ -1,15 +1,10 @@
 package de.intevation.flys.client.server;
 
-import javax.xml.xpath.XPathConstants;
-
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import org.apache.log4j.Logger;
 
 import de.intevation.artifacts.common.ArtifactNamespaceContext;
-import de.intevation.artifacts.common.utils.XMLUtils;
 
 import de.intevation.artifacts.httpclient.exceptions.ConnectionException;
 
@@ -26,10 +21,12 @@
 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_SUCH_USER = "error_no_such_user";
+    public static final String ERROR_NO_USERS = "error_no_users";
 
     public User getCurrentUser(String locale)
     throws AuthenticationException
@@ -39,6 +36,11 @@
         UserClient client = new UserClient(url);
         de.intevation.flys.client.server.auth.User loginuser = getUser();
 
+        if (loginuser == null) {
+            logger.debug("no session user");
+            throw new AuthenticationException(ERROR_NO_SUCH_USER);
+        }
+
         try {
             Element user = client.findUser(loginuser);
 
@@ -56,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/server/auth/AuthenticationFactory.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/AuthenticationFactory.java	Fri Sep 28 12:15:44 2012 +0200
@@ -8,19 +8,24 @@
         Logger.getLogger(AuthenticationFactory.class);
 
     public static Authenticator getInstance(String name)
-        throws IllegalArgumentException {
-        if (name == null
-        || name.equalsIgnoreCase("was")
-        || name.equalsIgnoreCase("ggina")) {
+        throws IllegalArgumentException
+    {
+        if (name == null) {
+            throw new IllegalArgumentException("Authentication type name is null");
+        }
+
+        if (name.equalsIgnoreCase("was") ||
+            name.equalsIgnoreCase("ggina")) {
             log.debug("Using GGinA authenticator.");
             return
                 new de.intevation.flys.client.server.auth.was.Authenticator();
         }
-        if (name.equalsIgnoreCase("plain")) {
+        else if (name.equalsIgnoreCase("plain")) {
             log.debug("Using plain authenticator.");
             return
                 new de.intevation.flys.client.server.auth.plain.Authenticator();
         }
+
         throw new IllegalArgumentException("Unkown Authentication " + name);
     }
 }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/UserClient.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/UserClient.java	Fri Sep 28 12:15:44 2012 +0200
@@ -31,11 +31,12 @@
     }
 
     public boolean userExists(User user) throws ConnectionException {
-        Element data = this.findUser(user);
-
         if (user == null) {
             return false;
         }
+
+        Element data = this.findUser(user);
+
         String XPATH_USERACCOUNT = "/art:user/art:account/@art:name";
 
         String account = XMLUtils.xpathString(
@@ -49,6 +50,11 @@
     }
 
     public boolean createUser(User user) throws ConnectionException {
+        if(user == null) {
+            logger.warn("createUser: given user is null");
+            return false;
+        }
+
         logger.debug("Creating new user " + user.getName());
         HttpClient client = new HttpClientImpl(this.url);
 
@@ -106,6 +112,10 @@
     }
 
     public Element findUser(User user) throws ConnectionException {
+        if(user == null) {
+            throw new IllegalArgumentException("user is null");
+        }
+
         HttpClient client = new HttpClientImpl(this.url);
 
         Document document = XMLUtils.newDocument();
@@ -127,11 +137,19 @@
         action.appendChild(account);
         document.appendChild(action);
 
-        logger.debug("Find user request xml: " + XMLUtils.toString(document));
+        boolean debug = logger.isDebugEnabled();
+
+        if (debug) {
+            logger.debug("Find user request xml: " +
+                XMLUtils.toString(document));
+        }
 
         Document resp = client.findUser(document);
 
-        logger.debug("Find user request response xml: " + XMLUtils.toString(resp));
+        if (debug) {
+            logger.debug("Find user request response xml: " +
+                XMLUtils.toString(resp));
+        }
 
         return resp.getDocumentElement();
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/auth/plain/Authenticator.java	Fri Sep 28 12:15:44 2012 +0200
@@ -16,6 +16,9 @@
 
 import de.intevation.flys.client.server.features.Features;
 
+/**
+ * Authenticator that uses a local file as user backend.
+ */
 public class Authenticator
 implements   de.intevation.flys.client.server.auth.Authenticator
 {
@@ -97,10 +100,12 @@
                 || line.startsWith("#")) {
                     continue;
                 }
-                String [] parts = line.split("\\s+");
+
+                String[] parts = line.split("\\s+");
                 if (parts.length < 2) {
                     continue;
                 }
+
                 if (parts[0].equals(username)) {
                     log.debug("user '" + username + "' found.");
                     if (parts[1].equals(password)) {
@@ -123,7 +128,7 @@
             reader.close();
         }
         log.debug("failed");
-        return new Authentication(null, null, new ArrayList<String>(0), features);
+        return null;
     }
 }
 // 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/DefaultArtifactDescription.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultArtifactDescription.java	Fri Sep 28 12:15:44 2012 +0200
@@ -161,6 +161,9 @@
 
 
     public String getDataValueAsString(String name) {
+        if (oldData == null) {
+            return null;
+        }
         for (DataList list: oldData) {
             List<Data> dataList = list.getAll();
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,151 @@
+package de.intevation.flys.client.shared.model;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public class DefaultGaugeInfo implements GaugeInfo {
+
+    private String name;
+    private Double start;
+    private Double end;
+    private Double aeo;
+    private Double datum;
+    private Double minq;
+    private Double maxq;
+    private Double minw;
+    private Double maxw;
+    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,
+            Double start,
+            Double end,
+            Double datum,
+            Double aeo,
+            Double minq,
+            Double maxq,
+            Double minw,
+            Double maxw,
+            String wstunit,
+            Long official)
+    {
+        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
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * Returns the start KM of the gauge or null if not available
+     */
+    public Double getKmStart() {
+        return this.start;
+    }
+
+    /**
+     * Returns the end KM of the gauge or null if not available
+     */
+    public Double getKmEnd() {
+        return this.end;
+    }
+
+    /**
+     * Returns the mimimum Q value at this gauge or null if not available
+     */
+    public Double getMinQ() {
+        return this.minq;
+    }
+
+    /**
+     * Returns the maximum Q value at this gauge or null if not available
+     */
+    public Double getMaxQ() {
+        return this.maxq;
+    }
+
+    /**
+     * Returns the mimimum W value at this gauge or null if not available
+     */
+    public Double getMinW() {
+        return this.minw;
+    }
+
+    /**
+     * Returns the maximim W value at this gauge or null if not available
+     */
+    public Double getMaxW() {
+        return this.maxw;
+    }
+
+    /**
+     * Returns the datum value or null if not available
+     */
+    public Double getDatum() {
+        return this.datum;
+    }
+
+    /**
+     * Returns the aeo value or null if not available
+     */
+    public Double getAeo() {
+        return this.aeo;
+    }
+
+    public boolean isKmUp() {
+        return this.kmup;
+    }
+
+    /**
+     * Returns the station km of the gauge or null if not available
+     */
+    public Double getStation() {
+        return this.station;
+    }
+
+    /**
+     * Returns the wst unit as a String
+     */
+    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;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultRiverInfo.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,107 @@
+package de.intevation.flys.client.shared.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+
+public class DefaultRiverInfo implements RiverInfo {
+
+    private String name;
+    private boolean kmup;
+    private Double start;
+    private Double end;
+    private String wstunit;
+    private Double minq;
+    private Double maxq;
+    private Long officialnumber;
+
+    private List<GaugeInfo> gaugeinfo;
+
+    public DefaultRiverInfo() {
+    }
+
+    public DefaultRiverInfo(
+            String name,
+            boolean kmup,
+            Double start,
+            Double end,
+            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.officialnumber = official;
+        this.gaugeinfo      = gaugeinfo;
+    }
+
+
+    public boolean isKmUp() {
+        return this.kmup;
+    }
+
+    /**
+     * Start KM of the river
+     */
+    public Double getKmStart() {
+        return this.start;
+    }
+
+    /**
+     * End KM of the river
+     */
+    public Double getKmEnd() {
+        return this.end;
+    }
+
+    /**
+     * Returns the name of the river
+     */
+    public String getName() {
+        return this.name;
+    }
+
+    /**
+     * Returns the name of the WST unit
+     */
+    public String getWstUnit() {
+        return this.wstunit;
+    }
+
+    /**
+     * Return all gauge info of the river
+     */
+    public List<GaugeInfo> getGauges() {
+        return this.gaugeinfo;
+    }
+
+    /**
+     * Returns the min q value of the river
+     */
+    public Double getMinQ() {
+        return this.minq;
+    }
+
+    /**
+     * Returns the max q value of the river
+     */
+    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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DoubleProperty.java	Fri Sep 28 12:15:44 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:44 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 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,76 @@
+package de.intevation.flys.client.shared.model;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+public interface GaugeInfo extends Serializable {
+
+    /**
+     * Returns the name of the gauge
+     */
+    String getName();
+
+    /**
+     * Returns the start KM of the gauge or null if not available
+     */
+    Double getKmStart();
+
+    /**
+     * Returns the end KM of the gauge or null if not available
+     */
+    Double getKmEnd();
+
+    /**
+     * Returns the mimimum Q value at this gauge or null if not available
+     */
+    Double getMinQ();
+
+    /**
+     * Returns the maximum Q value at this gauge or null if not available
+     */
+    Double getMaxQ();
+
+    /**
+     * Returns the mimimum W value at this gauge or null if not available
+     */
+    Double getMinW();
+
+    /**
+     * Returns the maximim W value at this gauge or null if not available
+     */
+    Double getMaxW();
+
+    /**
+     * Returns the datum value or null if not available
+     */
+    Double getDatum();
+
+    /**
+     * Returns the aeo value or null if not available
+     */
+    Double getAeo();
+
+    boolean isKmUp();
+
+    /**
+     * Returns the station km of the gauge or null if not available
+     */
+    Double getStation();
+
+    /**
+     * 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/IntegerOptionsData.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/MapMode.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertyGroup.java	Fri Sep 28 12:15:44 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:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/PropertySetting.java	Fri Sep 28 12:15:44 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());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/RiverInfo.java	Fri Sep 28 12:15:44 2012 +0200
@@ -0,0 +1,55 @@
+package de.intevation.flys.client.shared.model;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
+ */
+
+public interface RiverInfo extends Serializable {
+
+    boolean isKmUp();
+
+    /**
+     * Start KM of the river
+     */
+    Double getKmStart();
+
+    /**
+     * End KM of the river
+     */
+    Double getKmEnd();
+
+    /**
+     * Returns the name of the river
+     */
+    String getName();
+
+    /**
+     * Returns the name of the WST unit
+     */
+    String getWstUnit();
+
+    /**
+     * Return all gauge info of the river
+     */
+    List<GaugeInfo> getGauges();
+
+    /**
+     * Returns the min q value of the river
+     */
+    Double getMinQ();
+
+    /**
+     * Returns the max q value of the river
+     */
+    Double getMaxQ();
+
+    /**
+     * Returns the official number of the river
+     */
+    Long getOfficialNumber();
+}
+
+
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/StringOptionsData.java	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/StringOptionsData.java	Fri Sep 28 12:15:44 2012 +0200
@@ -17,7 +17,7 @@
 
     public StringOptionsData(String label, String desc, DataItem[] opts) {
         this.label       = label;
-        this.description = description;
+        this.description = desc;
         this.opts        = opts;
     }
 
--- a/flys-client/src/main/webapp/FLYS.css	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/webapp/FLYS.css	Fri Sep 28 12:15:44 2012 +0200
@@ -171,3 +171,16 @@
 #authentication table {
     margin-bottom: 1em;
 }
+
+.riverinfopanel {
+    border: 3px solid #CFE1F1;
+    padding: 8px;
+    margin-top: 10px;
+    margin-left: 10px;
+    margin-bottom: 10px;
+    font-size: 1.3em;
+}
+
+.riverinfopanel .gwt-Label {
+    margin-right: 10px;
+}
--- a/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:15:44 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>
@@ -487,6 +497,26 @@
   </servlet-mapping>
 
   <servlet>
+    <servlet-name>BedKMChart</servlet-name>
+    <servlet-class>de.intevation.flys.client.server.BedKMChartServiceImpl</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>BedKMChart</servlet-name>
+    <url-pattern>/flys/bed-km-chart</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>BedloadKMChart</servlet-name>
+    <servlet-class>de.intevation.flys.client.server.BedloadKMChartServiceImpl</servlet-class>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>BedloadKMChart</servlet-name>
+    <url-pattern>/flys/bedload-km-chart</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
     <servlet-name>login</servlet-name>
     <servlet-class>de.intevation.flys.client.server.LoginServlet</servlet-class>
   </servlet>
--- a/flys-client/src/main/webapp/login.jsp	Fri Sep 28 12:14:44 2012 +0200
+++ b/flys-client/src/main/webapp/login.jsp	Fri Sep 28 12:15:44 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